diff options
author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-08-11 21:54:05 +0200 |
---|---|---|
committer | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-08-11 21:54:05 +0200 |
commit | 7382fa90f84d38cd2ae08c880e9ed6a4ad644d35 (patch) | |
tree | e367f424cfb94bd6730e196916a96a9725e61c27 /plugins/check_procs.d | |
parent | fb39f96ac6f72bb56d17f3e8694134dfea9186e9 (diff) | |
parent | 1dfb5a0c10881b43cb60cf93bab63648c61201b5 (diff) | |
download | monitoring-plugins-7382fa90f84d38cd2ae08c880e9ed6a4ad644d35.tar.gz |
Merge branch 'master' into refactor/check_users
Diffstat (limited to 'plugins/check_procs.d')
-rw-r--r-- | plugins/check_procs.d/config.h | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/plugins/check_procs.d/config.h b/plugins/check_procs.d/config.h new file mode 100644 index 00000000..e32ca066 --- /dev/null +++ b/plugins/check_procs.d/config.h | |||
@@ -0,0 +1,75 @@ | |||
1 | #pragma once | ||
2 | |||
3 | #include "../../config.h" | ||
4 | #include "regex.h" | ||
5 | #include "thresholds.h" | ||
6 | #include <stddef.h> | ||
7 | #include <string.h> | ||
8 | #include <sys/types.h> | ||
9 | |||
10 | enum metric { | ||
11 | METRIC_PROCS, | ||
12 | METRIC_VSZ, | ||
13 | METRIC_RSS, | ||
14 | METRIC_CPU, | ||
15 | METRIC_ELAPSED | ||
16 | }; | ||
17 | |||
18 | typedef struct { | ||
19 | int options; /* bitmask of filter criteria to test against */ | ||
20 | enum metric metric; | ||
21 | char *metric_name; | ||
22 | char *input_filename; | ||
23 | char *prog; | ||
24 | char *args; | ||
25 | char *fmt; | ||
26 | char *fails; | ||
27 | char *exclude_progs; | ||
28 | char **exclude_progs_arr; | ||
29 | char exclude_progs_counter; | ||
30 | regex_t re_args; | ||
31 | |||
32 | bool kthread_filter; | ||
33 | bool usepid; /* whether to test for pid or /proc/pid/exe */ | ||
34 | uid_t uid; | ||
35 | pid_t ppid; | ||
36 | int vsz; | ||
37 | int rss; | ||
38 | float pcpu; | ||
39 | char *statopts; | ||
40 | |||
41 | char *warning_range; | ||
42 | char *critical_range; | ||
43 | thresholds *procs_thresholds; | ||
44 | } check_procs_config; | ||
45 | |||
46 | check_procs_config check_procs_config_init() { | ||
47 | check_procs_config tmp = { | ||
48 | .options = 0, | ||
49 | .metric = METRIC_PROCS, | ||
50 | .metric_name = strdup("PROCS"), | ||
51 | .input_filename = NULL, | ||
52 | .prog = NULL, | ||
53 | .args = NULL, | ||
54 | .fmt = NULL, | ||
55 | .fails = NULL, | ||
56 | .exclude_progs = NULL, | ||
57 | .exclude_progs_arr = NULL, | ||
58 | .exclude_progs_counter = 0, | ||
59 | .re_args = {0}, | ||
60 | |||
61 | .kthread_filter = false, | ||
62 | .usepid = false, | ||
63 | .uid = 0, | ||
64 | .ppid = 0, | ||
65 | .vsz = 0, | ||
66 | .rss = 0, | ||
67 | .pcpu = 0, | ||
68 | .statopts = NULL, | ||
69 | |||
70 | .warning_range = NULL, | ||
71 | .critical_range = NULL, | ||
72 | .procs_thresholds = NULL, | ||
73 | }; | ||
74 | return tmp; | ||
75 | } | ||