diff options
Diffstat (limited to 'plugins/check_load.c')
-rw-r--r-- | plugins/check_load.c | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/plugins/check_load.c b/plugins/check_load.c index b6cfc656..5d5c115c 100644 --- a/plugins/check_load.c +++ b/plugins/check_load.c @@ -55,9 +55,7 @@ void print_help (void); void print_usage (void); static int print_top_consuming_processes(); -static int n_procs_to_show = 5; -static int print_top_procs_on_warning = 0; -static int print_top_procs_on_critical = 0; +static int n_procs_to_show = 0; /* strictly for pretty-print usage in loops */ static const int nums[3] = { 1, 5, 15 }; @@ -216,9 +214,7 @@ main (int argc, char **argv) printf("load%d=%.3f;%.3f;%.3f;0; ", nums[i], la[i], wload[i], cload[i]); putchar('\n'); - if (result == STATE_CRITICAL && print_top_procs_on_critical) { - print_top_consuming_processes(); - } else if (result == STATE_WARNING && print_top_procs_on_warning) { + if (n_procs_to_show > 0) { print_top_consuming_processes(); } return result; @@ -238,8 +234,6 @@ process_arguments (int argc, char **argv) {"percpu", no_argument, 0, 'r'}, {"version", no_argument, 0, 'V'}, {"help", no_argument, 0, 'h'}, - {"print-top-warning", no_argument, 0, 'W'}, - {"print-top-critical", no_argument, 0, 'C'}, {"procs-to-show", required_argument, 0, 'n'}, {0, 0, 0, 0} }; @@ -248,7 +242,7 @@ process_arguments (int argc, char **argv) return ERROR; while (1) { - c = getopt_long (argc, argv, "Vhrc:w:WCn:", longopts, &option); + c = getopt_long (argc, argv, "Vhrc:w:n:", longopts, &option); if (c == -1 || c == EOF) break; @@ -272,12 +266,6 @@ process_arguments (int argc, char **argv) case 'n': n_procs_to_show = atoi(optarg); break; - case 'W': - print_top_procs_on_warning = 1; - break; - case 'C': - print_top_procs_on_critical = 1; - break; case '?': /* help */ usage5 (); } @@ -347,13 +335,9 @@ print_help (void) printf (" %s\n", _("the load average format is the same used by \"uptime\" and \"w\"")); printf (" %s\n", "-r, --percpu"); printf (" %s\n", _("Divide the load averages by the number of CPUs (when possible)")); - printf (" %s\n", "-W, --print-top-warning"); - printf (" %s\n", _("Print top consuming processes on WARNING status")); - printf (" %s\n", "-C, --print-top-critical"); - printf (" %s\n", _("Print top consuming processes on CRITICAL status")); printf (" %s\n", "-n, --procs-to-show=NUMBER_OF_PROCS"); - printf (" %s\n", _("Number of processes to show when printing top consuming")); - printf (" %s\n", _("processes. Not useful without -W or -C. Default value is 5")); + printf (" %s\n", _("Number of processes to show when printing the top consuming processes.")); + printf (" %s\n", _("NUMBER_OF_PROCS=0 disables this feature. Default value is 0")); printf (UT_SUPPORT); } @@ -362,7 +346,7 @@ void print_usage (void) { printf ("%s\n", _("Usage:")); - printf ("%s [-r] -w WLOAD1,WLOAD5,WLOAD15 -c CLOAD1,CLOAD5,CLOAD15 [-W] [-C] [-n NUMBER_OF_PROCS]\n", progname); + printf ("%s [-r] -w WLOAD1,WLOAD5,WLOAD15 -c CLOAD1,CLOAD5,CLOAD15 [-n NUMBER_OF_PROCS]\n", progname); } static int print_top_consuming_processes() { |