diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_procs.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/plugins/check_procs.c b/plugins/check_procs.c index a868fcf9..d4792107 100644 --- a/plugins/check_procs.c +++ b/plugins/check_procs.c | |||
@@ -202,12 +202,14 @@ main (int argc, char **argv) | |||
202 | if (metric != METRIC_PROCS) { | 202 | if (metric != METRIC_PROCS) { |
203 | if (i == STATE_WARNING) { | 203 | if (i == STATE_WARNING) { |
204 | warn++; | 204 | warn++; |
205 | asprintf (&fails, "%s%s%s", fails, (strcmp(fails,"") ? ", " : ""), procprog); | ||
206 | result = max_state (result, i); | ||
205 | } | 207 | } |
206 | if (i == STATE_CRITICAL) { | 208 | if (i == STATE_CRITICAL) { |
207 | crit++; | 209 | crit++; |
210 | asprintf (&fails, "%s%s%s", fails, (strcmp(fails,"") ? ", " : ""), procprog); | ||
211 | result = max_state (result, i); | ||
208 | } | 212 | } |
209 | asprintf (&fails, "%s%s%s", fails, (strcmp(fails,"") ? ", " : ""), procprog); | ||
210 | result = max_state (result, i); | ||
211 | } | 213 | } |
212 | } | 214 | } |
213 | /* This should not happen */ | 215 | /* This should not happen */ |
@@ -341,7 +343,7 @@ process_arguments (int argc, char **argv) | |||
341 | else | 343 | else |
342 | usage (_("Critical Process Count must be an integer!\n\n")); | 344 | usage (_("Critical Process Count must be an integer!\n\n")); |
343 | break; | 345 | break; |
344 | case 'w': /* warning time threshold */ | 346 | case 'w': /* warning threshold */ |
345 | if (is_integer (optarg)) | 347 | if (is_integer (optarg)) |
346 | wmax = atoi (optarg); | 348 | wmax = atoi (optarg); |
347 | else if (sscanf (optarg, ":%d", &wmax) == 1) | 349 | else if (sscanf (optarg, ":%d", &wmax) == 1) |
@@ -351,7 +353,7 @@ process_arguments (int argc, char **argv) | |||
351 | else if (sscanf (optarg, "%d:", &wmin) == 1) | 353 | else if (sscanf (optarg, "%d:", &wmin) == 1) |
352 | break; | 354 | break; |
353 | else | 355 | else |
354 | usage (_("%s: Warning Process Count must be an integer!\n\n")); | 356 | usage (_("Warning Process Count must be an integer!\n\n")); |
355 | break; | 357 | break; |
356 | case 'p': /* process id */ | 358 | case 'p': /* process id */ |
357 | if (sscanf (optarg, "%d%[^0-9]", &ppid, tmp) == 1) { | 359 | if (sscanf (optarg, "%d%[^0-9]", &ppid, tmp) == 1) { |
@@ -655,7 +657,9 @@ Examples:\n\ | |||
655 | Warning alert if > 10 processes with command arguments containing \n\ | 657 | Warning alert if > 10 processes with command arguments containing \n\ |
656 | '/usr/local/bin/perl' and owned by root\n\n\ | 658 | '/usr/local/bin/perl' and owned by root\n\n\ |
657 | check_procs -w 50000 -c 100000 --metric=VSZ\n\ | 659 | check_procs -w 50000 -c 100000 --metric=VSZ\n\ |
658 | Alert if vsz of any processes over 50K or 100K\n\n")); | 660 | Alert if vsz of any processes over 50K or 100K\n\ |
661 | check_procs -w 10 -c 20 --metric=CPU\n\ | ||
662 | Alert if cpu of any processes over 10% or 20%\n\n")); | ||
659 | 663 | ||
660 | printf (_(UT_SUPPORT)); | 664 | printf (_(UT_SUPPORT)); |
661 | } | 665 | } |