Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add cpu pct metric retrieve from query #16332

Merged
merged 4 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ibm_i/changelog.d/16332.added
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add `cpu_usage.pct` metric from `ELAPSED_CPU_PERCENTAGE` retrieved from query
2 changes: 2 additions & 0 deletions ibm_i/datadog_checks/ibm_i/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'},
],
}
Expand Down
1 change: 1 addition & 0 deletions ibm_i/metadata.csv
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading