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