summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/test-next.yml78
-rw-r--r--.github/workflows/test.yml1
-rw-r--r--plugins/check_curl.c2
-rw-r--r--plugins/check_disk.c83
-rw-r--r--plugins/check_mysql.c8
-rw-r--r--plugins/check_snmp.c168
6 files changed, 200 insertions, 140 deletions
diff --git a/.github/workflows/test-next.yml b/.github/workflows/test-next.yml
new file mode 100644
index 00000000..81240759
--- /dev/null
+++ b/.github/workflows/test-next.yml
@@ -0,0 +1,78 @@
1---
2name: Tests Debian:Testing and Fedora:Rawhide
3
4on:
5 workflow_dispatch: {}
6 push:
7 branches-ignore:
8 - '*'
9 schedule:
10 # Run every week on Monday at 9:00 AM (UTC)
11 - cron: '0 9 * * 1'
12
13jobs:
14 full-test:
15 name: Running unit and integrationt tests
16 runs-on: ubuntu-latest
17 strategy:
18 fail-fast: false
19 matrix:
20 distro:
21 - 'debian:testing'
22 include:
23 - distro: 'debian:testing'
24 prepare: .github/prepare_debian.sh
25 steps:
26 - name: Git clone repository
27 uses: actions/checkout@v4
28 - name: Run the tests on ${{ matrix.distro }}
29 run: |
30 docker volume create --driver local --opt type=tmpfs --opt device=tmpfs --opt o=size=100m,uid=1000 tmp-vol
31 docker run \
32 -e NPTEST_ACCEPTDEFAULT=1 \
33 -e NPTEST_CACHE="/src/.github/NPTest.cache" \
34 -w /src -v ${PWD}:/src \
35 --tmpfs /media/ramdisk1 \
36 -v /var/run/utmp:/var/run/utmp \
37 --mount source=tmp-vol,destination=/src,target=/media/ramdisk2 \
38 ${{ matrix.distro }} \
39 /bin/sh -c '${{ matrix.prepare }} && \
40 tools/setup && \
41 ./configure --enable-libtap --with-ipv6=no && \
42 make && \
43 make test && \
44 make dist && \
45 tar zxf monitoring-plugins-*.tar.gz && \
46 cd monitoring-plugins-*/ && \
47 ./configure && \
48 make'
49 docker container prune -f
50 docker volume prune -f
51
52 build-test:
53 name: Running rpm build test on ${{ matrix.distro }}
54 runs-on: ubuntu-latest
55 strategy:
56 fail-fast: false
57 matrix:
58 include:
59 - {"distro": "fedora:rawhide", "build": ".github/mock.sh"}
60 steps:
61 - name: Git clone repository
62 uses: actions/checkout@v4
63 - name: Run the tests on ${{ matrix.distro }}
64 run: |
65 docker volume create --driver local --opt type=tmpfs --opt device=tmpfs --opt o=size=100m,uid=1000 tmp-vol
66 docker run \
67 --privileged=true \
68 -e NPTEST_ACCEPTDEFAULT=1 \
69 -e NPTEST_CACHE="/src/.github/NPTest.cache" \
70 -w /src -v ${PWD}:/src \
71 --tmpfs /media/ramdisk1 \
72 -v /var/run/utmp:/var/run/utmp \
73 --mount source=tmp-vol,destination=/src,target=/media/ramdisk2 \
74 ${{ matrix.distro }} \
75 /bin/sh -c '${{ matrix.build }} && \
76 ls -la'
77 docker container prune -f
78 docker volume prune -f
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 33220d6d..77ca6585 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -54,7 +54,6 @@ jobs:
54 matrix: 54 matrix:
55 include: 55 include:
56 - {"distro": "fedora:latest", "build": ".github/mock.sh"} 56 - {"distro": "fedora:latest", "build": ".github/mock.sh"}
57 - {"distro": "fedora:rawhide", "build": ".github/mock.sh"}
58 - {"distro": "rockylinux:8", "build": ".github/mock.sh"} 57 - {"distro": "rockylinux:8", "build": ".github/mock.sh"}
59 - {"distro": "almalinux:9", "build": ".github/mock.sh"} 58 - {"distro": "almalinux:9", "build": ".github/mock.sh"}
60# - {"distro": "oraclelinux:9", "build": ".github/mock.sh"} 59# - {"distro": "oraclelinux:9", "build": ".github/mock.sh"}
diff --git a/plugins/check_curl.c b/plugins/check_curl.c
index 214ba74f..7f45b5a7 100644
--- a/plugins/check_curl.c
+++ b/plugins/check_curl.c
@@ -2190,8 +2190,6 @@ print_usage (void)
2190 printf ("%s\n", _("In the first form, make an HTTP request.")); 2190 printf ("%s\n", _("In the first form, make an HTTP request."));
2191 printf ("%s\n\n", _("In the second form, connect to the server and check the TLS certificate.")); 2191 printf ("%s\n\n", _("In the second form, connect to the server and check the TLS certificate."));
2192#endif 2192#endif
2193 printf ("%s\n", _("WARNING: check_curl is experimental. Please use"));
2194 printf ("%s\n\n", _("check_http if you need a stable version."));
2195} 2193}
2196 2194
2197void 2195void
diff --git a/plugins/check_disk.c b/plugins/check_disk.c
index 24de2d45..b3dd301c 100644
--- a/plugins/check_disk.c
+++ b/plugins/check_disk.c
@@ -119,44 +119,41 @@ enum
119#pragma alloca 119#pragma alloca
120#endif 120#endif
121 121
122int process_arguments (int, char **); 122static int process_arguments (int, char **);
123void print_path (const char *mypath); 123static void set_all_thresholds (struct parameter_list *path);
124void set_all_thresholds (struct parameter_list *path); 124static void print_help (void);
125int validate_arguments (uintmax_t, uintmax_t, double, double, double, double, char *);
126void print_help (void);
127void print_usage (void); 125void print_usage (void);
128double calculate_percent(uintmax_t, uintmax_t); 126static double calculate_percent(uintmax_t, uintmax_t);
129bool stat_path (struct parameter_list *p); 127static bool stat_path (struct parameter_list *p);
130void get_stats (struct parameter_list *p, struct fs_usage *fsp); 128static void get_stats (struct parameter_list *p, struct fs_usage *fsp);
131void get_path_stats (struct parameter_list *p, struct fs_usage *fsp); 129static void get_path_stats (struct parameter_list *p, struct fs_usage *fsp);
132 130
133char *exclude_device; 131static char *units;
134char *units; 132static uintmax_t mult = 1024 * 1024;
135uintmax_t mult = 1024 * 1024; 133static int verbose = 0;
136int verbose = 0; 134static bool erronly = false;
137bool erronly = false; 135static bool display_mntp = false;
138bool display_mntp = false; 136static bool exact_match = false;
139bool exact_match = false; 137static bool ignore_missing = false;
140bool ignore_missing = false; 138static bool freespace_ignore_reserved = false;
141bool freespace_ignore_reserved = false; 139static bool display_inodes_perfdata = false;
142bool display_inodes_perfdata = false; 140static char *warn_freespace_units = NULL;
143char *warn_freespace_units = NULL; 141static char *crit_freespace_units = NULL;
144char *crit_freespace_units = NULL; 142static char *warn_freespace_percent = NULL;
145char *warn_freespace_percent = NULL; 143static char *crit_freespace_percent = NULL;
146char *crit_freespace_percent = NULL; 144static char *warn_usedspace_units = NULL;
147char *warn_usedspace_units = NULL; 145static char *crit_usedspace_units = NULL;
148char *crit_usedspace_units = NULL; 146static char *warn_usedspace_percent = NULL;
149char *warn_usedspace_percent = NULL; 147static char *crit_usedspace_percent = NULL;
150char *crit_usedspace_percent = NULL; 148static char *warn_usedinodes_percent = NULL;
151char *warn_usedinodes_percent = NULL; 149static char *crit_usedinodes_percent = NULL;
152char *crit_usedinodes_percent = NULL; 150static char *warn_freeinodes_percent = NULL;
153char *warn_freeinodes_percent = NULL; 151static char *crit_freeinodes_percent = NULL;
154char *crit_freeinodes_percent = NULL; 152static bool path_selected = false;
155bool path_selected = false; 153static bool path_ignored = false;
156bool path_ignored = false; 154static char *group = NULL;
157char *group = NULL; 155static struct stat *stat_buf;
158struct stat *stat_buf; 156static struct name_list *seen = NULL;
159struct name_list *seen = NULL;
160 157
161 158
162int 159int
@@ -899,18 +896,6 @@ process_arguments (int argc, char **argv)
899 return true; 896 return true;
900} 897}
901 898
902
903
904void
905print_path (const char *mypath)
906{
907 if (mypath == NULL)
908 printf ("\n");
909 else
910 printf (_(" for %s\n"), mypath);
911}
912
913
914void 899void
915set_all_thresholds (struct parameter_list *path) 900set_all_thresholds (struct parameter_list *path)
916{ 901{
diff --git a/plugins/check_mysql.c b/plugins/check_mysql.c
index 6a7daf11..15ec04c0 100644
--- a/plugins/check_mysql.c
+++ b/plugins/check_mysql.c
@@ -59,8 +59,8 @@ bool ssl = false;
59char *opt_file = NULL; 59char *opt_file = NULL;
60char *opt_group = NULL; 60char *opt_group = NULL;
61unsigned int db_port = MYSQL_PORT; 61unsigned int db_port = MYSQL_PORT;
62int check_slave = 0, warn_sec = 0, crit_sec = 0; 62bool check_slave = false;
63int ignore_auth = 0; 63bool ignore_auth = false;
64int verbose = 0; 64int verbose = 0;
65 65
66static double warning_time = 0; 66static double warning_time = 0;
@@ -456,10 +456,10 @@ process_arguments (int argc, char **argv)
456 db_port = atoi (optarg); 456 db_port = atoi (optarg);
457 break; 457 break;
458 case 'S': 458 case 'S':
459 check_slave = 1; /* check-slave */ 459 check_slave = true; /* check-slave */
460 break; 460 break;
461 case 'n': 461 case 'n':
462 ignore_auth = 1; /* ignore-auth */ 462 ignore_auth = true; /* ignore-auth */
463 break; 463 break;
464 case 'w': 464 case 'w':
465 warning = optarg; 465 warning = optarg;
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index 295aa9b5..90a04027 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -55,8 +55,6 @@ const char *email = "devel@monitoring-plugins.org";
55#define CRIT_STRING 2 55#define CRIT_STRING 2
56#define CRIT_REGEX 4 56#define CRIT_REGEX 4
57#define WARN_PRESENT 8 57#define WARN_PRESENT 8
58#define WARN_STRING 16
59#define WARN_REGEX 32
60 58
61#define OID_COUNT_STEP 8 59#define OID_COUNT_STEP 8
62 60
@@ -86,82 +84,82 @@ const char *email = "devel@monitoring-plugins.org";
86 84
87 85
88 86
89int process_arguments (int, char **); 87static int process_arguments (int, char **);
90int validate_arguments (void); 88static int validate_arguments (void);
91char *thisarg (char *str); 89static char *thisarg (char *str);
92char *nextarg (char *str); 90static char *nextarg (char *str);
93void print_usage (void); 91void print_usage (void);
94void print_help (void); 92static void print_help (void);
95char *multiply (char *str); 93static char *multiply (char *str);
96 94
97#include "regex.h" 95#include "regex.h"
98char regex_expect[MAX_INPUT_BUFFER] = ""; 96static char regex_expect[MAX_INPUT_BUFFER] = "";
99regex_t preg; 97static regex_t preg;
100regmatch_t pmatch[10]; 98static regmatch_t pmatch[10];
101char errbuf[MAX_INPUT_BUFFER] = ""; 99static char errbuf[MAX_INPUT_BUFFER] = "";
102char perfstr[MAX_INPUT_BUFFER] = "| "; 100static char perfstr[MAX_INPUT_BUFFER] = "| ";
103int cflags = REG_EXTENDED | REG_NOSUB | REG_NEWLINE; 101static int cflags = REG_EXTENDED | REG_NOSUB | REG_NEWLINE;
104int eflags = 0; 102static int eflags = 0;
105int errcode, excode; 103static int errcode, excode;
106 104
107char *server_address = NULL; 105static char *server_address = NULL;
108char *community = NULL; 106static char *community = NULL;
109char **contextargs = NULL; 107static char **contextargs = NULL;
110char *context = NULL; 108static char *context = NULL;
111char **authpriv = NULL; 109static char **authpriv = NULL;
112char *proto = NULL; 110static char *proto = NULL;
113char *seclevel = NULL; 111static char *seclevel = NULL;
114char *secname = NULL; 112static char *secname = NULL;
115char *authproto = NULL; 113static char *authproto = NULL;
116char *privproto = NULL; 114static char *privproto = NULL;
117char *authpasswd = NULL; 115static char *authpasswd = NULL;
118char *privpasswd = NULL; 116static char *privpasswd = NULL;
119int nulloid = STATE_UNKNOWN; 117static int nulloid = STATE_UNKNOWN;
120char **oids = NULL; 118static char **oids = NULL;
121size_t oids_size = 0; 119static size_t oids_size = 0;
122char *label; 120static char *label;
123char *units; 121static char *units;
124char *port; 122static char *port;
125char *snmpcmd; 123static char *snmpcmd;
126char string_value[MAX_INPUT_BUFFER] = ""; 124static char string_value[MAX_INPUT_BUFFER] = "";
127int invert_search=0; 125static int invert_search=0;
128char **labels = NULL; 126static char **labels = NULL;
129char **unitv = NULL; 127static char **unitv = NULL;
130size_t nlabels = 0; 128static size_t nlabels = 0;
131size_t labels_size = OID_COUNT_STEP; 129static size_t labels_size = OID_COUNT_STEP;
132size_t nunits = 0; 130static size_t nunits = 0;
133size_t unitv_size = OID_COUNT_STEP; 131static size_t unitv_size = OID_COUNT_STEP;
134size_t numoids = 0; 132static size_t numoids = 0;
135int numauthpriv = 0; 133static int numauthpriv = 0;
136int numcontext = 0; 134static int numcontext = 0;
137int verbose = 0; 135static int verbose = 0;
138bool usesnmpgetnext = false; 136static bool usesnmpgetnext = false;
139char *warning_thresholds = NULL; 137static char *warning_thresholds = NULL;
140char *critical_thresholds = NULL; 138static char *critical_thresholds = NULL;
141thresholds **thlds; 139static thresholds **thlds;
142size_t thlds_size = OID_COUNT_STEP; 140static size_t thlds_size = OID_COUNT_STEP;
143double *response_value; 141static double *response_value;
144size_t response_size = OID_COUNT_STEP; 142static size_t response_size = OID_COUNT_STEP;
145int retries = 0; 143static int retries = 0;
146int *eval_method; 144static int *eval_method;
147size_t eval_size = OID_COUNT_STEP; 145static size_t eval_size = OID_COUNT_STEP;
148char *delimiter; 146static char *delimiter;
149char *output_delim; 147static char *output_delim;
150char *miblist = NULL; 148static char *miblist = NULL;
151bool needmibs = false; 149static bool needmibs = false;
152int calculate_rate = 0; 150static int calculate_rate = 0;
153double offset = 0.0; 151static double offset = 0.0;
154int rate_multiplier = 1; 152static int rate_multiplier = 1;
155state_data *previous_state; 153static state_data *previous_state;
156double *previous_value; 154static double *previous_value;
157size_t previous_size = OID_COUNT_STEP; 155static size_t previous_size = OID_COUNT_STEP;
158int perf_labels = 1; 156static int perf_labels = 1;
159char* ip_version = ""; 157static char* ip_version = "";
160double multiplier = 1.0; 158static double multiplier = 1.0;
161char *fmtstr = ""; 159static char *fmtstr = "";
162bool fmtstr_set = false; 160static bool fmtstr_set = false;
163char buffer[DEFAULT_BUFFER_SIZE]; 161static char buffer[DEFAULT_BUFFER_SIZE];
164bool ignore_mib_parsing_errors = false; 162static bool ignore_mib_parsing_errors = false;
165 163
166static char *fix_snmp_range(char *th) 164static char *fix_snmp_range(char *th)
167{ 165{
@@ -1030,7 +1028,7 @@ selected.</para>
1030 1028
1031 1029
1032 1030
1033int 1031static int
1034validate_arguments () 1032validate_arguments ()
1035{ 1033{
1036 /* check whether to load locally installed MIBS (CPU/disk intensive) */ 1034 /* check whether to load locally installed MIBS (CPU/disk intensive) */
@@ -1139,7 +1137,7 @@ validate_arguments ()
1139/* trim leading whitespace 1137/* trim leading whitespace
1140 if there is a leading quote, make sure it balances */ 1138 if there is a leading quote, make sure it balances */
1141 1139
1142char * 1140static char *
1143thisarg (char *str) 1141thisarg (char *str)
1144{ 1142{
1145 str += strspn (str, " \t\r\n"); /* trim any leading whitespace */ 1143 str += strspn (str, " \t\r\n"); /* trim any leading whitespace */
@@ -1156,7 +1154,7 @@ thisarg (char *str)
1156 set the trailing quote to '\x0' 1154 set the trailing quote to '\x0'
1157 if the string continues, advance beyond the comma */ 1155 if the string continues, advance beyond the comma */
1158 1156
1159char * 1157static char *
1160nextarg (char *str) 1158nextarg (char *str)
1161{ 1159{
1162 if (str[0] == '\'') { 1160 if (str[0] == '\'') {
@@ -1188,7 +1186,7 @@ nextarg (char *str)
1188 1186
1189 1187
1190/* multiply result (values 0 < n < 1 work as divider) */ 1188/* multiply result (values 0 < n < 1 work as divider) */
1191char * 1189static char *
1192multiply (char *str) 1190multiply (char *str)
1193{ 1191{
1194 char *endptr; 1192 char *endptr;
@@ -1225,7 +1223,7 @@ multiply (char *str)
1225} 1223}
1226 1224
1227 1225
1228void 1226static void
1229print_help (void) 1227print_help (void)
1230{ 1228{
1231 print_revision (progname, NP_VERSION); 1229 print_revision (progname, NP_VERSION);
@@ -1253,10 +1251,12 @@ print_help (void)
1253 printf (" %s\n", _("SNMPv3 context")); 1251 printf (" %s\n", _("SNMPv3 context"));
1254 printf (" %s\n", "-L, --seclevel=[noAuthNoPriv|authNoPriv|authPriv]"); 1252 printf (" %s\n", "-L, --seclevel=[noAuthNoPriv|authNoPriv|authPriv]");
1255 printf (" %s\n", _("SNMPv3 securityLevel")); 1253 printf (" %s\n", _("SNMPv3 securityLevel"));
1256 printf (" %s\n", "-a, --authproto=[MD5|SHA]"); 1254 printf (" %s\n", "-a, --authproto=AUTHENTICATION_PROTOCOL");
1257 printf (" %s\n", _("SNMPv3 auth proto")); 1255 printf (" %s\n", _("SNMPv3 authentication protocol (default MD5), available options depend on the specific version of the net-snmp tools"));
1258 printf (" %s\n", "-x, --privproto=[DES|AES]"); 1256 printf (" %s\n", _("if < 5.8 SHA (1) and MD5 should be available, if >= 5.8 additionally SHA-224, SHA-256, SHA-384 and SHA-512"));
1259 printf (" %s\n", _("SNMPv3 priv proto (default DES)")); 1257 printf (" %s\n", "-x, --privproto=PRIVACY_PROTOCOL");
1258 printf (" %s\n", _("SNMPv3 privacy protocol (default DES), available options depend on the specific version of the net-snmp tools"));
1259 printf (" %s\n", _("if < 5.8 DES and AES should be available, if >= 5.8 additionally AES-192 and AES-256"));
1260 1260
1261 /* Authentication Tokens*/ 1261 /* Authentication Tokens*/
1262 printf (" %s\n", "-C, --community=STRING"); 1262 printf (" %s\n", "-C, --community=STRING");