diff options
author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-07-06 21:58:55 +0200 |
---|---|---|
committer | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-07-06 21:58:55 +0200 |
commit | b002a6870b6ef9333d3234cec58b8c2fc1acfeec (patch) | |
tree | 99e3aaa2d9522ab03eaf6cc5f3f777f9e19a720a /plugins/check_load.c | |
parent | 4ef8af0d9a2acb2e199b613af2d85af86fed24b2 (diff) | |
download | monitoring-plugins-b002a6870b6ef9333d3234cec58b8c2fc1acfeec.tar.gz |
check_load: Add top x functionality to output
Diffstat (limited to 'plugins/check_load.c')
-rw-r--r-- | plugins/check_load.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/plugins/check_load.c b/plugins/check_load.c index f7e80fdb..78daa945 100644 --- a/plugins/check_load.c +++ b/plugins/check_load.c | |||
@@ -245,13 +245,15 @@ int main(int argc, char **argv) { | |||
245 | mp_subcheck top_proc_sc = mp_subcheck_init(); | 245 | mp_subcheck top_proc_sc = mp_subcheck_init(); |
246 | top_proc_sc = mp_set_subcheck_state(top_proc_sc, STATE_OK); | 246 | top_proc_sc = mp_set_subcheck_state(top_proc_sc, STATE_OK); |
247 | top_processes_result top_proc = print_top_consuming_processes(config.n_procs_to_show); | 247 | top_processes_result top_proc = print_top_consuming_processes(config.n_procs_to_show); |
248 | top_proc_sc.output = ""; | 248 | xasprintf(&top_proc_sc.output, "Top %lu CPU time consuming processes", config.n_procs_to_show); |
249 | 249 | ||
250 | if (top_proc.errorcode == OK) { | 250 | if (top_proc.errorcode == OK) { |
251 | for (int i = 0; i < config.n_procs_to_show; i++) { | 251 | for (int i = 0; i < config.n_procs_to_show; i++) { |
252 | xasprintf(&top_proc_sc.output, "%s\n%s", top_proc_sc.output, top_proc.top_processes[i]); | 252 | xasprintf(&top_proc_sc.output, "%s\n%s", top_proc_sc.output, top_proc.top_processes[i]); |
253 | } | 253 | } |
254 | } | 254 | } |
255 | |||
256 | mp_add_subcheck_to_check(&overall, top_proc_sc); | ||
255 | } | 257 | } |
256 | 258 | ||
257 | mp_exit(overall); | 259 | mp_exit(overall); |