diff options
Diffstat (limited to 'plugins/check_procs.c')
-rw-r--r-- | plugins/check_procs.c | 62 |
1 files changed, 30 insertions, 32 deletions
diff --git a/plugins/check_procs.c b/plugins/check_procs.c index 1fcbd98..1d78cce 100644 --- a/plugins/check_procs.c +++ b/plugins/check_procs.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * Monitoring check_procs plugin | 3 | * Monitoring check_procs plugin |
4 | * | 4 | * |
5 | * License: GPL | 5 | * License: GPL |
6 | * Copyright (c) 2000-2008 Monitoring Plugins Development Team | 6 | * Copyright (c) 2000-2024 Monitoring Plugins Development Team |
7 | * | 7 | * |
8 | * Description: | 8 | * Description: |
9 | * | 9 | * |
@@ -36,7 +36,7 @@ | |||
36 | 36 | ||
37 | const char *progname = "check_procs"; | 37 | const char *progname = "check_procs"; |
38 | const char *program_name = "check_procs"; /* Required for coreutils libs */ | 38 | const char *program_name = "check_procs"; /* Required for coreutils libs */ |
39 | const char *copyright = "2000-2008"; | 39 | const char *copyright = "2000-2024"; |
40 | const char *email = "devel@monitoring-plugins.org"; | 40 | const char *email = "devel@monitoring-plugins.org"; |
41 | 41 | ||
42 | #include "common.h" | 42 | #include "common.h" |
@@ -51,17 +51,17 @@ const char *email = "devel@monitoring-plugins.org"; | |||
51 | #include <sys/stat.h> | 51 | #include <sys/stat.h> |
52 | #endif | 52 | #endif |
53 | 53 | ||
54 | int process_arguments (int, char **); | 54 | static int process_arguments (int /*argc*/, char ** /*argv*/); |
55 | int validate_arguments (void); | 55 | static int validate_arguments (void); |
56 | int convert_to_seconds (char *); | 56 | static int convert_to_seconds (char * /*etime*/); |
57 | void print_help (void); | 57 | static void print_help (void); |
58 | void print_usage (void); | 58 | void print_usage (void); |
59 | 59 | ||
60 | char *warning_range = NULL; | 60 | static char *warning_range = NULL; |
61 | char *critical_range = NULL; | 61 | static char *critical_range = NULL; |
62 | thresholds *procs_thresholds = NULL; | 62 | static thresholds *procs_thresholds = NULL; |
63 | 63 | ||
64 | int options = 0; /* bitmask of filter criteria to test against */ | 64 | static int options = 0; /* bitmask of filter criteria to test against */ |
65 | #define ALL 1 | 65 | #define ALL 1 |
66 | #define STAT 2 | 66 | #define STAT 2 |
67 | #define PPID 4 | 67 | #define PPID 4 |
@@ -89,27 +89,25 @@ enum metric { | |||
89 | }; | 89 | }; |
90 | enum metric metric = METRIC_PROCS; | 90 | enum metric metric = METRIC_PROCS; |
91 | 91 | ||
92 | int verbose = 0; | 92 | static int verbose = 0; |
93 | int uid; | 93 | static int uid; |
94 | pid_t ppid; | 94 | static pid_t ppid; |
95 | int vsz; | 95 | static int vsz; |
96 | int rss; | 96 | static int rss; |
97 | float pcpu; | 97 | static float pcpu; |
98 | char *statopts; | 98 | static char *statopts; |
99 | char *prog; | 99 | static char *prog; |
100 | char *exclude_progs; | 100 | static char *exclude_progs; |
101 | char **exclude_progs_arr = NULL; | 101 | static char **exclude_progs_arr = NULL; |
102 | char exclude_progs_counter = 0; | 102 | static char exclude_progs_counter = 0; |
103 | char *args; | 103 | static char *args; |
104 | char *input_filename = NULL; | 104 | static char *input_filename = NULL; |
105 | regex_t re_args; | 105 | static regex_t re_args; |
106 | char *fmt; | 106 | static char *fmt; |
107 | char *fails; | 107 | static char *fails; |
108 | char tmp[MAX_INPUT_BUFFER]; | 108 | static char tmp[MAX_INPUT_BUFFER]; |
109 | int kthread_filter = 0; | 109 | static int kthread_filter = 0; |
110 | int usepid = 0; /* whether to test for pid or /proc/pid/exe */ | 110 | static int usepid = 0; /* whether to test for pid or /proc/pid/exe */ |
111 | |||
112 | FILE *ps_input = NULL; | ||
113 | 111 | ||
114 | static int | 112 | static int |
115 | stat_exe (const pid_t pid, struct stat *buf) { | 113 | stat_exe (const pid_t pid, struct stat *buf) { |
@@ -834,7 +832,7 @@ be the total number of running processes\n\n")); | |||
834 | printf (" %s\n", "check_procs -w 50000 -c 100000 --metric=VSZ"); | 832 | printf (" %s\n", "check_procs -w 50000 -c 100000 --metric=VSZ"); |
835 | printf (" %s\n\n", _("Alert if VSZ of any processes over 50K or 100K")); | 833 | printf (" %s\n\n", _("Alert if VSZ of any processes over 50K or 100K")); |
836 | printf (" %s\n", "check_procs -w 10 -c 20 --metric=CPU"); | 834 | printf (" %s\n", "check_procs -w 10 -c 20 --metric=CPU"); |
837 | printf (" %s\n", _("Alert if CPU of any processes over 10\% or 20\%")); | 835 | printf (" %s\n", _("Alert if CPU of any processes over 10%% or 20%%")); |
838 | 836 | ||
839 | printf (UT_SUPPORT); | 837 | printf (UT_SUPPORT); |
840 | } | 838 | } |