From dc024cb574c507e522eb46692d9b4720121e179d Mon Sep 17 00:00:00 2001 From: steveny91 Date: Thu, 30 Nov 2023 12:24:32 -0500 Subject: [PATCH 1/4] add cpu pct metric retrieve from query --- ibm_i/datadog_checks/ibm_i/queries.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ibm_i/datadog_checks/ibm_i/queries.py b/ibm_i/datadog_checks/ibm_i/queries.py index 649ac56ea1524..87b36aedd97ec 100644 --- a/ibm_i/datadog_checks/ibm_i/queries.py +++ b/ibm_i/datadog_checks/ibm_i/queries.py @@ -149,6 +149,7 @@ def get_active_job_status(timeout): "SUBSTR(SUBSTR(A.JOB_NAME,POSSTR(A.JOB_NAME,'/')+1),POSSTR(SUBSTR(A.JOB_NAME,POSSTR(A.JOB_NAME,'/')+1),'/')+1) AS JOB_NAME, " # noqa:E501 "A.SUBSYSTEM, 'ACTIVE', A.JOB_STATUS, 1, " "CASE WHEN A.ELAPSED_TIME = 0 THEN 0 ELSE A.ELAPSED_CPU_TIME / (10 * A.ELAPSED_TIME) END AS CPU_RATE, " + "A.ELAPSED_CPU_PERCENTAGE AS CPU_PERCENT, " "(DAYS(CURRENT TIMESTAMP) - DAYS(A.JOB_ACTIVE_TIME)) * 86400 + MIDNIGHT_SECONDS(CURRENT TIMESTAMP) - MIDNIGHT_SECONDS(A.JOB_ACTIVE_TIME) AS ACTIVE_DURATION " # noqa:E501 # Two queries: one to fetch the stats, another to reset them "FROM TABLE(QSYS2.ACTIVE_JOB_INFO('NO', '', '', '', 'ALL')) A INNER JOIN TABLE(QSYS2.ACTIVE_JOB_INFO('YES', '', '', '')) B " # noqa:E501 @@ -166,6 +167,7 @@ def get_active_job_status(timeout): {'name': 'job_active_status', 'type': 'tag'}, {'name': 'ibm_i.job.status', 'type': 'gauge'}, {'name': 'ibm_i.job.cpu_usage', 'type': 'gauge'}, + {'name': 'ibm_i.job.cpu_usage.pct', 'type': 'gauge'}, {'name': 'ibm_i.job.active_duration', 'type': 'gauge'}, ], } From df2b83f753c7816fc8114edbf9322588ba40bb1f Mon Sep 17 00:00:00 2001 From: steveny91 Date: Mon, 4 Dec 2023 19:05:04 -0500 Subject: [PATCH 2/4] add changelog --- ibm_i/changelog.d/16332.added | 1 + 1 file changed, 1 insertion(+) create mode 100644 ibm_i/changelog.d/16332.added diff --git a/ibm_i/changelog.d/16332.added b/ibm_i/changelog.d/16332.added new file mode 100644 index 0000000000000..d924fc97ca8a0 --- /dev/null +++ b/ibm_i/changelog.d/16332.added @@ -0,0 +1 @@ +Add `cpu_usage.pct` metric from `ELAPSED_CPU_PERCENTAGE` retrieved from query From 4444ff839226ce815e5c8c62e91d7520d7d79e68 Mon Sep 17 00:00:00 2001 From: steveny91 Date: Tue, 5 Dec 2023 12:52:24 -0500 Subject: [PATCH 3/4] add metadata entry --- ibm_i/metadata.csv | 55 +++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/ibm_i/metadata.csv b/ibm_i/metadata.csv index bed8b3f3cf616..76401b2914aec 100644 --- a/ibm_i/metadata.csv +++ b/ibm_i/metadata.csv @@ -1,27 +1,28 @@ -metric_name,metric_type,interval,unit_name,per_unit_name,description,orientation,integration,short_name,curated_metric -ibm_i.asp.unit_storage_capacity,gauge,,byte,,The storage capacity of the unit,0,ibm_i,asp capacity, -ibm_i.asp.unit_space_available,gauge,,byte,,The space on the unit available for use,0,ibm_i,asp available, -ibm_i.asp.percent_used,gauge,,percent,,The percentage consumed from the disk unit,0,ibm_i,asp percent used, -ibm_i.asp.percent_busy,gauge,,percent,,The percentage of time the disk unit is in use,0,ibm_i,asp percent busy, -ibm_i.asp.io_requests_per_s,gauge,,unit,second,The average number of I/O requests for read and write operations that occurred per second,0,ibm_i,asp io requests, -ibm_i.system.cpu_usage,gauge,,percent,,The average CPU utilization for all the active processors.,0,ibm_i,cpu usage, -ibm_i.system.configured_cpus,gauge,,unit,,The total number of configured CPUs for the partition.,0,ibm_i,configured cpus, -ibm_i.system.current_cpu_capacity,gauge,,,,The processor units that are being used in the partition.,0,ibm_i,current cpu capacity, -ibm_i.system.shared_cpu_usage,gauge,,percent,,The percentage of the total shared processor pool capacity used by all partitions using the pool.,0,ibm_i,shared cpu usage, -ibm_i.system.normalized_cpu_usage,gauge,,percent,,The normalized percentage of CPU utilization for processing units in use.,0,ibm_i,normalized cpu usage, -ibm_i.job.status,gauge,,,,Whether a job is currently active or not.,0,ibm_i,job status, -ibm_i.job.jobq_duration,gauge,,second,,The amount of time a job has been in the JOBQ status,-1,ibm_i,job jobq duration, -ibm_i.job.active_duration,gauge,,second,,The amount of time a job has been active,1,ibm_i,job active duration, -ibm_i.job.cpu_usage,gauge,,,,The CPU usage by a job,0,ibm_i,job cpu, -ibm_i.job.temp_storage,gauge,,mebibyte,,The amount of temporary storage that is currently allocated to a job,0,ibm_i,job storage, -ibm_i.pool.size,gauge,,mebibyte,,The amount of main storage in a pool,0,ibm_i,pool size, -ibm_i.pool.reserved_size,gauge,,mebibyte,,The amount of storage in a pool reserved for system use,0,ibm_i,pool reserved, -ibm_i.pool.defined_size,gauge,,mebibyte,,"The size of a pool as defined in the shared pool, subsystem description, or system value QMCHPOOL",0,ibm_i,pool defined, -ibm_i.subsystem.active,gauge,,,,Whether a subsystem is currently active,0,ibm_i,subsys active, -ibm_i.subsystem.active_jobs,gauge,,unit,,The number of jobs currently active in a subsystem,0,ibm_i,subsys jobs, -ibm_i.job_queue.size,gauge,,unit,,The number of jobs in a job queue,0,ibm_i,jobq size, -ibm_i.job_queue.released_size,gauge,,unit,,The number of jobs in *RELEASED status in a job queue,0,ibm_i,jobq released, -ibm_i.job_queue.scheduled_size,gauge,,unit,,The number of jobs in *SCHEDULED status in a job queue,0,ibm_i,jobq scheduled, -ibm_i.job_queue.held_size,gauge,,unit,,The number of jobs in *HELD status in a job queue,0,ibm_i,jobq held, -ibm_i.message_queue.size,gauge,,unit,,The number of messages in a system message queue,0,ibm_i,msgq size, -ibm_i.message_queue.critical_size,gauge,,unit,,The number of critical messages in a system message queue,-1,ibm_i,msgq critical, +metric_name ,metric_type ,interval ,unit_name ,per_unit_name ,description ,orientation ,integration ,short_name ,curated_metric +ibm_i.asp.unit_storage_capacity ,gauge , ,byte , ,The storage capacity of the unit ,0 ,ibm_i ,asp capacity , +ibm_i.asp.unit_space_available ,gauge , ,byte , ,The space on the unit available for use ,0 ,ibm_i ,asp available , +ibm_i.asp.percent_used ,gauge , ,percent , ,The percentage consumed from the disk unit ,0 ,ibm_i ,asp percent used , +ibm_i.asp.percent_busy ,gauge , ,percent , ,The percentage of time the disk unit is in use ,0 ,ibm_i ,asp percent busy , +ibm_i.asp.io_requests_per_s ,gauge , ,unit ,second ,The average number of I/O requests for read and write operations that occurred per second ,0 ,ibm_i ,asp io requests , +ibm_i.system.cpu_usage ,gauge , ,percent , ,The average CPU utilization for all the active processors. ,0 ,ibm_i ,cpu usage , +ibm_i.system.configured_cpus ,gauge , ,unit , ,The total number of configured CPUs for the partition. ,0 ,ibm_i ,configured cpus , +ibm_i.system.current_cpu_capacity ,gauge , , , ,The processor units that are being used in the partition. ,0 ,ibm_i ,current cpu capacity , +ibm_i.system.shared_cpu_usage ,gauge , ,percent , ,The percentage of the total shared processor pool capacity used by all partitions using the pool. ,0 ,ibm_i ,shared cpu usage , +ibm_i.system.normalized_cpu_usage ,gauge , ,percent , ,The normalized percentage of CPU utilization for processing units in use. ,0 ,ibm_i ,normalized cpu usage , +ibm_i.job.status ,gauge , , , ,Whether a job is currently active or not. ,0 ,ibm_i ,job status , +ibm_i.job.jobq_duration ,gauge , ,second , ,The amount of time a job has been in the JOBQ status ,-1 ,ibm_i ,job jobq duration , +ibm_i.job.active_duration ,gauge , ,second , ,The amount of time a job has been active ,1 ,ibm_i ,job active duration , +ibm_i.job.cpu_usage ,gauge , , , ,The CPU usage by a job ,0 ,ibm_i ,job cpu , +ibm_i.job.cpu_usage.pct ,gauge , ,percent , ,The CPU usage by a job as a percentage ,0 ,ibm_i ,job cpu , +ibm_i.job.temp_storage ,gauge , ,mebibyte , ,The amount of temporary storage that is currently allocated to a job ,0 ,ibm_i ,job storage , +ibm_i.pool.size ,gauge , ,mebibyte , ,The amount of main storage in a pool ,0 ,ibm_i ,pool size , +ibm_i.pool.reserved_size ,gauge , ,mebibyte , ,The amount of storage in a pool reserved for system use ,0 ,ibm_i ,pool reserved , +ibm_i.pool.defined_size ,gauge , ,mebibyte , ,"The size of a pool as defined in the shared pool, subsystem description, or system value QMCHPOOL" ,0 ,ibm_i ,pool defined , +ibm_i.subsystem.active ,gauge , , , ,Whether a subsystem is currently active ,0 ,ibm_i ,subsys active , +ibm_i.subsystem.active_jobs ,gauge , ,unit , ,The number of jobs currently active in a subsystem ,0 ,ibm_i ,subsys jobs , +ibm_i.job_queue.size ,gauge , ,unit , ,The number of jobs in a job queue ,0 ,ibm_i ,jobq size , +ibm_i.job_queue.released_size ,gauge , ,unit , ,The number of jobs in *RELEASED status in a job queue ,0 ,ibm_i ,jobq released , +ibm_i.job_queue.scheduled_size ,gauge , ,unit , ,The number of jobs in *SCHEDULED status in a job queue ,0 ,ibm_i ,jobq scheduled , +ibm_i.job_queue.held_size ,gauge , ,unit , ,The number of jobs in *HELD status in a job queue ,0 ,ibm_i ,jobq held , +ibm_i.message_queue.size ,gauge , ,unit , ,The number of messages in a system message queue ,0 ,ibm_i ,msgq size , +ibm_i.message_queue.critical_size ,gauge , ,unit , ,The number of critical messages in a system message queue ,-1 ,ibm_i ,msgq critical , From 1e1147e53c9b06387a4ea99d98fec8c5f0585e54 Mon Sep 17 00:00:00 2001 From: steveny91 Date: Tue, 5 Dec 2023 12:53:19 -0500 Subject: [PATCH 4/4] fix spacing --- ibm_i/metadata.csv | 56 +++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/ibm_i/metadata.csv b/ibm_i/metadata.csv index 76401b2914aec..3ae6995828c16 100644 --- a/ibm_i/metadata.csv +++ b/ibm_i/metadata.csv @@ -1,28 +1,28 @@ -metric_name ,metric_type ,interval ,unit_name ,per_unit_name ,description ,orientation ,integration ,short_name ,curated_metric -ibm_i.asp.unit_storage_capacity ,gauge , ,byte , ,The storage capacity of the unit ,0 ,ibm_i ,asp capacity , -ibm_i.asp.unit_space_available ,gauge , ,byte , ,The space on the unit available for use ,0 ,ibm_i ,asp available , -ibm_i.asp.percent_used ,gauge , ,percent , ,The percentage consumed from the disk unit ,0 ,ibm_i ,asp percent used , -ibm_i.asp.percent_busy ,gauge , ,percent , ,The percentage of time the disk unit is in use ,0 ,ibm_i ,asp percent busy , -ibm_i.asp.io_requests_per_s ,gauge , ,unit ,second ,The average number of I/O requests for read and write operations that occurred per second ,0 ,ibm_i ,asp io requests , -ibm_i.system.cpu_usage ,gauge , ,percent , ,The average CPU utilization for all the active processors. ,0 ,ibm_i ,cpu usage , -ibm_i.system.configured_cpus ,gauge , ,unit , ,The total number of configured CPUs for the partition. ,0 ,ibm_i ,configured cpus , -ibm_i.system.current_cpu_capacity ,gauge , , , ,The processor units that are being used in the partition. ,0 ,ibm_i ,current cpu capacity , -ibm_i.system.shared_cpu_usage ,gauge , ,percent , ,The percentage of the total shared processor pool capacity used by all partitions using the pool. ,0 ,ibm_i ,shared cpu usage , -ibm_i.system.normalized_cpu_usage ,gauge , ,percent , ,The normalized percentage of CPU utilization for processing units in use. ,0 ,ibm_i ,normalized cpu usage , -ibm_i.job.status ,gauge , , , ,Whether a job is currently active or not. ,0 ,ibm_i ,job status , -ibm_i.job.jobq_duration ,gauge , ,second , ,The amount of time a job has been in the JOBQ status ,-1 ,ibm_i ,job jobq duration , -ibm_i.job.active_duration ,gauge , ,second , ,The amount of time a job has been active ,1 ,ibm_i ,job active duration , -ibm_i.job.cpu_usage ,gauge , , , ,The CPU usage by a job ,0 ,ibm_i ,job cpu , -ibm_i.job.cpu_usage.pct ,gauge , ,percent , ,The CPU usage by a job as a percentage ,0 ,ibm_i ,job cpu , -ibm_i.job.temp_storage ,gauge , ,mebibyte , ,The amount of temporary storage that is currently allocated to a job ,0 ,ibm_i ,job storage , -ibm_i.pool.size ,gauge , ,mebibyte , ,The amount of main storage in a pool ,0 ,ibm_i ,pool size , -ibm_i.pool.reserved_size ,gauge , ,mebibyte , ,The amount of storage in a pool reserved for system use ,0 ,ibm_i ,pool reserved , -ibm_i.pool.defined_size ,gauge , ,mebibyte , ,"The size of a pool as defined in the shared pool, subsystem description, or system value QMCHPOOL" ,0 ,ibm_i ,pool defined , -ibm_i.subsystem.active ,gauge , , , ,Whether a subsystem is currently active ,0 ,ibm_i ,subsys active , -ibm_i.subsystem.active_jobs ,gauge , ,unit , ,The number of jobs currently active in a subsystem ,0 ,ibm_i ,subsys jobs , -ibm_i.job_queue.size ,gauge , ,unit , ,The number of jobs in a job queue ,0 ,ibm_i ,jobq size , -ibm_i.job_queue.released_size ,gauge , ,unit , ,The number of jobs in *RELEASED status in a job queue ,0 ,ibm_i ,jobq released , -ibm_i.job_queue.scheduled_size ,gauge , ,unit , ,The number of jobs in *SCHEDULED status in a job queue ,0 ,ibm_i ,jobq scheduled , -ibm_i.job_queue.held_size ,gauge , ,unit , ,The number of jobs in *HELD status in a job queue ,0 ,ibm_i ,jobq held , -ibm_i.message_queue.size ,gauge , ,unit , ,The number of messages in a system message queue ,0 ,ibm_i ,msgq size , -ibm_i.message_queue.critical_size ,gauge , ,unit , ,The number of critical messages in a system message queue ,-1 ,ibm_i ,msgq critical , +metric_name,metric_type,interval,unit_name,per_unit_name,description,orientation,integration,short_name,curated_metric +ibm_i.asp.unit_storage_capacity,gauge,,byte,,The storage capacity of the unit,0,ibm_i,asp capacity, +ibm_i.asp.unit_space_available,gauge,,byte,,The space on the unit available for use,0,ibm_i,asp available, +ibm_i.asp.percent_used,gauge,,percent,,The percentage consumed from the disk unit,0,ibm_i,asp percent used, +ibm_i.asp.percent_busy,gauge,,percent,,The percentage of time the disk unit is in use,0,ibm_i,asp percent busy, +ibm_i.asp.io_requests_per_s,gauge,,unit,second,The average number of I/O requests for read and write operations that occurred per second,0,ibm_i,asp io requests, +ibm_i.system.cpu_usage,gauge,,percent,,The average CPU utilization for all the active processors.,0,ibm_i,cpu usage, +ibm_i.system.configured_cpus,gauge,,unit,,The total number of configured CPUs for the partition.,0,ibm_i,configured cpus, +ibm_i.system.current_cpu_capacity,gauge,,,,The processor units that are being used in the partition.,0,ibm_i,current cpu capacity, +ibm_i.system.shared_cpu_usage,gauge,,percent,,The percentage of the total shared processor pool capacity used by all partitions using the pool.,0,ibm_i,shared cpu usage, +ibm_i.system.normalized_cpu_usage,gauge,,percent,,The normalized percentage of CPU utilization for processing units in use.,0,ibm_i,normalized cpu usage, +ibm_i.job.status,gauge,,,,Whether a job is currently active or not.,0,ibm_i,job status, +ibm_i.job.jobq_duration,gauge,,second,,The amount of time a job has been in the JOBQ status,-1,ibm_i,job jobq duration, +ibm_i.job.active_duration,gauge,,second,,The amount of time a job has been active,1,ibm_i,job active duration, +ibm_i.job.cpu_usage,gauge,,,,The CPU usage by a job,0,ibm_i,job cpu, +ibm_i.job.cpu_usage.pct,gauge,,percent,,The CPU usage by a job as a percentage,0,ibm_i,job cpu, +ibm_i.job.temp_storage,gauge,,mebibyte,,The amount of temporary storage that is currently allocated to a job,0,ibm_i,job storage, +ibm_i.pool.size,gauge,,mebibyte,,The amount of main storage in a pool,0,ibm_i,pool size, +ibm_i.pool.reserved_size,gauge,,mebibyte,,The amount of storage in a pool reserved for system use,0,ibm_i,pool reserved, +ibm_i.pool.defined_size,gauge,,mebibyte,,"The size of a pool as defined in the shared pool, subsystem description, or system value QMCHPOOL",0,ibm_i,pool defined, +ibm_i.subsystem.active,gauge,,,,Whether a subsystem is currently active,0,ibm_i,subsys active, +ibm_i.subsystem.active_jobs,gauge,,unit,,The number of jobs currently active in a subsystem,0,ibm_i,subsys jobs, +ibm_i.job_queue.size,gauge,,unit,,The number of jobs in a job queue,0,ibm_i,jobq size, +ibm_i.job_queue.released_size,gauge,,unit,,The number of jobs in *RELEASED status in a job queue,0,ibm_i,jobq released, +ibm_i.job_queue.scheduled_size,gauge,,unit,,The number of jobs in *SCHEDULED status in a job queue,0,ibm_i,jobq scheduled, +ibm_i.job_queue.held_size,gauge,,unit,,The number of jobs in *HELD status in a job queue,0,ibm_i,jobq held, +ibm_i.message_queue.size,gauge,,unit,,The number of messages in a system message queue,0,ibm_i,msgq size, +ibm_i.message_queue.critical_size,gauge,,unit,,The number of critical messages in a system message queue,-1,ibm_i,msgq critical,