summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Hartge <sven@svenhartge.de>2023-12-04 13:33:36 (GMT)
committerSven Hartge <sven@svenhartge.de>2023-12-04 13:33:36 (GMT)
commit45f633ef23bdee70845fda685f3821af11c2aa1b (patch)
treeab5df10eaa60cc99b2ff65dd2945e40ef711d2c1
parentc43d2e9959c1f2d594801bc5d61db7c96126978f (diff)
downloadmonitoring-plugins-45f633ef23bdee70845fda685f3821af11c2aa1b.tar.gz
check_procs: Improve help text, mentioning excluded processes
Also reindent the code, converting stray tabs to 2 spaces.
-rw-r--r--plugins/check_procs.c37
1 files changed, 23 insertions, 14 deletions
diff --git a/plugins/check_procs.c b/plugins/check_procs.c
index 3c98866..010497c 100644
--- a/plugins/check_procs.c
+++ b/plugins/check_procs.c
@@ -14,6 +14,10 @@
14* defaults to number of processes. Search filters can be applied to limit 14* defaults to number of processes. Search filters can be applied to limit
15* the processes to check. 15* the processes to check.
16* 16*
17* The parent process (usually nrpe), check_procs itself and any child
18* process of check_procs (ps) are excluded from any checks to prevent
19* false positives.
20*
17* 21*
18* This program is free software: you can redistribute it and/or modify 22* This program is free software: you can redistribute it and/or modify
19* it under the terms of the GNU General Public License as published by 23* it under the terms of the GNU General Public License as published by
@@ -735,18 +739,23 @@ convert_to_seconds(char *etime) {
735void 739void
736print_help (void) 740print_help (void)
737{ 741{
738 print_revision (progname, NP_VERSION); 742 print_revision (progname, NP_VERSION);
739 743
740 printf ("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n"); 744 printf ("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n");
741 printf (COPYRIGHT, copyright, email); 745 printf (COPYRIGHT, copyright, email);
742 746
743 printf ("%s\n", _("Checks all processes and generates WARNING or CRITICAL states if the specified")); 747 printf ("%s\n", _("Checks all processes and generates WARNING or CRITICAL states if the specified"));
744 printf ("%s\n", _("metric is outside the required threshold ranges. The metric defaults to number")); 748 printf ("%s\n", _("metric is outside the required threshold ranges. The metric defaults to number"));
745 printf ("%s\n", _("of processes. Search filters can be applied to limit the processes to check.")); 749 printf ("%s\n", _("of processes. Search filters can be applied to limit the processes to check."));
746 750
747 printf ("\n\n"); 751 printf ("\n\n");
748 752
749 print_usage (); 753 printf ("%s\n", _("The parent process (usually nrpe), check_procs itself and any child process of"));
754 printf ("%s\n", _("check_procs (ps) are excluded from any checks to prevent false positives."));
755
756 printf ("\n\n");
757
758 print_usage ();
750 759
751 printf (UT_HELP_VRSN); 760 printf (UT_HELP_VRSN);
752 printf (UT_EXTRA_OPTS); 761 printf (UT_EXTRA_OPTS);
@@ -762,11 +771,11 @@ print_help (void)
762 printf (" %s\n", _("CPU - percentage CPU")); 771 printf (" %s\n", _("CPU - percentage CPU"));
763/* only linux etime is support currently */ 772/* only linux etime is support currently */
764#if defined( __linux__ ) 773#if defined( __linux__ )
765 printf (" %s\n", _("ELAPSED - time elapsed in seconds")); 774 printf (" %s\n", _("ELAPSED - time elapsed in seconds"));
766#endif /* defined(__linux__) */ 775#endif /* defined(__linux__) */
767 printf (UT_PLUG_TIMEOUT, DEFAULT_SOCKET_TIMEOUT); 776 printf (UT_PLUG_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
768 777
769 printf (" %s\n", "-v, --verbose"); 778 printf (" %s\n", "-v, --verbose");
770 printf (" %s\n", _("Extra information. Up to 3 verbosity levels")); 779 printf (" %s\n", _("Extra information. Up to 3 verbosity levels"));
771 780
772 printf (" %s\n", "-T, --traditional"); 781 printf (" %s\n", "-T, --traditional");
@@ -784,7 +793,7 @@ print_help (void)
784 printf (" %s\n", _("Only scan for processes with VSZ higher than indicated.")); 793 printf (" %s\n", _("Only scan for processes with VSZ higher than indicated."));
785 printf (" %s\n", "-r, --rss=RSS"); 794 printf (" %s\n", "-r, --rss=RSS");
786 printf (" %s\n", _("Only scan for processes with RSS higher than indicated.")); 795 printf (" %s\n", _("Only scan for processes with RSS higher than indicated."));
787 printf (" %s\n", "-P, --pcpu=PCPU"); 796 printf (" %s\n", "-P, --pcpu=PCPU");
788 printf (" %s\n", _("Only scan for processes with PCPU higher than indicated.")); 797 printf (" %s\n", _("Only scan for processes with PCPU higher than indicated."));
789 printf (" %s\n", "-u, --user=USER"); 798 printf (" %s\n", "-u, --user=USER");
790 printf (" %s\n", _("Only scan for processes with user name or ID indicated.")); 799 printf (" %s\n", _("Only scan for processes with user name or ID indicated."));
@@ -799,19 +808,19 @@ print_help (void)
799 printf (" %s\n", "-k, --no-kthreads"); 808 printf (" %s\n", "-k, --no-kthreads");
800 printf (" %s\n", _("Only scan for non kernel threads (works on Linux only).")); 809 printf (" %s\n", _("Only scan for non kernel threads (works on Linux only)."));
801 810
802 printf(_("\n\ 811 printf(_("\n\
803RANGEs are specified 'min:max' or 'min:' or ':max' (or 'max'). If\n\ 812RANGEs are specified 'min:max' or 'min:' or ':max' (or 'max'). If\n\
804specified 'max:min', a warning status will be generated if the\n\ 813specified 'max:min', a warning status will be generated if the\n\
805count is inside the specified range\n\n")); 814count is inside the specified range\n\n"));
806 815
807 printf(_("\ 816 printf(_("\
808This plugin checks the number of currently running processes and\n\ 817This plugin checks the number of currently running processes and\n\
809generates WARNING or CRITICAL states if the process count is outside\n\ 818generates WARNING or CRITICAL states if the process count is outside\n\
810the specified threshold ranges. The process count can be filtered by\n\ 819the specified threshold ranges. The process count can be filtered by\n\
811process owner, parent process PID, current state (e.g., 'Z'), or may\n\ 820process owner, parent process PID, current state (e.g., 'Z'), or may\n\
812be the total number of running processes\n\n")); 821be the total number of running processes\n\n"));
813 822
814 printf ("%s\n", _("Examples:")); 823 printf ("%s\n", _("Examples:"));
815 printf (" %s\n", "check_procs -w 2:2 -c 2:1024 -C portsentry"); 824 printf (" %s\n", "check_procs -w 2:2 -c 2:1024 -C portsentry");
816 printf (" %s\n", _("Warning if not two processes with command name portsentry.")); 825 printf (" %s\n", _("Warning if not two processes with command name portsentry."));
817 printf (" %s\n\n", _("Critical if < 2 or > 1024 processes")); 826 printf (" %s\n\n", _("Critical if < 2 or > 1024 processes"));
@@ -828,14 +837,14 @@ be the total number of running processes\n\n"));
828 printf (" %s\n", "check_procs -w 10 -c 20 --metric=CPU"); 837 printf (" %s\n", "check_procs -w 10 -c 20 --metric=CPU");
829 printf (" %s\n", _("Alert if CPU of any processes over 10\% or 20\%")); 838 printf (" %s\n", _("Alert if CPU of any processes over 10\% or 20\%"));
830 839
831 printf (UT_SUPPORT); 840 printf (UT_SUPPORT);
832} 841}
833 842
834void 843void
835print_usage (void) 844print_usage (void)
836{ 845{
837 printf ("%s\n", _("Usage:")); 846 printf ("%s\n", _("Usage:"));
838 printf ("%s -w <range> -c <range> [-m metric] [-s state] [-p ppid]\n", progname); 847 printf ("%s -w <range> -c <range> [-m metric] [-s state] [-p ppid]\n", progname);
839 printf (" [-u user] [-r rss] [-z vsz] [-P %%cpu] [-a argument-array]\n"); 848 printf (" [-u user] [-r rss] [-z vsz] [-P %%cpu] [-a argument-array]\n");
840 printf (" [-C command] [-X process_to_exclude] [-k] [-t timeout] [-v]\n"); 849 printf (" [-C command] [-X process_to_exclude] [-k] [-t timeout] [-v]\n");
841} 850}