From 3929c5ac37a5b6c6ae0430c40438da087da07e1a Mon Sep 17 00:00:00 2001 From: Gerardo Malazdrewicz <36243997+GerMalaz@users.noreply.github.com> Date: Sun, 31 Oct 2021 09:37:55 -0300 Subject: check_mysql.c: Detect running mysqldump When checking a slave, if the IO Thread or the SQL Thread are stopped, check for running mysqldump threads, return STATE_OK if there is any. Requires PROCESS privilege to work (else the mysqldump thread(s) would not be detected). Enlarged SLAVERESULTSIZE to fit "Mysqldump: in progress" at the end of the string. Got a NULL pointer in row[seconds_behind_field] instead of the "NULL" string when a mysqldump is running [mysql 5.7.34 + libmariadb3 10.3.31], so added a check for that. --- plugins/check_mysql.c | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) (limited to 'plugins') diff --git a/plugins/check_mysql.c b/plugins/check_mysql.c index 0cba50e6..5b9a4fec 100644 --- a/plugins/check_mysql.c +++ b/plugins/check_mysql.c @@ -34,7 +34,7 @@ const char *progname = "check_mysql"; const char *copyright = "1999-2011"; const char *email = "devel@monitoring-plugins.org"; -#define SLAVERESULTSIZE 70 +#define SLAVERESULTSIZE 96 #include "common.h" #include "utils.h" @@ -89,6 +89,8 @@ static const char *metric_counter[LENGTH_METRIC_COUNTER] = { "Uptime" }; +#define MYSQLDUMP_THREADS_QUERY "SELECT COUNT(1) mysqldumpThreads FROM information_schema.processlist WHERE info LIKE 'SELECT /*!40001 SQL_NO_CACHE */%'" + thresholds *my_threshold = NULL; int process_arguments (int, char **); @@ -275,11 +277,29 @@ main (int argc, char **argv) /* Save slave status in slaveresult */ snprintf (slaveresult, SLAVERESULTSIZE, "Slave IO: %s Slave SQL: %s Seconds Behind Master: %s", row[slave_io_field], row[slave_sql_field], seconds_behind_field!=-1?row[seconds_behind_field]:"Unknown"); - /* Raise critical error if SQL THREAD or IO THREAD are stopped */ + /* Raise critical error if SQL THREAD or IO THREAD are stopped, but only if there are no mysqldump threads running */ if (strcmp (row[slave_io_field], "Yes") != 0 || strcmp (row[slave_sql_field], "Yes") != 0) { - mysql_free_result (res); - mysql_close (&mysql); - die (STATE_CRITICAL, "%s\n", slaveresult); + MYSQL_RES *res_mysqldump; + MYSQL_ROW row_mysqldump; + unsigned int mysqldump_threads = 0; + + if (mysql_query (&mysql, MYSQLDUMP_THREADS_QUERY) == 0) { + /* store the result */ + if ( (res_mysqldump = mysql_store_result (&mysql)) != NULL) { + if (mysql_num_rows(res_mysqldump) == 1) { + if ( (row_mysqldump = mysql_fetch_row (res_mysqldump)) != NULL) { + mysqldump_threads = atoi(row_mysqldump[0]); + } + } + /* free the result */ + mysql_free_result (res_mysqldump); + } + } + if (mysqldump_threads == 0) { + die (STATE_CRITICAL, "%s\n", slaveresult); + } else { + strlcat (slaveresult, " Mysqldump: in progress", SLAVERESULTSIZE); + } } if (verbose >=3) { @@ -291,7 +311,7 @@ main (int argc, char **argv) } /* Check Seconds Behind against threshold */ - if ((seconds_behind_field != -1) && (strcmp (row[seconds_behind_field], "NULL") != 0)) { + if ((seconds_behind_field != -1) && (row[seconds_behind_field] != NULL && strcmp (row[seconds_behind_field], "NULL") != 0)) { double value = atof(row[seconds_behind_field]); int status; -- cgit v1.2.3-74-g34f1 From 8700f497160cfc2cce8918c8cd8922b7320c510a Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Sun, 12 Mar 2023 20:44:42 +0100 Subject: Replace deprecated TLS client functions --- plugins/sslutils.c | 77 +++++++++++++++++++++++------------------------------- 1 file changed, 33 insertions(+), 44 deletions(-) (limited to 'plugins') diff --git a/plugins/sslutils.c b/plugins/sslutils.c index 666a0120..6bc0ba81 100644 --- a/plugins/sslutils.c +++ b/plugins/sslutils.c @@ -31,9 +31,8 @@ #include "netutils.h" #ifdef HAVE_SSL -static SSL_CTX *c=NULL; +static SSL_CTX *ctx=NULL; static SSL *s=NULL; -static int initialized=0; int np_net_ssl_init(int sd) { return np_net_ssl_init_with_hostname(sd, NULL); @@ -48,24 +47,24 @@ int np_net_ssl_init_with_hostname_and_version(int sd, char *host_name, int versi } int np_net_ssl_init_with_hostname_version_and_cert(int sd, char *host_name, int version, char *cert, char *privkey) { - const SSL_METHOD *method = NULL; long options = 0; + if ((ctx = SSL_CTX_new(TLS_client_method())) == NULL) { + printf("%s\n", _("CRITICAL - Cannot create SSL context.")); + return STATE_CRITICAL; + } + switch (version) { case MP_SSLv2: /* SSLv2 protocol */ -#if defined(USE_GNUTLS) || defined(OPENSSL_NO_SSL2) printf("%s\n", _("UNKNOWN - SSL protocol version 2 is not supported by your SSL library.")); return STATE_UNKNOWN; -#else - method = SSLv2_client_method(); - break; -#endif case MP_SSLv3: /* SSLv3 protocol */ #if defined(OPENSSL_NO_SSL3) printf("%s\n", _("UNKNOWN - SSL protocol version 3 is not supported by your SSL library.")); return STATE_UNKNOWN; #else - method = SSLv3_client_method(); + SSL_CTX_set_min_proto_version(ctx, SSL3_VERSION); + SSL_CTX_set_max_proto_version(ctx, SSL3_VERSION); break; #endif case MP_TLSv1: /* TLSv1 protocol */ @@ -73,7 +72,8 @@ int np_net_ssl_init_with_hostname_version_and_cert(int sd, char *host_name, int printf("%s\n", _("UNKNOWN - TLS protocol version 1 is not supported by your SSL library.")); return STATE_UNKNOWN; #else - method = TLSv1_client_method(); + SSL_CTX_set_min_proto_version(ctx, TLS1_VERSION); + SSL_CTX_set_max_proto_version(ctx, TLS1_VERSION); break; #endif case MP_TLSv1_1: /* TLSv1.1 protocol */ @@ -81,7 +81,8 @@ int np_net_ssl_init_with_hostname_version_and_cert(int sd, char *host_name, int printf("%s\n", _("UNKNOWN - TLS protocol version 1.1 is not supported by your SSL library.")); return STATE_UNKNOWN; #else - method = TLSv1_1_client_method(); + SSL_CTX_set_min_proto_version(ctx, TLS1_1_VERSION); + SSL_CTX_set_max_proto_version(ctx, TLS1_1_VERSION); break; #endif case MP_TLSv1_2: /* TLSv1.2 protocol */ @@ -89,7 +90,8 @@ int np_net_ssl_init_with_hostname_version_and_cert(int sd, char *host_name, int printf("%s\n", _("UNKNOWN - TLS protocol version 1.2 is not supported by your SSL library.")); return STATE_UNKNOWN; #else - method = TLSv1_2_client_method(); + SSL_CTX_set_min_proto_version(ctx, TLS1_2_VERSION); + SSL_CTX_set_max_proto_version(ctx, TLS1_2_VERSION); break; #endif case MP_TLSv1_2_OR_NEWER: @@ -97,56 +99,43 @@ int np_net_ssl_init_with_hostname_version_and_cert(int sd, char *host_name, int printf("%s\n", _("UNKNOWN - Disabling TLSv1.1 is not supported by your SSL library.")); return STATE_UNKNOWN; #else - options |= SSL_OP_NO_TLSv1_1; + SSL_CTX_set_min_proto_version(ctx, TLS1_2_VERSION); + break; #endif - /* FALLTHROUGH */ case MP_TLSv1_1_OR_NEWER: #if !defined(SSL_OP_NO_TLSv1) printf("%s\n", _("UNKNOWN - Disabling TLSv1 is not supported by your SSL library.")); return STATE_UNKNOWN; #else - options |= SSL_OP_NO_TLSv1; + SSL_CTX_set_min_proto_version(ctx, TLS1_1_VERSION); + break; #endif - /* FALLTHROUGH */ case MP_TLSv1_OR_NEWER: #if defined(SSL_OP_NO_SSLv3) - options |= SSL_OP_NO_SSLv3; + SSL_CTX_set_min_proto_version(ctx, TLS1_VERSION); + break; #endif - /* FALLTHROUGH */ case MP_SSLv3_OR_NEWER: #if defined(SSL_OP_NO_SSLv2) - options |= SSL_OP_NO_SSLv2; + SSL_CTX_set_min_proto_version(ctx, SSL3_VERSION); + break; #endif - case MP_SSLv2_OR_NEWER: - /* FALLTHROUGH */ - default: /* Default to auto negotiation */ - method = SSLv23_client_method(); - } - if (!initialized) { - /* Initialize SSL context */ - SSLeay_add_ssl_algorithms(); - SSL_load_error_strings(); - OpenSSL_add_all_algorithms(); - initialized = 1; - } - if ((c = SSL_CTX_new(method)) == NULL) { - printf("%s\n", _("CRITICAL - Cannot create SSL context.")); - return STATE_CRITICAL; } + if (cert && privkey) { #ifdef USE_OPENSSL - if (!SSL_CTX_use_certificate_chain_file(c, cert)) { + if (!SSL_CTX_use_certificate_chain_file(ctx, cert)) { #elif USE_GNUTLS - if (!SSL_CTX_use_certificate_file(c, cert, SSL_FILETYPE_PEM)) { + if (!SSL_CTX_use_certificate_file(ctx, cert, SSL_FILETYPE_PEM)) { #else #error Unported for unknown SSL library #endif printf ("%s\n", _("CRITICAL - Unable to open certificate chain file!\n")); return STATE_CRITICAL; } - SSL_CTX_use_PrivateKey_file(c, privkey, SSL_FILETYPE_PEM); + SSL_CTX_use_PrivateKey_file(ctx, privkey, SSL_FILETYPE_PEM); #ifdef USE_OPENSSL - if (!SSL_CTX_check_private_key(c)) { + if (!SSL_CTX_check_private_key(ctx)) { printf ("%s\n", _("CRITICAL - Private key does not seem to match certificate!\n")); return STATE_CRITICAL; } @@ -155,9 +144,9 @@ int np_net_ssl_init_with_hostname_version_and_cert(int sd, char *host_name, int #ifdef SSL_OP_NO_TICKET options |= SSL_OP_NO_TICKET; #endif - SSL_CTX_set_options(c, options); - SSL_CTX_set_mode(c, SSL_MODE_AUTO_RETRY); - if ((s = SSL_new(c)) != NULL) { + SSL_CTX_set_options(ctx, options); + SSL_CTX_set_mode(ctx, SSL_MODE_AUTO_RETRY); + if ((s = SSL_new(ctx)) != NULL) { #ifdef SSL_set_tlsext_host_name if (host_name != NULL) SSL_set_tlsext_host_name(s, host_name); @@ -184,9 +173,9 @@ void np_net_ssl_cleanup() { #endif SSL_shutdown(s); SSL_free(s); - if (c) { - SSL_CTX_free(c); - c=NULL; + if (ctx) { + SSL_CTX_free(ctx); + ctx=NULL; } s=NULL; } -- cgit v1.2.3-74-g34f1 From a00c412e7ba1474b32f478daf039d2bdf71f072a Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Sun, 12 Mar 2023 14:59:23 +0100 Subject: Fixes for -Wnonnull-compare --- lib/utils_cmd.c | 4 ---- plugins/runcmd.c | 4 ---- 2 files changed, 8 deletions(-) (limited to 'plugins') diff --git a/lib/utils_cmd.c b/lib/utils_cmd.c index 8b8e5708..34fb3909 100644 --- a/lib/utils_cmd.c +++ b/lib/utils_cmd.c @@ -118,10 +118,6 @@ _cmd_open (char *const *argv, int *pfd, int *pfderr) int i = 0; - /* if no command was passed, return with no error */ - if (argv == NULL) - return -1; - if (!_cmd_pids) CMD_INIT; diff --git a/plugins/runcmd.c b/plugins/runcmd.c index 1bd2ca1f..ff1987fd 100644 --- a/plugins/runcmd.c +++ b/plugins/runcmd.c @@ -114,10 +114,6 @@ np_runcmd_open(const char *cmdstring, int *pfd, int *pfderr) env[0] = strdup("LC_ALL=C"); env[1] = '\0'; - /* if no command was passed, return with no error */ - if (cmdstring == NULL) - return -1; - /* make copy of command string so strtok() doesn't silently modify it */ /* (the calling program may want to access it later) */ cmdlen = strlen(cmdstring); -- cgit v1.2.3-74-g34f1 From 6d341c40ab4d84d5eabfd672de1ffa3c7ecd07be Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Sun, 12 Mar 2023 14:04:25 +0100 Subject: Fixes for Waddress * check_snmp: Fix string comparison --- plugins/check_snmp.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'plugins') diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index c425df3c..425bb7b2 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c @@ -422,7 +422,8 @@ main (int argc, char **argv) } else if (strstr (response, "INTEGER: ")) { show = multiply (strstr (response, "INTEGER: ") + 9); - if (fmtstr != "") { + + if (strcmp(fmtstr, "") != 0) { conv = fmtstr; } } @@ -596,8 +597,9 @@ main (int argc, char **argv) len = sizeof(perfstr)-strlen(perfstr)-1; strncat(perfstr, show, len>ptr-show ? ptr-show : len); - if (type) + if (strcmp(type, "") != 0) { strncat(perfstr, type, sizeof(perfstr)-strlen(perfstr)-1); + } if (warning_thresholds) { strncat(perfstr, ";", sizeof(perfstr)-strlen(perfstr)-1); @@ -1185,7 +1187,7 @@ multiply (char *str) if(verbose>2) printf(" multiply extracted double: %f\n", val); val *= multiplier; - if (fmtstr != "") { + if (strcmp(fmtstr, "") != 0) { conv = fmtstr; } if (val == (int)val) { -- cgit v1.2.3-74-g34f1 From 068c124f361d4c615aed79f6fe607f39040b2e31 Mon Sep 17 00:00:00 2001 From: Lorenz Kästle Date: Tue, 11 Jul 2023 16:39:29 +0200 Subject: Detect if fmtstr was set in edge cases --- plugins/check_snmp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index 425bb7b2..135bbc7c 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c @@ -158,6 +158,7 @@ int perf_labels = 1; char* ip_version = ""; double multiplier = 1.0; char *fmtstr = ""; +bool fmtstr_set = false; char buffer[DEFAULT_BUFFER_SIZE]; static char *fix_snmp_range(char *th) @@ -423,7 +424,7 @@ main (int argc, char **argv) else if (strstr (response, "INTEGER: ")) { show = multiply (strstr (response, "INTEGER: ") + 9); - if (strcmp(fmtstr, "") != 0) { + if (fmtstr_set) { conv = fmtstr; } } @@ -973,6 +974,7 @@ process_arguments (int argc, char **argv) case 'f': if (multiplier != 1.0) { fmtstr=optarg; + fmtstr_set = true; } break; } @@ -1187,7 +1189,7 @@ multiply (char *str) if(verbose>2) printf(" multiply extracted double: %f\n", val); val *= multiplier; - if (strcmp(fmtstr, "") != 0) { + if (fmtstr_set) { conv = fmtstr; } if (val == (int)val) { -- cgit v1.2.3-74-g34f1 From c405dbafccd27259bd860ea408b32f2594e1a384 Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Mon, 18 Sep 2023 19:18:35 +0200 Subject: Add mysql_close to avoid spamming the server logs --- plugins/check_mysql.c | 1 + 1 file changed, 1 insertion(+) (limited to 'plugins') diff --git a/plugins/check_mysql.c b/plugins/check_mysql.c index 5b9a4fec..8dc554f1 100644 --- a/plugins/check_mysql.c +++ b/plugins/check_mysql.c @@ -294,6 +294,7 @@ main (int argc, char **argv) /* free the result */ mysql_free_result (res_mysqldump); } + mysql_close (&mysql); } if (mysqldump_threads == 0) { die (STATE_CRITICAL, "%s\n", slaveresult); -- cgit v1.2.3-74-g34f1 From ce355c80cf6054bfa5e1dcf81f9e2183ef963ee1 Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Mon, 18 Sep 2023 22:58:34 +0200 Subject: Initialize slaveresult to 0 and use strncat instead of bsd strlcat --- plugins/check_mysql.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/check_mysql.c b/plugins/check_mysql.c index 8dc554f1..9b7d13f3 100644 --- a/plugins/check_mysql.c +++ b/plugins/check_mysql.c @@ -110,7 +110,7 @@ main (int argc, char **argv) char *result = NULL; char *error = NULL; - char slaveresult[SLAVERESULTSIZE]; + char slaveresult[SLAVERESULTSIZE] = { 0 }; char* perf; perf = strdup (""); @@ -299,7 +299,7 @@ main (int argc, char **argv) if (mysqldump_threads == 0) { die (STATE_CRITICAL, "%s\n", slaveresult); } else { - strlcat (slaveresult, " Mysqldump: in progress", SLAVERESULTSIZE); + strncat(slaveresult, " Mysqldump: in progress", SLAVERESULTSIZE-1); } } -- cgit v1.2.3-74-g34f1 From 3e8fdf9b35ab750e3fe964ce289bbbdaffb3b800 Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Wed, 20 Sep 2023 18:22:55 +0200 Subject: check_disk: Fix printf format string --- plugins/check_disk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/check_disk.c b/plugins/check_disk.c index 05e55022..6cb4cb2f 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c @@ -1027,7 +1027,7 @@ void print_usage (void) { printf ("%s\n", _("Usage:")); - printf (" %s {-w absolute_limit |-w percentage_limit% | -W inode_percentage_limit } {-c absolute_limit|-c percentage_limit% | -K inode_percentage_limit } {-p path | -x device}\n", progname); + printf (" %s {-w absolute_limit |-w percentage_limit%% | -W inode_percentage_limit } {-c absolute_limit|-c percentage_limit%% | -K inode_percentage_limit } {-p path | -x device}\n", progname); printf ("[-C] [-E] [-e] [-f] [-g group ] [-k] [-l] [-M] [-m] [-R path ] [-r path ]\n"); printf ("[-t timeout] [-u unit] [-v] [-X type] [-N type]\n"); } -- cgit v1.2.3-74-g34f1 From 2f916675b3b0ecb7cdeac045304607265cc57065 Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Wed, 20 Sep 2023 18:23:42 +0200 Subject: check_disk: Mention -A and long options in error message about missing thresholds --- plugins/check_disk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/check_disk.c b/plugins/check_disk.c index 6cb4cb2f..bd641480 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c @@ -798,7 +798,7 @@ process_arguments (int argc, char **argv) crit_freespace_percent || warn_usedspace_units || crit_usedspace_units || warn_usedspace_percent || crit_usedspace_percent || warn_usedinodes_percent || crit_usedinodes_percent || warn_freeinodes_percent || crit_freeinodes_percent )) { - die (STATE_UNKNOWN, "DISK %s: %s", _("UNKNOWN"), _("Must set a threshold value before using -r/-R\n")); + die (STATE_UNKNOWN, "DISK %s: %s", _("UNKNOWN"), _("Must set a threshold value before using -r/-R/-A (--ereg-path/--eregi-path/--all)\n")); } err = regcomp(&re, optarg, cflags); -- cgit v1.2.3-74-g34f1 From b01aa8c43390a4e32197abedc84af20fd8a8faf6 Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Wed, 20 Sep 2023 18:24:08 +0200 Subject: check_disk: More spacing to separate examples --- plugins/check_disk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/check_disk.c b/plugins/check_disk.c index bd641480..35fd4811 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c @@ -1011,10 +1011,10 @@ print_help (void) printf ("\n"); printf ("%s\n", _("Examples:")); printf (" %s\n", "check_disk -w 10% -c 5% -p /tmp -p /var -C -w 100000 -c 50000 -p /"); - printf (" %s\n", _("Checks /tmp and /var at 10% and 5%, and / at 100MB and 50MB")); + printf (" %s\n\n", _("Checks /tmp and /var at 10% and 5%, and / at 100MB and 50MB")); printf (" %s\n", "check_disk -w 100 -c 50 -C -w 1000 -c 500 -g sidDATA -r '^/oracle/SID/data.*$'"); printf (" %s\n", _("Checks all filesystems not matching -r at 100M and 50M. The fs matching the -r regex")); - printf (" %s\n", _("are grouped which means the freespace thresholds are applied to all disks together")); + printf (" %s\n\n", _("are grouped which means the freespace thresholds are applied to all disks together")); printf (" %s\n", "check_disk -w 100 -c 50 -C -w 1000 -c 500 -p /foo -C -w 5% -c 3% -p /bar"); printf (" %s\n", _("Checks /foo for 1000M/500M and /bar for 5/3%. All remaining volumes use 100M/50M")); -- cgit v1.2.3-74-g34f1 From 8faf7afad389b74d6fe67a2ece10e85b9f614a13 Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Thu, 21 Sep 2023 09:00:33 +0200 Subject: check_disk: Add some general usage hints --- plugins/check_disk.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'plugins') diff --git a/plugins/check_disk.c b/plugins/check_disk.c index 35fd4811..b3edc415 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c @@ -1008,6 +1008,14 @@ print_help (void) printf (" %s\n", "-N, --include-type=TYPE"); printf (" %s\n", _("Check only filesystems of indicated type (may be repeated)")); + printf ("\n"); + printf ("%s\n", _("General usage hints:")); + printf (" %s\n", _("- Arguments are positional! \"-w 5 -c 1 -p /foo -w6 -c2 -p /bar\" is not the same as")); + printf (" %s\n", _("\"-w 5 -c 1 -p /bar w6 -c2 -p /foo\".")); + printf (" %s\n", _("- The syntax is broadly: \"{thresholds a} {paths a} {thresholds b} {thresholds b} ...\"")); + + + printf ("\n"); printf ("%s\n", _("Examples:")); printf (" %s\n", "check_disk -w 10% -c 5% -p /tmp -p /var -C -w 100000 -c 50000 -p /"); -- cgit v1.2.3-74-g34f1 From 2ef36843abf3b2ec7142aa2f52b66d5d3c7b543b Mon Sep 17 00:00:00 2001 From: Lorenz Kästle Date: Thu, 21 Sep 2023 09:50:53 +0200 Subject: Add -C to general usage hints --- plugins/check_disk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/check_disk.c b/plugins/check_disk.c index b3edc415..7dc1c4b1 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c @@ -1012,7 +1012,7 @@ print_help (void) printf ("%s\n", _("General usage hints:")); printf (" %s\n", _("- Arguments are positional! \"-w 5 -c 1 -p /foo -w6 -c2 -p /bar\" is not the same as")); printf (" %s\n", _("\"-w 5 -c 1 -p /bar w6 -c2 -p /foo\".")); - printf (" %s\n", _("- The syntax is broadly: \"{thresholds a} {paths a} {thresholds b} {thresholds b} ...\"")); + printf (" %s\n", _("- The syntax is broadly: \"{thresholds a} {paths a} -C {thresholds b} {thresholds b} ...\"")); -- cgit v1.2.3-74-g34f1 From 7fd0e6f36d90a341e0d9b418f1cd64a3a5472a94 Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Sun, 5 Mar 2023 15:37:47 +0100 Subject: Rework maxfd/open_max to avoid unused variables --- lib/Makefile.am | 2 +- lib/utils_cmd.c | 15 +++++++-------- plugins/common.h | 14 -------------- plugins/popen.c | 8 ++++---- plugins/runcmd.c | 6 ++++-- plugins/utils.c | 16 ---------------- plugins/utils.h | 2 -- 7 files changed, 16 insertions(+), 47 deletions(-) (limited to 'plugins') diff --git a/lib/Makefile.am b/lib/Makefile.am index 01d73a64..1a47395d 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -7,7 +7,7 @@ noinst_LIBRARIES = libmonitoringplug.a AM_CPPFLAGS = -DNP_STATE_DIR_PREFIX=\"$(localstatedir)\" \ -I$(srcdir) -I$(top_srcdir)/gl -I$(top_srcdir)/intl -I$(top_srcdir)/plugins -libmonitoringplug_a_SOURCES = utils_base.c utils_disk.c utils_tcp.c utils_cmd.c +libmonitoringplug_a_SOURCES = utils_base.c utils_disk.c utils_tcp.c utils_cmd.c maxfd.c EXTRA_DIST = utils_base.h utils_disk.h utils_tcp.h utils_cmd.h parse_ini.h extra_opts.h if USE_PARSE_INI diff --git a/lib/utils_cmd.c b/lib/utils_cmd.c index 34fb3909..71da9d24 100644 --- a/lib/utils_cmd.c +++ b/lib/utils_cmd.c @@ -43,6 +43,9 @@ #include "utils.h" #include "utils_cmd.h" #include "utils_base.h" + +#include "./maxfd.h" + #include #ifdef HAVE_SYS_WAIT_H @@ -86,13 +89,7 @@ extern void die (int, const char *, ...) void cmd_init (void) { -#ifndef maxfd - if (!maxfd && (maxfd = sysconf (_SC_OPEN_MAX)) < 0) { - /* possibly log or emit a warning here, since there's no - * guarantee that our guess at maxfd will be adequate */ - maxfd = DEFAULT_MAXFD; - } -#endif + long maxfd = open_max(); /* if maxfd is unnaturally high, we force it to a lower value * ( e.g. on SunOS, when ulimit is set to unlimited: 2147483647 this would cause @@ -148,6 +145,7 @@ _cmd_open (char *const *argv, int *pfd, int *pfderr) /* close all descriptors in _cmd_pids[] * This is executed in a separate address space (pure child), * so we don't have to worry about async safety */ + long maxfd = open_max(); for (i = 0; i < maxfd; i++) if (_cmd_pids[i] > 0) close (i); @@ -174,6 +172,7 @@ _cmd_close (int fd) pid_t pid; /* make sure the provided fd was opened */ + long maxfd = open_max(); if (fd < 0 || fd > maxfd || !_cmd_pids || (pid = _cmd_pids[fd]) == 0) return -1; @@ -265,7 +264,6 @@ _cmd_fetch_output (int fd, output * op, int flags) int cmd_run (const char *cmdstring, output * out, output * err, int flags) { - int fd, pfd_out[2], pfd_err[2]; int i = 0, argc; size_t cmdlen; char **argv = NULL; @@ -387,6 +385,7 @@ timeout_alarm_handler (int signo) printf (_("%s - Plugin timed out after %d seconds\n"), state_text(timeout_state), timeout_interval); + long maxfd = open_max(); if(_cmd_pids) for(i = 0; i < maxfd; i++) { if(_cmd_pids[i] != 0) kill(_cmd_pids[i], SIGKILL); } diff --git a/plugins/common.h b/plugins/common.h index 0f08e2f6..6bf4fca4 100644 --- a/plugins/common.h +++ b/plugins/common.h @@ -225,18 +225,4 @@ enum { # define __attribute__(x) /* do nothing */ #endif -/* Try sysconf(_SC_OPEN_MAX) first, as it can be higher than OPEN_MAX. - * If that fails and the macro isn't defined, we fall back to an educated - * guess. There's no guarantee that our guess is adequate and the program - * will die with SIGSEGV if it isn't and the upper boundary is breached. */ -#define DEFAULT_MAXFD 256 /* fallback value if no max open files value is set */ -#define MAXFD_LIMIT 8192 /* upper limit of open files */ -#ifdef _SC_OPEN_MAX -static long maxfd = 0; -#elif defined(OPEN_MAX) -# define maxfd OPEN_MAX -#else /* sysconf macro unavailable, so guess (may be wildly inaccurate) */ -# define maxfd DEFAULT_MAXFD -#endif - #endif /* _COMMON_H_ */ diff --git a/plugins/popen.c b/plugins/popen.c index 723817d5..7703afc8 100644 --- a/plugins/popen.c +++ b/plugins/popen.c @@ -38,8 +38,9 @@ * *****************************************************************************/ -#include "common.h" -#include "utils.h" +#include "./common.h" +#include "./utils.h" +#include "../lib/maxfd.h" /* extern so plugin has pid to kill exec'd process on timeouts */ extern pid_t *childpid; @@ -177,8 +178,7 @@ spopen (const char *cmdstring) } argv[i] = NULL; - if(maxfd == 0) - maxfd = open_max(); + long maxfd = open_max(); if (childpid == NULL) { /* first time through */ if ((childpid = calloc ((size_t)maxfd, sizeof (pid_t))) == NULL) diff --git a/plugins/runcmd.c b/plugins/runcmd.c index 102191e4..98161421 100644 --- a/plugins/runcmd.c +++ b/plugins/runcmd.c @@ -88,8 +88,7 @@ extern void die (int, const char *, ...) * through this api and thus achieve async-safeness throughout the api */ void np_runcmd_init(void) { - if(maxfd == 0) - maxfd = open_max(); + long maxfd = open_max(); if(!np_pids) np_pids = calloc(maxfd, sizeof(pid_t)); } @@ -192,6 +191,7 @@ np_runcmd_open(const char *cmdstring, int *pfd, int *pfderr) /* close all descriptors in np_pids[] * This is executed in a separate address space (pure child), * so we don't have to worry about async safety */ + long maxfd = open_max(); for (i = 0; i < maxfd; i++) if(np_pids[i] > 0) close (i); @@ -219,6 +219,7 @@ np_runcmd_close(int fd) pid_t pid; /* make sure this fd was opened by popen() */ + long maxfd = open_max(); if(fd < 0 || fd > maxfd || !np_pids || (pid = np_pids[fd]) == 0) return -1; @@ -242,6 +243,7 @@ runcmd_timeout_alarm_handler (int signo) if (signo == SIGALRM) puts(_("CRITICAL - Plugin timed out while executing system call")); + long maxfd = open_max(); if(np_pids) for(i = 0; i < maxfd; i++) { if(np_pids[i] != 0) kill(np_pids[i], SIGKILL); } diff --git a/plugins/utils.c b/plugins/utils.c index b4214c61..71c0bdd8 100644 --- a/plugins/utils.c +++ b/plugins/utils.c @@ -804,19 +804,3 @@ char *sperfdata_int (const char *label, return data; } - -int -open_max (void) -{ - errno = 0; - if (maxfd > 0) - return(maxfd); - - if ((maxfd = sysconf (_SC_OPEN_MAX)) < 0) { - if (errno == 0) - maxfd = DEFAULT_MAXFD; /* it's indeterminate */ - else - die (STATE_UNKNOWN, _("sysconf error for _SC_OPEN_MAX\n")); - } - return(maxfd); -} diff --git a/plugins/utils.h b/plugins/utils.h index c76b3216..cb979ce7 100644 --- a/plugins/utils.h +++ b/plugins/utils.h @@ -106,8 +106,6 @@ char *sperfdata (const char *, double, const char *, char *, char *, char *sperfdata_int (const char *, int, const char *, char *, char *, int, int, int, int); -int open_max (void); - /* The idea here is that, although not every plugin will use all of these, most will or should. Therefore, for consistency, these very common options should have only these meanings throughout the overall suite */ -- cgit v1.2.3-74-g34f1 From 4295decfbf06adfa1bf019d28e9044971607b2d6 Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Sat, 23 Sep 2023 10:33:06 +0200 Subject: open_max is a library function now, it should be mp_open_max --- lib/maxfd.c | 2 +- lib/maxfd.h | 2 +- lib/utils_cmd.c | 8 ++++---- plugins/popen.c | 2 +- plugins/runcmd.c | 8 ++++---- 5 files changed, 11 insertions(+), 11 deletions(-) (limited to 'plugins') diff --git a/lib/maxfd.c b/lib/maxfd.c index dcd4d3db..529b3568 100644 --- a/lib/maxfd.c +++ b/lib/maxfd.c @@ -1,7 +1,7 @@ #include "./maxfd.h" #include -long open_max (void) { +long mp_open_max (void) { long maxfd = 0L; /* Try sysconf(_SC_OPEN_MAX) first, as it can be higher than OPEN_MAX. * If that fails and the macro isn't defined, we fall back to an educated diff --git a/lib/maxfd.h b/lib/maxfd.h index 0d734c5c..45218d0f 100644 --- a/lib/maxfd.h +++ b/lib/maxfd.h @@ -4,6 +4,6 @@ #define DEFAULT_MAXFD 256 /* fallback value if no max open files value is set */ #define MAXFD_LIMIT 8192 /* upper limit of open files */ -long open_max (void); +long mp_open_max (void); #endif // _MAXFD_ diff --git a/lib/utils_cmd.c b/lib/utils_cmd.c index 71da9d24..ef7053a5 100644 --- a/lib/utils_cmd.c +++ b/lib/utils_cmd.c @@ -89,7 +89,7 @@ extern void die (int, const char *, ...) void cmd_init (void) { - long maxfd = open_max(); + long maxfd = mp_open_max(); /* if maxfd is unnaturally high, we force it to a lower value * ( e.g. on SunOS, when ulimit is set to unlimited: 2147483647 this would cause @@ -145,7 +145,7 @@ _cmd_open (char *const *argv, int *pfd, int *pfderr) /* close all descriptors in _cmd_pids[] * This is executed in a separate address space (pure child), * so we don't have to worry about async safety */ - long maxfd = open_max(); + long maxfd = mp_open_max(); for (i = 0; i < maxfd; i++) if (_cmd_pids[i] > 0) close (i); @@ -172,7 +172,7 @@ _cmd_close (int fd) pid_t pid; /* make sure the provided fd was opened */ - long maxfd = open_max(); + long maxfd = mp_open_max(); if (fd < 0 || fd > maxfd || !_cmd_pids || (pid = _cmd_pids[fd]) == 0) return -1; @@ -385,7 +385,7 @@ timeout_alarm_handler (int signo) printf (_("%s - Plugin timed out after %d seconds\n"), state_text(timeout_state), timeout_interval); - long maxfd = open_max(); + long maxfd = mp_open_max(); if(_cmd_pids) for(i = 0; i < maxfd; i++) { if(_cmd_pids[i] != 0) kill(_cmd_pids[i], SIGKILL); } diff --git a/plugins/popen.c b/plugins/popen.c index 7703afc8..b395f14a 100644 --- a/plugins/popen.c +++ b/plugins/popen.c @@ -178,7 +178,7 @@ spopen (const char *cmdstring) } argv[i] = NULL; - long maxfd = open_max(); + long maxfd = mp_open_max(); if (childpid == NULL) { /* first time through */ if ((childpid = calloc ((size_t)maxfd, sizeof (pid_t))) == NULL) diff --git a/plugins/runcmd.c b/plugins/runcmd.c index 98161421..bc0a4974 100644 --- a/plugins/runcmd.c +++ b/plugins/runcmd.c @@ -88,7 +88,7 @@ extern void die (int, const char *, ...) * through this api and thus achieve async-safeness throughout the api */ void np_runcmd_init(void) { - long maxfd = open_max(); + long maxfd = mp_open_max(); if(!np_pids) np_pids = calloc(maxfd, sizeof(pid_t)); } @@ -191,7 +191,7 @@ np_runcmd_open(const char *cmdstring, int *pfd, int *pfderr) /* close all descriptors in np_pids[] * This is executed in a separate address space (pure child), * so we don't have to worry about async safety */ - long maxfd = open_max(); + long maxfd = mp_open_max(); for (i = 0; i < maxfd; i++) if(np_pids[i] > 0) close (i); @@ -219,7 +219,7 @@ np_runcmd_close(int fd) pid_t pid; /* make sure this fd was opened by popen() */ - long maxfd = open_max(); + long maxfd = mp_open_max(); if(fd < 0 || fd > maxfd || !np_pids || (pid = np_pids[fd]) == 0) return -1; @@ -243,7 +243,7 @@ runcmd_timeout_alarm_handler (int signo) if (signo == SIGALRM) puts(_("CRITICAL - Plugin timed out while executing system call")); - long maxfd = open_max(); + long maxfd = mp_open_max(); if(np_pids) for(i = 0; i < maxfd; i++) { if(np_pids[i] != 0) kill(np_pids[i], SIGKILL); } -- cgit v1.2.3-74-g34f1 From 513929d796af668e977ca7981800c259304a2f25 Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Sat, 23 Sep 2023 12:31:33 +0200 Subject: Remove check for RETSIGTYPE in autoconf stuff autoupdate tells me, that since C89 I can safely assume RETSIGTYPE is void. Therefore to simplify things I removed the corresponding configure.ac line and replaced all mentions of RETSIGTYPE with void. --- configure.ac | 1 - lib/utils_cmd.h | 2 +- plugins/netutils.h | 2 +- plugins/popen.c | 8 ++++---- plugins/popen.h | 2 +- 5 files changed, 7 insertions(+), 8 deletions(-) (limited to 'plugins') diff --git a/configure.ac b/configure.ac index a294b00f..e6a40d3f 100644 --- a/configure.ac +++ b/configure.ac @@ -621,7 +621,6 @@ AC_C_CONST AC_STRUCT_TM AC_TYPE_PID_T AC_TYPE_SIZE_T -AC_TYPE_SIGNAL AC_CACHE_CHECK([for va_copy],ac_cv_HAVE_VA_COPY,[ AC_TRY_LINK([#include diff --git a/lib/utils_cmd.h b/lib/utils_cmd.h index 1fc2968c..f1b06c82 100644 --- a/lib/utils_cmd.h +++ b/lib/utils_cmd.h @@ -33,7 +33,7 @@ void cmd_init (void); #define CMD_NO_ASSOC 0x02 /* output.line won't point to buf */ -RETSIGTYPE timeout_alarm_handler (int); +void timeout_alarm_handler (int); #endif /* _UTILS_CMD_ */ diff --git a/plugins/netutils.h b/plugins/netutils.h index d7ee0ddd..ea653e72 100644 --- a/plugins/netutils.h +++ b/plugins/netutils.h @@ -92,7 +92,7 @@ extern int econn_refuse_state; extern int was_refused; extern int address_family; -RETSIGTYPE socket_timeout_alarm_handler (int) __attribute__((noreturn)); +void socket_timeout_alarm_handler (int) __attribute__((noreturn)); /* SSL-Related functionality */ #ifdef HAVE_SSL diff --git a/plugins/popen.c b/plugins/popen.c index b395f14a..036bc608 100644 --- a/plugins/popen.c +++ b/plugins/popen.c @@ -50,9 +50,9 @@ extern FILE *child_process; FILE *spopen (const char *); int spclose (FILE *); #ifdef REDHAT_SPOPEN_ERROR -RETSIGTYPE popen_sigchld_handler (int); +void popen_sigchld_handler (int); #endif -RETSIGTYPE popen_timeout_alarm_handler (int); +void popen_timeout_alarm_handler (int); #include /* ANSI C header file */ #include @@ -266,7 +266,7 @@ spclose (FILE * fp) } #ifdef REDHAT_SPOPEN_ERROR -RETSIGTYPE +void popen_sigchld_handler (int signo) { if (signo == SIGCHLD) @@ -274,7 +274,7 @@ popen_sigchld_handler (int signo) } #endif -RETSIGTYPE +void popen_timeout_alarm_handler (int signo) { int fh; diff --git a/plugins/popen.h b/plugins/popen.h index a5dd8fa7..1ea69632 100644 --- a/plugins/popen.h +++ b/plugins/popen.h @@ -5,7 +5,7 @@ FILE *spopen (const char *); int spclose (FILE *); -RETSIGTYPE popen_timeout_alarm_handler (int); +void popen_timeout_alarm_handler (int); pid_t *childpid=NULL; int *child_stderr_array=NULL; -- cgit v1.2.3-74-g34f1 From 4bb444f3353fbb49086bd0e212b3cad8009761dd Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Tue, 12 Sep 2023 14:55:00 +0200 Subject: check_disk: make -X a regex list --- plugins/check_disk.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'plugins') diff --git a/plugins/check_disk.c b/plugins/check_disk.c index 7dc1c4b1..e7e9378f 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c @@ -93,7 +93,7 @@ static int stat_remote_fs = 0; /* Linked list of filesystem types to omit. If the list is empty, don't exclude any types. */ -static struct name_list *fs_exclude_list; +static struct regex_list *fs_exclude_list = NULL; /* Linked list of filesystem types to check. If the list is empty, include all types. */ @@ -300,7 +300,7 @@ main (int argc, char **argv) } else if (me->me_dummy && !show_all_fs) { continue; /* Skip excluded fstypes */ - } else if (fs_exclude_list && np_find_name (fs_exclude_list, me->me_type)) { + } else if (fs_exclude_list && np_find_regmatch (fs_exclude_list, me->me_type)) { continue; /* Skip excluded fs's */ } else if (dp_exclude_list && @@ -543,7 +543,7 @@ process_arguments (int argc, char **argv) if (argc < 2) return ERROR; - np_add_name(&fs_exclude_list, "iso9660"); + np_add_regex(&fs_exclude_list, "iso9660", REG_EXTENDED); for (c = 1; c < argc; c++) if (strcmp ("-to", argv[c]) == 0) @@ -716,7 +716,11 @@ process_arguments (int argc, char **argv) np_add_name(&dp_exclude_list, optarg); break; case 'X': /* exclude file system type */ - np_add_name(&fs_exclude_list, optarg); + err = np_add_regex(&fs_exclude_list, optarg, REG_EXTENDED); + if (err != 0) { + regerror (err, &fs_exclude_list->regex, errbuf, MAX_INPUT_BUFFER); + die (STATE_UNKNOWN, "DISK %s: %s - %s\n",_("UNKNOWN"), _("Could not compile regular expression"), errbuf); + } break; case 'N': /* include file system type */ np_add_name(&fs_include_list, optarg); @@ -1003,8 +1007,8 @@ print_help (void) printf (" %s\n", "-u, --units=STRING"); printf (" %s\n", _("Choose bytes, kB, MB, GB, TB (default: MB)")); printf (UT_VERBOSE); - printf (" %s\n", "-X, --exclude-type=TYPE"); - printf (" %s\n", _("Ignore all filesystems of indicated type (may be repeated)")); + printf (" %s\n", "-X, --exclude-type=TYPE_REGEX"); + printf (" %s\n", _("Ignore all filesystems of types matching given regex(7) (may be repeated)")); printf (" %s\n", "-N, --include-type=TYPE"); printf (" %s\n", _("Check only filesystems of indicated type (may be repeated)")); @@ -1037,7 +1041,7 @@ print_usage (void) printf ("%s\n", _("Usage:")); printf (" %s {-w absolute_limit |-w percentage_limit%% | -W inode_percentage_limit } {-c absolute_limit|-c percentage_limit%% | -K inode_percentage_limit } {-p path | -x device}\n", progname); printf ("[-C] [-E] [-e] [-f] [-g group ] [-k] [-l] [-M] [-m] [-R path ] [-r path ]\n"); - printf ("[-t timeout] [-u unit] [-v] [-X type] [-N type]\n"); + printf ("[-t timeout] [-u unit] [-v] [-X type_regex] [-N type]\n"); } bool -- cgit v1.2.3-74-g34f1 From 6947a8cea9335c2eeefb8929aa663db49ecac5a1 Mon Sep 17 00:00:00 2001 From: Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> Date: Sat, 30 Sep 2023 12:54:21 +0200 Subject: check_disk: Use regex also to include fs types --- plugins/check_disk.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'plugins') diff --git a/plugins/check_disk.c b/plugins/check_disk.c index e7e9378f..06576d86 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c @@ -97,7 +97,7 @@ static struct regex_list *fs_exclude_list = NULL; /* Linked list of filesystem types to check. If the list is empty, include all types. */ -static struct name_list *fs_include_list; +static struct regex_list *fs_include_list; static struct name_list *dp_exclude_list; @@ -308,7 +308,7 @@ main (int argc, char **argv) np_find_name (dp_exclude_list, me->me_mountdir))) { continue; /* Skip not included fstypes */ - } else if (fs_include_list && !np_find_name (fs_include_list, me->me_type)) { + } else if (fs_include_list && !np_find_regmatch(fs_include_list, me->me_type)) { continue; } } @@ -723,7 +723,11 @@ process_arguments (int argc, char **argv) } break; case 'N': /* include file system type */ - np_add_name(&fs_include_list, optarg); + err = np_add_regex(&fs_include_list, optarg, REG_EXTENDED); + if (err != 0) { + regerror (err, &fs_exclude_list->regex, errbuf, MAX_INPUT_BUFFER); + die (STATE_UNKNOWN, "DISK %s: %s - %s\n",_("UNKNOWN"), _("Could not compile regular expression"), errbuf); + } break; case 'v': /* verbose */ verbose++; -- cgit v1.2.3-74-g34f1 From 819f90b726805f50d6de72f06b58bf02744f4763 Mon Sep 17 00:00:00 2001 From: Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> Date: Sun, 1 Oct 2023 00:41:55 +0200 Subject: check_disk: Change usage for --include-type to indicated regexes are now possible --- plugins/check_disk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/check_disk.c b/plugins/check_disk.c index 06576d86..2f066c7b 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c @@ -1013,8 +1013,8 @@ print_help (void) printf (UT_VERBOSE); printf (" %s\n", "-X, --exclude-type=TYPE_REGEX"); printf (" %s\n", _("Ignore all filesystems of types matching given regex(7) (may be repeated)")); - printf (" %s\n", "-N, --include-type=TYPE"); - printf (" %s\n", _("Check only filesystems of indicated type (may be repeated)")); + printf (" %s\n", "-N, --include-type=TYPE_REGEX"); + printf (" %s\n", _("Check only filesystems where the type matches this given regex(7) (may be repeated)")); printf ("\n"); printf ("%s\n", _("General usage hints:")); -- cgit v1.2.3-74-g34f1 From e1e1291b72e2f1df81d0346d77e65da677e57878 Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Tue, 3 Oct 2023 22:22:51 +0200 Subject: Fix some more typos --- .github/workflows/test.yml | 2 +- m4/np_mysqlclient.m4 | 2 +- plugins/check_ntp.c | 2 +- plugins/t/check_imap.t | 2 +- plugins/t/check_users.t | 2 +- plugins/tests/check_curl.t | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) (limited to 'plugins') diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index eda27907..0f845de7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,7 +21,7 @@ jobs: uses: codespell-project/actions-codespell@v2 with: skip: "./.git,./.gitignore,./ABOUT-NLS,*.po,./gl,./po,./tools/squid.conf,./build-aux/ltmain.sh" - ignore_words_list: allright,gord,didi,hda,nd,alis,clen,scrit,ser,fot,te,parm,isnt,consol,oneliners + ignore_words_list: allright,gord,didi,hda,nd,alis,clen,scrit,ser,fot,te,parm,isnt,consol,oneliners,esponse check_filenames: true check_hidden: true # super-linter: diff --git a/m4/np_mysqlclient.m4 b/m4/np_mysqlclient.m4 index 9f533ea3..9fe38ac9 100644 --- a/m4/np_mysqlclient.m4 +++ b/m4/np_mysqlclient.m4 @@ -13,7 +13,7 @@ dnl np_mysql_libs = flags for libs, from mysql_config --libs dnl np_mysql_cflags = flags for cflags, from mysql_config --cflags dnl Also sets in config.h: dnl HAVE_MYSQLCLIENT -dnl Copile your code with: +dnl Compile your code with: dnl $(CC) $(np_mysql_include) code.c $(np_mysql_libs) AC_DEFUN([np_mysqlclient], diff --git a/plugins/check_ntp.c b/plugins/check_ntp.c index 36146505..99537c88 100644 --- a/plugins/check_ntp.c +++ b/plugins/check_ntp.c @@ -486,7 +486,7 @@ double offset_request(const char *host, int *status){ } /* cleanup */ - /* FIXME: Not closing the socket to avoid re-use of the local port + /* FIXME: Not closing the socket to avoid reuse of the local port * which can cause old NTP packets to be read instead of NTP control * packets in jitter_request(). THERE MUST BE ANOTHER WAY... * for(j=0; jtestCmd( "./check_imap $host_tcp_imap -p 143 -wt 9 -ct 9 -to 10 -e cmp_ok( $t->return_code, '==', 0, "Check old parameter options" ); $t = NPTest->testCmd( "./check_imap $host_nonresponsive" ); -cmp_ok( $t->return_code, '==', 2, "Get error with non reponsive host" ); +cmp_ok( $t->return_code, '==', 2, "Get error with non responsive host" ); $t = NPTest->testCmd( "./check_imap $hostname_invalid" ); cmp_ok( $t->return_code, '==', 2, "Invalid hostname" ); diff --git a/plugins/t/check_users.t b/plugins/t/check_users.t index 088f3b52..9ebc2fc6 100644 --- a/plugins/t/check_users.t +++ b/plugins/t/check_users.t @@ -2,7 +2,7 @@ # # Logged in Users Tests via check_users # -# Trick: This ckeck requires at least 1 user logged in. These commands should +# Trick: This check requires at least 1 user logged in. These commands should # leave a session open forever in the background: # # $ ssh -tt localhost /dev/null 2>/dev/null & diff --git a/plugins/tests/check_curl.t b/plugins/tests/check_curl.t index 72f2b7c2..3c914830 100755 --- a/plugins/tests/check_curl.t +++ b/plugins/tests/check_curl.t @@ -9,7 +9,7 @@ # Country Name (2 letter code) [AU]:DE # State or Province Name (full name) [Some-State]:Bavaria # Locality Name (eg, city) []:Munich -# Organization Name (eg, company) [Internet Widgits Pty Ltd]:Monitoring Plugins +# Organization Name (eg, company) [Internet Widgets Pty Ltd]:Monitoring Plugins # Organizational Unit Name (eg, section) []: # Common Name (e.g. server FQDN or YOUR name) []:Monitoring Plugins # Email Address []:devel@monitoring-plugins.org -- cgit v1.2.3-74-g34f1 From 09923e8a0ffd3540f7c950743ef6b60ea85fe9cd Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Sat, 7 Oct 2023 23:31:59 +0200 Subject: Fix missing include in plugins/runcmd.c --- plugins/runcmd.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'plugins') diff --git a/plugins/runcmd.c b/plugins/runcmd.c index bc0a4974..4f3e349b 100644 --- a/plugins/runcmd.c +++ b/plugins/runcmd.c @@ -60,6 +60,8 @@ # define SIG_ERR ((Sigfunc *)-1) #endif +#include "../lib/maxfd.h" + /* This variable must be global, since there's no way the caller * can forcibly slay a dead or ungainly running program otherwise. * Multithreading apps and plugins can initialize it (via NP_RUNCMD_INIT) -- cgit v1.2.3-74-g34f1