summaryrefslogtreecommitdiffstats
path: root/plugins/check_procs.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_procs.c')
-rw-r--r--plugins/check_procs.c62
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
37const char *progname = "check_procs"; 37const char *progname = "check_procs";
38const char *program_name = "check_procs"; /* Required for coreutils libs */ 38const char *program_name = "check_procs"; /* Required for coreutils libs */
39const char *copyright = "2000-2008"; 39const char *copyright = "2000-2024";
40const char *email = "devel@monitoring-plugins.org"; 40const 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
54int process_arguments (int, char **); 54static int process_arguments (int /*argc*/, char ** /*argv*/);
55int validate_arguments (void); 55static int validate_arguments (void);
56int convert_to_seconds (char *); 56static int convert_to_seconds (char * /*etime*/);
57void print_help (void); 57static void print_help (void);
58void print_usage (void); 58void print_usage (void);
59 59
60char *warning_range = NULL; 60static char *warning_range = NULL;
61char *critical_range = NULL; 61static char *critical_range = NULL;
62thresholds *procs_thresholds = NULL; 62static thresholds *procs_thresholds = NULL;
63 63
64int options = 0; /* bitmask of filter criteria to test against */ 64static 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};
90enum metric metric = METRIC_PROCS; 90enum metric metric = METRIC_PROCS;
91 91
92int verbose = 0; 92static int verbose = 0;
93int uid; 93static int uid;
94pid_t ppid; 94static pid_t ppid;
95int vsz; 95static int vsz;
96int rss; 96static int rss;
97float pcpu; 97static float pcpu;
98char *statopts; 98static char *statopts;
99char *prog; 99static char *prog;
100char *exclude_progs; 100static char *exclude_progs;
101char **exclude_progs_arr = NULL; 101static char **exclude_progs_arr = NULL;
102char exclude_progs_counter = 0; 102static char exclude_progs_counter = 0;
103char *args; 103static char *args;
104char *input_filename = NULL; 104static char *input_filename = NULL;
105regex_t re_args; 105static regex_t re_args;
106char *fmt; 106static char *fmt;
107char *fails; 107static char *fails;
108char tmp[MAX_INPUT_BUFFER]; 108static char tmp[MAX_INPUT_BUFFER];
109int kthread_filter = 0; 109static int kthread_filter = 0;
110int usepid = 0; /* whether to test for pid or /proc/pid/exe */ 110static int usepid = 0; /* whether to test for pid or /proc/pid/exe */
111
112FILE *ps_input = NULL;
113 111
114static int 112static int
115stat_exe (const pid_t pid, struct stat *buf) { 113stat_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}