From git at monitoring-plugins.org Fri Sep 6 02:00:11 2024 From: git at monitoring-plugins.org (Lorenz Kästle) Date: Fri, 6 Sep 2024 02:00:11 +0200 (CEST) Subject: [monitoring-plugins] check_mysql: remove unused global variables Message-ID: <20240906000011.460DB2000122@orwell.monitoring-plugins.org> Module: monitoring-plugins Branch: master Commit: 584cca3a96845d7720c34358340c98c31c765fc4 Author: Lorenz K?stle Date: Wed Aug 28 19:19:16 2024 +0200 URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=584cca3 check_mysql: remove unused global variables --- plugins/check_mysql.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/check_mysql.c b/plugins/check_mysql.c index 6a7daf1..a2a5e32 100644 --- a/plugins/check_mysql.c +++ b/plugins/check_mysql.c @@ -59,7 +59,7 @@ bool ssl = false; char *opt_file = NULL; char *opt_group = NULL; unsigned int db_port = MYSQL_PORT; -int check_slave = 0, warn_sec = 0, crit_sec = 0; +int check_slave = 0; int ignore_auth = 0; int verbose = 0; From git at monitoring-plugins.org Fri Sep 6 02:00:11 2024 From: git at monitoring-plugins.org (Lorenz Kästle) Date: Fri, 6 Sep 2024 02:00:11 +0200 (CEST) Subject: [monitoring-plugins] check_mysql: Label some booleans correctly Message-ID: <20240906000011.526562000125@orwell.monitoring-plugins.org> Module: monitoring-plugins Branch: master Commit: 4f7ee057865e75d0eb95874b2404eb21bb5d508f Author: Lorenz K?stle Date: Wed Aug 28 19:20:31 2024 +0200 URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=4f7ee05 check_mysql: Label some booleans correctly --- plugins/check_mysql.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/check_mysql.c b/plugins/check_mysql.c index a2a5e32..15ec04c 100644 --- a/plugins/check_mysql.c +++ b/plugins/check_mysql.c @@ -59,8 +59,8 @@ bool ssl = false; char *opt_file = NULL; char *opt_group = NULL; unsigned int db_port = MYSQL_PORT; -int check_slave = 0; -int ignore_auth = 0; +bool check_slave = false; +bool ignore_auth = false; int verbose = 0; static double warning_time = 0; @@ -456,10 +456,10 @@ process_arguments (int argc, char **argv) db_port = atoi (optarg); break; case 'S': - check_slave = 1; /* check-slave */ + check_slave = true; /* check-slave */ break; case 'n': - ignore_auth = 1; /* ignore-auth */ + ignore_auth = true; /* ignore-auth */ break; case 'w': warning = optarg; From git at monitoring-plugins.org Fri Sep 6 02:00:11 2024 From: git at monitoring-plugins.org (GitHub) Date: Fri, 6 Sep 2024 02:00:11 +0200 (CEST) Subject: [monitoring-plugins] Merge pull request #2015 from ... Message-ID: <20240906000011.65F312000126@orwell.monitoring-plugins.org> Module: monitoring-plugins Branch: master Commit: a378134ddc042d72d6fde7b018de66e98d9e41d5 Author: Lorenz K?stle <12514511+RincewindsHat at users.noreply.github.com> Committer: GitHub Date: Fri Sep 6 01:51:23 2024 +0200 URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=a378134 Merge pull request #2015 from RincewindsHat/fix/check_mysql_variables check_mysql: * remove unused variables * convert two practical booleans to real `bool` --- From git at monitoring-plugins.org Fri Sep 27 13:50:11 2024 From: git at monitoring-plugins.org (RincewindsHat) Date: Fri, 27 Sep 2024 13:50:11 +0200 (CEST) Subject: [monitoring-plugins] check_snmp: Declare most variables as static Message-ID: <20240927115011.AFC1B2000122@orwell.monitoring-plugins.org> Module: monitoring-plugins Branch: master Commit: 3ba660889a8e7a8fc992cfafc910a8f91eafb354 Author: RincewindsHat <12514511+RincewindsHat at users.noreply.github.com> Date: Fri Sep 27 11:57:38 2024 +0200 URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=3ba6608 check_snmp: Declare most variables as static --- plugins/check_snmp.c | 156 +++++++++++++++++++++++++-------------------------- 1 file changed, 78 insertions(+), 78 deletions(-) diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index 937b3a5..bd1940e 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c @@ -86,82 +86,82 @@ const char *email = "devel at monitoring-plugins.org"; -int process_arguments (int, char **); -int validate_arguments (void); -char *thisarg (char *str); -char *nextarg (char *str); +static int process_arguments (int, char **); +static int validate_arguments (void); +static char *thisarg (char *str); +static char *nextarg (char *str); void print_usage (void); -void print_help (void); -char *multiply (char *str); +static void print_help (void); +static char *multiply (char *str); #include "regex.h" -char regex_expect[MAX_INPUT_BUFFER] = ""; -regex_t preg; -regmatch_t pmatch[10]; -char errbuf[MAX_INPUT_BUFFER] = ""; -char perfstr[MAX_INPUT_BUFFER] = "| "; -int cflags = REG_EXTENDED | REG_NOSUB | REG_NEWLINE; -int eflags = 0; -int errcode, excode; - -char *server_address = NULL; -char *community = NULL; -char **contextargs = NULL; -char *context = NULL; -char **authpriv = NULL; -char *proto = NULL; -char *seclevel = NULL; -char *secname = NULL; -char *authproto = NULL; -char *privproto = NULL; -char *authpasswd = NULL; -char *privpasswd = NULL; -int nulloid = STATE_UNKNOWN; -char **oids = NULL; -size_t oids_size = 0; -char *label; -char *units; -char *port; -char *snmpcmd; -char string_value[MAX_INPUT_BUFFER] = ""; -int invert_search=0; -char **labels = NULL; -char **unitv = NULL; -size_t nlabels = 0; -size_t labels_size = OID_COUNT_STEP; -size_t nunits = 0; -size_t unitv_size = OID_COUNT_STEP; -size_t numoids = 0; -int numauthpriv = 0; -int numcontext = 0; -int verbose = 0; -bool usesnmpgetnext = false; -char *warning_thresholds = NULL; -char *critical_thresholds = NULL; -thresholds **thlds; -size_t thlds_size = OID_COUNT_STEP; -double *response_value; -size_t response_size = OID_COUNT_STEP; -int retries = 0; -int *eval_method; -size_t eval_size = OID_COUNT_STEP; -char *delimiter; -char *output_delim; -char *miblist = NULL; -bool needmibs = false; -int calculate_rate = 0; -double offset = 0.0; -int rate_multiplier = 1; -state_data *previous_state; -double *previous_value; -size_t previous_size = OID_COUNT_STEP; -int perf_labels = 1; -char* ip_version = ""; -double multiplier = 1.0; -char *fmtstr = ""; -bool fmtstr_set = false; -char buffer[DEFAULT_BUFFER_SIZE]; -bool ignore_mib_parsing_errors = false; +static char regex_expect[MAX_INPUT_BUFFER] = ""; +static regex_t preg; +static regmatch_t pmatch[10]; +static char errbuf[MAX_INPUT_BUFFER] = ""; +static char perfstr[MAX_INPUT_BUFFER] = "| "; +static int cflags = REG_EXTENDED | REG_NOSUB | REG_NEWLINE; +static int eflags = 0; +static int errcode, excode; + +static char *server_address = NULL; +static char *community = NULL; +static char **contextargs = NULL; +static char *context = NULL; +static char **authpriv = NULL; +static char *proto = NULL; +static char *seclevel = NULL; +static char *secname = NULL; +static char *authproto = NULL; +static char *privproto = NULL; +static char *authpasswd = NULL; +static char *privpasswd = NULL; +static int nulloid = STATE_UNKNOWN; +static char **oids = NULL; +static size_t oids_size = 0; +static char *label; +static char *units; +static char *port; +static char *snmpcmd; +static char string_value[MAX_INPUT_BUFFER] = ""; +static int invert_search=0; +static char **labels = NULL; +static char **unitv = NULL; +static size_t nlabels = 0; +static size_t labels_size = OID_COUNT_STEP; +static size_t nunits = 0; +static size_t unitv_size = OID_COUNT_STEP; +static size_t numoids = 0; +static int numauthpriv = 0; +static int numcontext = 0; +static int verbose = 0; +static bool usesnmpgetnext = false; +static char *warning_thresholds = NULL; +static char *critical_thresholds = NULL; +static thresholds **thlds; +static size_t thlds_size = OID_COUNT_STEP; +static double *response_value; +static size_t response_size = OID_COUNT_STEP; +static int retries = 0; +static int *eval_method; +static size_t eval_size = OID_COUNT_STEP; +static char *delimiter; +static char *output_delim; +static char *miblist = NULL; +static bool needmibs = false; +static int calculate_rate = 0; +static double offset = 0.0; +static int rate_multiplier = 1; +static state_data *previous_state; +static double *previous_value; +static size_t previous_size = OID_COUNT_STEP; +static int perf_labels = 1; +static char* ip_version = ""; +static double multiplier = 1.0; +static char *fmtstr = ""; +static bool fmtstr_set = false; +static char buffer[DEFAULT_BUFFER_SIZE]; +static bool ignore_mib_parsing_errors = false; static char *fix_snmp_range(char *th) { @@ -1030,7 +1030,7 @@ selected. -int +static int validate_arguments () { /* check whether to load locally installed MIBS (CPU/disk intensive) */ @@ -1139,7 +1139,7 @@ validate_arguments () /* trim leading whitespace if there is a leading quote, make sure it balances */ -char * +static char * thisarg (char *str) { str += strspn (str, " \t\r\n"); /* trim any leading whitespace */ @@ -1156,7 +1156,7 @@ thisarg (char *str) set the trailing quote to '\x0' if the string continues, advance beyond the comma */ -char * +static char * nextarg (char *str) { if (str[0] == '\'') { @@ -1188,7 +1188,7 @@ nextarg (char *str) /* multiply result (values 0 < n < 1 work as divider) */ -char * +static char * multiply (char *str) { char *endptr; @@ -1225,7 +1225,7 @@ multiply (char *str) } -void +static void print_help (void) { print_revision (progname, NP_VERSION); From git at monitoring-plugins.org Fri Sep 27 13:50:11 2024 From: git at monitoring-plugins.org (RincewindsHat) Date: Fri, 27 Sep 2024 13:50:11 +0200 (CEST) Subject: [monitoring-plugins] check_snmp: Remove unused PP-macros Message-ID: <20240927115011.BD1CC2000124@orwell.monitoring-plugins.org> Module: monitoring-plugins Branch: master Commit: b1e96a3bf30d148c33de8715ed30a3df4a829ecd Author: RincewindsHat <12514511+RincewindsHat at users.noreply.github.com> Date: Fri Sep 27 11:58:42 2024 +0200 URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=b1e96a3 check_snmp: Remove unused PP-macros --- plugins/check_snmp.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index bd1940e..90a0402 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c @@ -55,8 +55,6 @@ const char *email = "devel at monitoring-plugins.org"; #define CRIT_STRING 2 #define CRIT_REGEX 4 #define WARN_PRESENT 8 -#define WARN_STRING 16 -#define WARN_REGEX 32 #define OID_COUNT_STEP 8 From git at monitoring-plugins.org Fri Sep 27 13:50:11 2024 From: git at monitoring-plugins.org (GitHub) Date: Fri, 27 Sep 2024 13:50:11 +0200 (CEST) Subject: [monitoring-plugins] Merge pull request #2020 from ... Message-ID: <20240927115011.CCBAC2000125@orwell.monitoring-plugins.org> Module: monitoring-plugins Branch: master Commit: 1f487e984e94c512cf00b9aa4d61d6c3d9d7b369 Author: Lorenz K?stle <12514511+RincewindsHat at users.noreply.github.com> Committer: GitHub Date: Fri Sep 27 13:46:25 2024 +0200 URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=1f487e9 Merge pull request #2020 from RincewindsHat/check_snmp_fixes Check snmp fixes --- From git at monitoring-plugins.org Fri Sep 27 14:00:11 2024 From: git at monitoring-plugins.org (Git Repository) Date: Fri, 27 Sep 2024 14:00:11 +0200 (CEST) Subject: [monitoring-plugins] check_disk_static_fixes branch created Message-ID: <20240927120011.7AF3E2000122@orwell.monitoring-plugins.org> Module: monitoring-plugins Branch: check_disk_static_fixes SHA1: fb5175aed64bdeb1b5f2725d185ba42576067dda URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/log/?id=refs/heads/check_disk_static_fixes The check_disk_static_fixes branch has been created. From git at monitoring-plugins.org Fri Sep 27 14:00:11 2024 From: git at monitoring-plugins.org (Lorenz Kästle) Date: Fri, 27 Sep 2024 14:00:11 +0200 (CEST) Subject: [monitoring-plugins] check_disk: Declare global variables static Message-ID: <20240927120011.DFA6F2000122@orwell.monitoring-plugins.org> Module: monitoring-plugins Branch: check_disk_static_fixes Commit: 7ca72ecace9f74bbd121e6cb604722647cf90701 Author: Lorenz K?stle <12514511+RincewindsHat at users.noreply.github.com> Date: Fri Sep 27 13:51:21 2024 +0200 URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=7ca72ec check_disk: Declare global variables static Variables only used in that specific translation unit should be static to actually communicate that fact. Also allows the compiler to detect unused (global) variables. --- plugins/check_disk.c | 74 ++++++++++++++++++++++++++-------------------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/plugins/check_disk.c b/plugins/check_disk.c index 24de2d4..8bfc69b 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c @@ -119,44 +119,44 @@ enum #pragma alloca #endif -int process_arguments (int, char **); -void print_path (const char *mypath); -void set_all_thresholds (struct parameter_list *path); -int validate_arguments (uintmax_t, uintmax_t, double, double, double, double, char *); -void print_help (void); +static int process_arguments (int, char **); +static void print_path (const char *mypath); +static void set_all_thresholds (struct parameter_list *path); +static int validate_arguments (uintmax_t, uintmax_t, double, double, double, double, char *); +static void print_help (void); void print_usage (void); -double calculate_percent(uintmax_t, uintmax_t); -bool stat_path (struct parameter_list *p); -void get_stats (struct parameter_list *p, struct fs_usage *fsp); -void get_path_stats (struct parameter_list *p, struct fs_usage *fsp); - -char *exclude_device; -char *units; -uintmax_t mult = 1024 * 1024; -int verbose = 0; -bool erronly = false; -bool display_mntp = false; -bool exact_match = false; -bool ignore_missing = false; -bool freespace_ignore_reserved = false; -bool display_inodes_perfdata = false; -char *warn_freespace_units = NULL; -char *crit_freespace_units = NULL; -char *warn_freespace_percent = NULL; -char *crit_freespace_percent = NULL; -char *warn_usedspace_units = NULL; -char *crit_usedspace_units = NULL; -char *warn_usedspace_percent = NULL; -char *crit_usedspace_percent = NULL; -char *warn_usedinodes_percent = NULL; -char *crit_usedinodes_percent = NULL; -char *warn_freeinodes_percent = NULL; -char *crit_freeinodes_percent = NULL; -bool path_selected = false; -bool path_ignored = false; -char *group = NULL; -struct stat *stat_buf; -struct name_list *seen = NULL; +static double calculate_percent(uintmax_t, uintmax_t); +static bool stat_path (struct parameter_list *p); +static void get_stats (struct parameter_list *p, struct fs_usage *fsp); +static void get_path_stats (struct parameter_list *p, struct fs_usage *fsp); + +static char *exclude_device; +static char *units; +static uintmax_t mult = 1024 * 1024; +static int verbose = 0; +static bool erronly = false; +static bool display_mntp = false; +static bool exact_match = false; +static bool ignore_missing = false; +static bool freespace_ignore_reserved = false; +static bool display_inodes_perfdata = false; +static char *warn_freespace_units = NULL; +static char *crit_freespace_units = NULL; +static char *warn_freespace_percent = NULL; +static char *crit_freespace_percent = NULL; +static char *warn_usedspace_units = NULL; +static char *crit_usedspace_units = NULL; +static char *warn_usedspace_percent = NULL; +static char *crit_usedspace_percent = NULL; +static char *warn_usedinodes_percent = NULL; +static char *crit_usedinodes_percent = NULL; +static char *warn_freeinodes_percent = NULL; +static char *crit_freeinodes_percent = NULL; +static bool path_selected = false; +static bool path_ignored = false; +static char *group = NULL; +static struct stat *stat_buf; +static struct name_list *seen = NULL; int From git at monitoring-plugins.org Fri Sep 27 14:00:11 2024 From: git at monitoring-plugins.org (Lorenz Kästle) Date: Fri, 27 Sep 2024 14:00:11 +0200 (CEST) Subject: [monitoring-plugins] check_disk: remove unused variables and functions Message-ID: <20240927120011.EE4F22000124@orwell.monitoring-plugins.org> Module: monitoring-plugins Branch: check_disk_static_fixes Commit: fb5175aed64bdeb1b5f2725d185ba42576067dda Author: Lorenz K?stle <12514511+RincewindsHat at users.noreply.github.com> Date: Fri Sep 27 13:53:24 2024 +0200 URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=fb5175a check_disk: remove unused variables and functions --- plugins/check_disk.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/plugins/check_disk.c b/plugins/check_disk.c index 8bfc69b..b3dd301 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c @@ -120,9 +120,7 @@ enum #endif static int process_arguments (int, char **); -static void print_path (const char *mypath); static void set_all_thresholds (struct parameter_list *path); -static int validate_arguments (uintmax_t, uintmax_t, double, double, double, double, char *); static void print_help (void); void print_usage (void); static double calculate_percent(uintmax_t, uintmax_t); @@ -130,7 +128,6 @@ static bool stat_path (struct parameter_list *p); static void get_stats (struct parameter_list *p, struct fs_usage *fsp); static void get_path_stats (struct parameter_list *p, struct fs_usage *fsp); -static char *exclude_device; static char *units; static uintmax_t mult = 1024 * 1024; static int verbose = 0; @@ -899,18 +896,6 @@ process_arguments (int argc, char **argv) return true; } - - -void -print_path (const char *mypath) -{ - if (mypath == NULL) - printf ("\n"); - else - printf (_(" for %s\n"), mypath); -} - - void set_all_thresholds (struct parameter_list *path) { From git at monitoring-plugins.org Fri Sep 27 14:20:11 2024 From: git at monitoring-plugins.org (GitHub) Date: Fri, 27 Sep 2024 14:20:11 +0200 (CEST) Subject: [monitoring-plugins] Merge pull request #2021 from ... Message-ID: <20240927122011.F304C2000122@orwell.monitoring-plugins.org> Module: monitoring-plugins Branch: master Commit: 91fa55f97162092060f602758a55c87088073e1f Author: Lorenz K?stle <12514511+RincewindsHat at users.noreply.github.com> Committer: GitHub Date: Fri Sep 27 14:19:39 2024 +0200 URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=91fa55f Merge pull request #2021 from monitoring-plugins/check_disk_static_fixes Check disk static fixes --- From git at monitoring-plugins.org Fri Sep 27 14:20:12 2024 From: git at monitoring-plugins.org (Git Repository) Date: Fri, 27 Sep 2024 14:20:12 +0200 (CEST) Subject: [monitoring-plugins] check_disk_static_fixes branch removed Message-ID: <20240927122012.05C1D2000125@orwell.monitoring-plugins.org> Module: monitoring-plugins Branch: check_disk_static_fixes Old SHA1: fb5175aed64bdeb1b5f2725d185ba42576067dda The check_disk_static_fixes branch has been removed.