summaryrefslogtreecommitdiffstats
path: root/plugins/check_load.c
diff options
context:
space:
mode:
authorLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2026-06-08 08:23:44 +0200
committerGitHub <noreply@github.com>2026-06-08 08:23:44 +0200
commit9bbc76483888c9e2ef2f4ed281c0ab8f2aab7bb6 (patch)
treec9f72dda47e082e9e2ce74377035b48c77415064 /plugins/check_load.c
parent992a4555ac975285f959dd2d3228b1d71ab23123 (diff)
downloadmonitoring-plugins-9bbc76483888c9e2ef2f4ed281c0ab8f2aab7bb6.tar.gz
Ok summary (#2270)
* lib: implement functionality to set ok summary * check_load: implement setting ok summary * OK summary for ntp_peer, ntp_time and users * check_apt: implement ok summary * check_curl: implement ok summary * check_disk: implement ok summary * check_dbi: implement ok summary * check_ldap: auto formatting * check_ldap: implement ok summary * check_ssh: implement ok summary * check_tcp: implement ok summary * fixup! check_curl: implement ok summary * fixup! check_dbi: implement ok summary * fixup! check_ldap: implement ok summary * fixup! check_ssh: implement ok summary * fixup! check_tcp: implement ok summary * check_apt: remove illegal free * check_mrtg: fix link * check_mrtg: implement ok summary * check_mrtgtraf: fix link * check_mrtgtraf: implement ok summary * check_mysql: implement ok summary * check_mysql_query: implement ok summary * check_pgsql: implement ok summary * check_radius: implement ok summary * check_real: implement ok summary * check_smtp: implement ok summary * check_snmp: implement ok summary * check_swap: implement ok summary * check_ups: add OK summary --------- Co-authored-by: Lorenz Kästle <lorenz.kaestle@netways.de>
Diffstat (limited to 'plugins/check_load.c')
-rw-r--r--plugins/check_load.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/plugins/check_load.c b/plugins/check_load.c
index 7995408e..66d6a4b7 100644
--- a/plugins/check_load.c
+++ b/plugins/check_load.c
@@ -145,6 +145,12 @@ int main(int argc, char **argv) {
145 mp_set_format(config.output_format); 145 mp_set_format(config.output_format);
146 } 146 }
147 147
148 char *ok_summary = NULL;
149 xasprintf(&ok_summary, "Load: 1m: %f - 5m: %f - 15m: %f", load_values[0], load_values[1],
150 load_values[2]);
151 mp_set_ok_summary(&overall, ok_summary);
152 free(ok_summary);
153
148 bool is_using_scaled_load_values = false; 154 bool is_using_scaled_load_values = false;
149 long numcpus; 155 long numcpus;
150 if (config.take_into_account_cpus && ((numcpus = GET_NUMBER_OF_CPUS()) > 0)) { 156 if (config.take_into_account_cpus && ((numcpus = GET_NUMBER_OF_CPUS()) > 0)) {
@@ -156,6 +162,11 @@ int main(int argc, char **argv) {
156 load_values[2] / numcpus, 162 load_values[2] / numcpus,
157 }; 163 };
158 164
165 xasprintf(&ok_summary, "Scaled Load (%ld CPUs): 1m: %f - 5m: %f - 15m: %f", numcpus,
166 load_values[0], load_values[1], load_values[2]);
167 mp_set_ok_summary(&overall, ok_summary);
168 free(ok_summary);
169
159 mp_subcheck scaled_load_sc = mp_subcheck_init(); 170 mp_subcheck scaled_load_sc = mp_subcheck_init();
160 scaled_load_sc = mp_set_subcheck_default_state(scaled_load_sc, STATE_OK); 171 scaled_load_sc = mp_set_subcheck_default_state(scaled_load_sc, STATE_OK);
161 scaled_load_sc.output = "Scaled Load (divided by number of CPUs)"; 172 scaled_load_sc.output = "Scaled Load (divided by number of CPUs)";
@@ -254,7 +265,7 @@ int main(int argc, char **argv) {
254 265
255 if (top_proc.errorcode == OK) { 266 if (top_proc.errorcode == OK) {
256 // +1 here since the string list contains the header line 267 // +1 here since the string list contains the header line
257 for (unsigned long i = 0; i < config.n_procs_to_show +1; i++) { 268 for (unsigned long i = 0; i < config.n_procs_to_show + 1; i++) {
258 xasprintf(&top_proc_sc.output, "%s\n%s", top_proc_sc.output, 269 xasprintf(&top_proc_sc.output, "%s\n%s", top_proc_sc.output,
259 top_proc.top_processes[i]); 270 top_proc.top_processes[i]);
260 } 271 }