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 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'}, ], } diff --git a/ibm_i/metadata.csv b/ibm_i/metadata.csv index bed8b3f3cf616..3ae6995828c16 100644 --- a/ibm_i/metadata.csv +++ b/ibm_i/metadata.csv @@ -13,6 +13,7 @@ ibm_i.job.status,gauge,,,,Whether a job is currently active or not.,0,ibm_i,job 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,