From 8cf31437e99167ad9c260e6677b4d1ed31a34d56 Mon Sep 17 00:00:00 2001 From: Kristian Schuster <116557017+KriSchu@users.noreply.github.com> Date: Mon, 24 Oct 2022 17:29:53 +0200 Subject: check_disk: add ignore-missing option to return OK for missing fs There a situations where UNKNOWN or CRITICAL services are not wanted when a filesystem is missing, a regex does not match or the filesystem is inaccessible on a system. This new option helps to have the service in state OK. diff --git a/plugins/check_disk.c b/plugins/check_disk.c index 7018c6f..8df9e7e 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c @@ -112,7 +112,8 @@ enum { SYNC_OPTION = CHAR_MAX + 1, NO_SYNC_OPTION, - BLOCK_SIZE_OPTION + BLOCK_SIZE_OPTION, + IGNORE_MISSING }; #ifdef _AIX @@ -140,6 +141,7 @@ int verbose = 0; int erronly = FALSE; int display_mntp = FALSE; int exact_match = FALSE; +int ignore_missing = FALSE; int freespace_ignore_reserved = FALSE; int display_inodes_perfdata = FALSE; char *warn_freespace_units = NULL; @@ -219,7 +221,9 @@ main (int argc, char **argv) temp_list = path_select_list; while (temp_list) { - if (! temp_list->best_match) { + if (! temp_list->best_match && ignore_missing == 1) { + die (STATE_OK, _("DISK %s: %s not found (ignoring)\n"), _("OK"), temp_list->name); + } else if (! temp_list->best_match) { die (STATE_CRITICAL, _("DISK %s: %s not found\n"), _("CRITICAL"), temp_list->name); } @@ -481,6 +485,7 @@ process_arguments (int argc, char **argv) {"ignore-ereg-partition", required_argument, 0, 'i'}, {"ignore-eregi-path", required_argument, 0, 'I'}, {"ignore-eregi-partition", required_argument, 0, 'I'}, + {"ignore-missing", no_argument, 0, IGNORE_MISSING}, {"local", no_argument, 0, 'l'}, {"stat-remote-fs", no_argument, 0, 'L'}, {"iperfdata", no_argument, 0, 'P'}, @@ -718,6 +723,9 @@ process_arguments (int argc, char **argv) cflags = default_cflags; break; + case IGNORE_MISSING: + ignore_missing = 1; + break; case 'A': optarg = strdup(".*"); // Intentional fallthrough @@ -753,7 +761,10 @@ process_arguments (int argc, char **argv) } } - if (!fnd) + if (!fnd && ignore_missing == 1) + die (STATE_OK, "DISK %s: %s - %s\n",_("OK"), + _("Regular expression did not match any path or disk (ignoring)"), optarg); + else if (!fnd) die (STATE_UNKNOWN, "DISK %s: %s - %s\n",_("UNKNOWN"), _("Regular expression did not match any path or disk"), optarg); @@ -923,6 +934,9 @@ print_help (void) printf (" %s\n", _("Regular expression to ignore selected path/partition (case insensitive) (may be repeated)")); printf (" %s\n", "-i, --ignore-ereg-path=PATH, --ignore-ereg-partition=PARTITION"); printf (" %s\n", _("Regular expression to ignore selected path or partition (may be repeated)")); + printf (" %s\n", "--ignore-missing"); + printf (" %s\n", _("Return OK if no filesystem matches, filesystem does not exist or is inaccessible.")); + printf (" %s\n", _("(Provide this option before -r / --ereg-path if used)")); printf (UT_PLUG_TIMEOUT, DEFAULT_SOCKET_TIMEOUT); printf (" %s\n", "-u, --units=STRING"); printf (" %s\n", _("Choose bytes, kB, MB, GB, TB (default: MB)")); @@ -965,8 +979,13 @@ stat_path (struct parameter_list *p) if (stat (p->name, &stat_buf[0])) { if (verbose >= 3) printf("stat failed on %s\n", p->name); - printf("DISK %s - ", _("CRITICAL")); - die (STATE_CRITICAL, _("%s %s: %s\n"), p->name, _("is not accessible"), strerror(errno)); + if (ignore_missing == 1) { + printf("DISK %s - ", _("OK")); + die (STATE_OK, _("%s %s: %s\n"), p->name, _("is not accessible (ignoring)"), strerror(errno)); + } else { + printf("DISK %s - ", _("CRITICAL")); + die (STATE_CRITICAL, _("%s %s: %s\n"), p->name, _("is not accessible"), strerror(errno)); + } } } -- cgit v0.10-9-g596f From 0d562a356f45f645014c3908178fc13876006f6e Mon Sep 17 00:00:00 2001 From: Kristian Schuster <116557017+KriSchu@users.noreply.github.com> Date: Tue, 25 Oct 2022 20:49:51 +0200 Subject: check_disk: add tests for new option --ignore-missing diff --git a/plugins/t/check_disk.t b/plugins/t/check_disk.t index ec527e7..bea34a4 100644 --- a/plugins/t/check_disk.t +++ b/plugins/t/check_disk.t @@ -351,3 +351,18 @@ unlike( $result->output, qr/$mountpoint2_valid/, "output data does not have $mou $result = NPTest->testCmd( "./check_disk -w 0% -c 0% -p $mountpoint_valid -p $mountpoint2_valid -i '^barbazJodsf\$'"); like( $result->output, qr/$mountpoint_valid/, "ignore: output data does have $mountpoint_valid when regex doesn't match"); like( $result->output, qr/$mountpoint2_valid/,"ignore: output data does have $mountpoint2_valid when regex doesn't match"); + +# ignore-missing: exit okay, when fs is not accessible +$result = NPTest->testCmd( "./check_disk --ignore-missing -w 0% -c 0% -p /bob"); +cmp_ok( $result->return_code, '==', 0, "ignore-missing: return okay for not existing filesystem /bob"); +like( $result->output, '/^DISK OK - /bob is not accessible .*$/', 'Output OK'); + +# ignore-missing: exit okay, when regex does not match +$result = NPTest->testCmd( "./check_disk --ignore-missing -w 0% -c 0% -r /bob"); +cmp_ok( $result->return_code, '==', 0, "ignore-missing: return okay for regular expression not matching"); +like( $result->output, '/^DISK OK: Regular expression did not match any path or disk.*$/', 'Output OK'); + +# ignore-missing: exit okay, when fs with exact match (-E) is not found +$result = NPTest->testCmd( "./check_disk --ignore-missing -E -w 0% -c 0% -p /etc"); +cmp_ok( $result->return_code, '==', 0, "ignore-missing: return okay when exact match does not find fs"); +like( $result->output, '/^DISK OK: /etc not found.*$/', 'Output OK'); -- cgit v0.10-9-g596f From bacacd2cb38c7d7a695a6f75f699168d9df0132d Mon Sep 17 00:00:00 2001 From: Sven Nierlein Date: Wed, 26 Oct 2022 14:03:22 +0200 Subject: check_disk: adjust test plan diff --git a/plugins/t/check_disk.t b/plugins/t/check_disk.t index bea34a4..a534fd4 100644 --- a/plugins/t/check_disk.t +++ b/plugins/t/check_disk.t @@ -23,7 +23,7 @@ my $mountpoint2_valid = getTestParameter( "NP_MOUNTPOINT2_VALID", "Path to anoth if ($mountpoint_valid eq "" or $mountpoint2_valid eq "") { plan skip_all => "Need 2 mountpoints to test"; } else { - plan tests => 78; + plan tests => 84; } $result = NPTest->testCmd( -- cgit v0.10-9-g596f From 12ae1fb6627bfef419fb4571a7189909107f5e6e Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Tue, 1 Oct 2013 15:06:51 +0200 Subject: check_mailq.pl: separate submission queue check_mailq.pl ignores the separate submission queue used in (modern?) sendmail implementations. For the queue output below with one message in the submission queue and no messages in the transport queue, check_mailq.pl reports zero messages in the queue because the request count from the last queue always overwrites previous queues. If the sendmail MTA isn't running or has become wedged, messages will sit in the submission queue forever. The attached patch fixes this in a backwards compatible way (i.e., it shouldn't break any of the currently supported formats). -- Just turning attached patch of github issue #972 into a push request. (Closes #972) diff --git a/THANKS.in b/THANKS.in index 73b3b3a..b132744 100644 --- a/THANKS.in +++ b/THANKS.in @@ -405,3 +405,4 @@ Robert Bohne Wolfgang Nieder andrew bezella Lorenz Gruenwald +John Morrissey diff --git a/plugins-scripts/check_mailq.pl b/plugins-scripts/check_mailq.pl index 27073d3..f02c90f 100755 --- a/plugins-scripts/check_mailq.pl +++ b/plugins-scripts/check_mailq.pl @@ -149,7 +149,26 @@ if ($mailq eq "sendmail") { ##/var/spool/mqueue/qF/df is empty ## Total Requests: 1 - +# separate submission/transport queues, empty +## MSP Queue status... +## /var/spool/mqueue-client is empty +## Total requests: 0 +## MTA Queue status... +## /var/spool/mqueue is empty +## Total requests: 0 +# separate submission/transport queues: 1 +## MSP Queue status... +## /var/spool/mqueue-client (1 request) +## -----Q-ID----- --Size-- -----Q-Time----- ------------Sender/Recipient----------- +## oAJEfhdW014123 5 Fri Nov 19 14:41 jwm +## (Deferred: Connection refused by [127.0.0.1]) +## root +## Total requests: 1 +## MTA Queue status... +## /var/spool/mqueue is empty +## Total requests: 0 + + my $this_msg_q = 0; while () { # match email addr on queue listing @@ -189,13 +208,18 @@ if ($mailq eq "sendmail") { # # single queue: first line # multi queue: one for each queue. overwrite on multi queue below - $msg_q = $1 ; + $this_msg_q = $1 ; + $msg_q += $1 ; } } elsif (/^\s+Total\sRequests:\s(\d+)$/i) { - print "$utils::PATH_TO_MAILQ = $_ \n" if $verbose ; - # - # multi queue: last line - $msg_q = $1 ; + if ($this_msg_q) { + $this_msg_q = 0 ; + } else { + print "$utils::PATH_TO_MAILQ = $_ \n" if $verbose ; + # + # multi queue: last line + $msg_q += $1 ; + } } } -- cgit v0.10-9-g596f From 6bbe0b7b0f609ecab831dec9be7690842bf0a0fc Mon Sep 17 00:00:00 2001 From: Stuart Henderson Date: Wed, 8 Feb 2023 16:35:22 +0000 Subject: cope with radcli-1.3.1 RC_BUFFER_LEN radcli 1.3.1 now uses RC_BUFFER_LEN instead of BUFFER_LEN. Add an #ifdef to allow working with either. diff --git a/plugins/check_radius.c b/plugins/check_radius.c index be1001b..96a9555 100644 --- a/plugins/check_radius.c +++ b/plugins/check_radius.c @@ -155,7 +155,11 @@ main (int argc, char **argv) { struct sockaddr_storage ss; char name[HOST_NAME_MAX]; +#ifdef RC_BUFFER_LEN + char msg[RC_BUFFER_LEN]; +#else char msg[BUFFER_LEN]; +#endif SEND_DATA data; int result = STATE_UNKNOWN; uint32_t client_id, service; -- cgit v0.10-9-g596f From 9898a8ad7dabfabfe80785585a5bbc30b678bdb0 Mon Sep 17 00:00:00 2001 From: Kristian Schuster <116557017+KriSchu@users.noreply.github.com> Date: Sun, 19 Feb 2023 13:44:04 +0100 Subject: utils_disk: add name_prev pointer to struct parameter_list Also added handling of name_prev in np_add_parameter and np_delete_parameter. This make calling the np_delete_parameter function easier, because it requires the previous element as second argument. diff --git a/lib/utils_disk.c b/lib/utils_disk.c index c7c9126..a1181d3 100644 --- a/lib/utils_disk.c +++ b/lib/utils_disk.c @@ -46,9 +46,10 @@ np_add_parameter(struct parameter_list **list, const char *name) struct parameter_list *current = *list; struct parameter_list *new_path; new_path = (struct parameter_list *) malloc (sizeof *new_path); - new_path->name = (char *) name; + new_path->name = (char *) malloc(strlen(name) + 1); new_path->best_match = NULL; new_path->name_next = NULL; + new_path->name_prev = NULL; new_path->freespace_bytes = NULL; new_path->freespace_units = NULL; new_path->freespace_percent = NULL; @@ -74,13 +75,17 @@ np_add_parameter(struct parameter_list **list, const char *name) new_path->dused_inodes_percent = 0; new_path->dfree_inodes_percent = 0; + strcpy(new_path->name, name); + if (current == NULL) { *list = new_path; + new_path->name_prev = NULL; } else { while (current->name_next) { current = current->name_next; } current->name_next = new_path; + new_path->name_prev = current; } return new_path; } @@ -89,6 +94,9 @@ np_add_parameter(struct parameter_list **list, const char *name) struct parameter_list * np_del_parameter(struct parameter_list *item, struct parameter_list *prev) { + if (item == NULL) { + return NULL; + } struct parameter_list *next; if (item->name_next) @@ -96,10 +104,17 @@ np_del_parameter(struct parameter_list *item, struct parameter_list *prev) else next = NULL; - free(item); + if (next) + next->name_prev = prev; + if (prev) prev->name_next = next; + if (item->name) { + free(item->name); + } + free(item); + return next; } diff --git a/lib/utils_disk.h b/lib/utils_disk.h index bf52e4c..3b5a45f 100644 --- a/lib/utils_disk.h +++ b/lib/utils_disk.h @@ -24,6 +24,7 @@ struct parameter_list char *group; struct mount_entry *best_match; struct parameter_list *name_next; + struct parameter_list *name_prev; uintmax_t total, available, available_to_root, used, inodes_free, inodes_free_to_root, inodes_used, inodes_total; double dfree_pct, dused_pct; -- cgit v0.10-9-g596f From ba78c32018658608a31c293beef89ec82b9ba9d3 Mon Sep 17 00:00:00 2001 From: Kristian Schuster <116557017+KriSchu@users.noreply.github.com> Date: Sun, 19 Feb 2023 22:49:30 +0100 Subject: check_disk: still allow check of available disks with ignore-missing param used Also add reporting of ignored paths. When paths are provided by -p and/ or -r and one path does not match a mounted disk, checking available disks is still possible. Paths provided by -p are reported as ignored, when not available. Due to code structure, this is not possible for -r unfortunately. diff --git a/plugins/check_disk.c b/plugins/check_disk.c index 8df9e7e..c1cfb13 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c @@ -117,7 +117,7 @@ enum }; #ifdef _AIX - #pragma alloca +#pragma alloca #endif int process_arguments (int, char **); @@ -127,7 +127,7 @@ int validate_arguments (uintmax_t, uintmax_t, double, double, double, double, ch void print_help (void); void print_usage (void); double calculate_percent(uintmax_t, uintmax_t); -void stat_path (struct parameter_list *p); +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); @@ -157,6 +157,7 @@ char *crit_usedinodes_percent = NULL; char *warn_freeinodes_percent = NULL; char *crit_freeinodes_percent = NULL; int path_selected = FALSE; +int path_ignored = FALSE; char *group = NULL; struct stat *stat_buf; struct name_list *seen = NULL; @@ -168,10 +169,12 @@ main (int argc, char **argv) int result = STATE_UNKNOWN; int disk_result = STATE_UNKNOWN; char *output; + char *ignored; char *details; char *perf; char *perf_ilabel; char *preamble; + char *ignored_preamble; char *flag_header; int temp_result; @@ -183,8 +186,10 @@ main (int argc, char **argv) char mountdir[32]; #endif - preamble = strdup (" - free space:"); + preamble = strdup (" free space:"); + ignored_preamble = strdup (" ignored paths:"); output = strdup (""); + ignored = strdup (""); details = strdup (""); perf = strdup (""); perf_ilabel = strdup (""); @@ -205,7 +210,7 @@ main (int argc, char **argv) /* If a list of paths has not been selected, find entire mount list and create list of paths */ - if (path_selected == FALSE) { + if (path_selected == FALSE && path_ignored == FALSE) { for (me = mount_list; me; me = me->me_next) { if (! (path = np_find_parameter(path_select_list, me->me_mountdir))) { path = np_add_parameter(&path_select_list, me->me_mountdir); @@ -215,19 +220,40 @@ main (int argc, char **argv) set_all_thresholds(path); } } - np_set_best_match(path_select_list, mount_list, exact_match); + + if (path_ignored == FALSE) { + np_set_best_match(path_select_list, mount_list, exact_match); + } /* Error if no match found for specified paths */ temp_list = path_select_list; - while (temp_list) { - if (! temp_list->best_match && ignore_missing == 1) { - die (STATE_OK, _("DISK %s: %s not found (ignoring)\n"), _("OK"), temp_list->name); - } else if (! temp_list->best_match) { - die (STATE_CRITICAL, _("DISK %s: %s not found\n"), _("CRITICAL"), temp_list->name); + while (path_select_list) { + if (! path_select_list->best_match && ignore_missing == 1) { + /* If the first element will be deleted, the temp_list must be updated with the new start address as well */ + if (path_select_list == temp_list) { + temp_list = path_select_list->name_next; + } + /* Add path argument to list of ignored paths to inform about missing paths being ignored and not alerted */ + xasprintf (&ignored, "%s %s;", ignored, path_select_list->name); + /* Delete the path from the list so that it is not stat-checked later in the code. */ + path_select_list = np_del_parameter(path_select_list, path_select_list->name_prev); + } else if (! path_select_list->best_match) { + /* Without --ignore-missing option, exit with Critical state. */ + die (STATE_CRITICAL, _("DISK %s: %s not found\n"), _("CRITICAL"), path_select_list->name); + } else { + /* Continue jumping through the list */ + path_select_list = path_select_list->name_next; } + } + + path_select_list = temp_list; - temp_list = temp_list->name_next; + if (! path_select_list && ignore_missing == 1) { + result = STATE_OK; + if (verbose >= 2) { + printf ("None of the provided paths were found\n"); + } } /* Process for every path in list */ @@ -246,6 +272,10 @@ main (int argc, char **argv) me = path->best_match; + if (!me) { + continue; + } + #ifdef __CYGWIN__ if (strncmp(path->name, "/cygdrive/", 10) != 0 || strlen(path->name) > 11) continue; @@ -264,8 +294,12 @@ main (int argc, char **argv) if (path->group == NULL) { /* Skip remote filesystems if we're not interested in them */ if (me->me_remote && show_local_fs) { - if (stat_remote_fs) - stat_path(path); + if (stat_remote_fs) { + if (!stat_path(path) && ignore_missing == 1) { + result = STATE_OK; + xasprintf (&ignored, "%s %s;", ignored, path->name); + } + } continue; /* Skip pseudo fs's if we haven't asked for all fs's */ } else if (me->me_dummy && !show_all_fs) { @@ -284,7 +318,13 @@ main (int argc, char **argv) } } - stat_path(path); + if (!stat_path(path)) { + if (ignore_missing == 1) { + result = STATE_OK; + xasprintf (&ignored, "%s %s;", ignored, path->name); + } + continue; + } get_fs_usage (me->me_mountdir, me->me_devname, &fsp); if (fsp.fsu_blocks && strcmp ("none", me->me_mountdir)) { @@ -415,8 +455,12 @@ main (int argc, char **argv) if (verbose >= 2) xasprintf (&output, "%s%s", output, details); + if (strcmp(output, "") == 0) { + preamble = ""; + xasprintf (&output, " No disks were found for provided parameters;"); + } - printf ("DISK %s%s%s|%s\n", state_text (result), (erronly && result==STATE_OK) ? "" : preamble, output, perf); + printf ("DISK %s -%s%s%s%s|%s\n", state_text (result), ((erronly && result==STATE_OK)) ? "" : preamble, output, (strcmp(ignored, "") == 0) ? "" : ignored_preamble, ignored, perf); return result; } @@ -637,12 +681,19 @@ process_arguments (int argc, char **argv) /* add parameter if not found. overwrite thresholds if path has already been added */ if (! (se = np_find_parameter(path_select_list, optarg))) { se = np_add_parameter(&path_select_list, optarg); + + if (stat(optarg, &stat_buf[0]) && ignore_missing == 1) { + path_ignored = TRUE; + break; + } } se->group = group; set_all_thresholds(se); /* With autofs, it is required to stat() the path before re-populating the mount_list */ - stat_path(se); + if (!stat_path(se)) { + break; + } /* NB: We can't free the old mount_list "just like that": both list pointers and struct * pointers are copied around. One of the reason it wasn't done yet is that other parts * of check_disk need the same kind of cleanup so it'd better be done as a whole */ @@ -761,10 +812,11 @@ process_arguments (int argc, char **argv) } } - if (!fnd && ignore_missing == 1) - die (STATE_OK, "DISK %s: %s - %s\n",_("OK"), - _("Regular expression did not match any path or disk (ignoring)"), optarg); - else if (!fnd) + if (!fnd && ignore_missing == 1) { + path_ignored = TRUE; + /* path_selected = TRUE;*/ + break; + } else if (!fnd) die (STATE_UNKNOWN, "DISK %s: %s - %s\n",_("UNKNOWN"), _("Regular expression did not match any path or disk"), optarg); @@ -936,7 +988,7 @@ print_help (void) printf (" %s\n", _("Regular expression to ignore selected path or partition (may be repeated)")); printf (" %s\n", "--ignore-missing"); printf (" %s\n", _("Return OK if no filesystem matches, filesystem does not exist or is inaccessible.")); - printf (" %s\n", _("(Provide this option before -r / --ereg-path if used)")); + printf (" %s\n", _("(Provide this option before -p / -r / --ereg-path if used)")); printf (UT_PLUG_TIMEOUT, DEFAULT_SOCKET_TIMEOUT); printf (" %s\n", "-u, --units=STRING"); printf (" %s\n", _("Choose bytes, kB, MB, GB, TB (default: MB)")); @@ -970,7 +1022,7 @@ print_usage (void) printf ("[-t timeout] [-u unit] [-v] [-X type] [-N type]\n"); } -void +bool stat_path (struct parameter_list *p) { /* Stat entry to check that dir exists and is accessible */ @@ -980,13 +1032,13 @@ stat_path (struct parameter_list *p) if (verbose >= 3) printf("stat failed on %s\n", p->name); if (ignore_missing == 1) { - printf("DISK %s - ", _("OK")); - die (STATE_OK, _("%s %s: %s\n"), p->name, _("is not accessible (ignoring)"), strerror(errno)); + return false; } else { printf("DISK %s - ", _("CRITICAL")); die (STATE_CRITICAL, _("%s %s: %s\n"), p->name, _("is not accessible"), strerror(errno)); } } + return true; } @@ -1006,7 +1058,8 @@ get_stats (struct parameter_list *p, struct fs_usage *fsp) { continue; #endif if (p_list->group && ! (strcmp(p_list->group, p->group))) { - stat_path(p_list); + if (! stat_path(p_list)) + continue; get_fs_usage (p_list->best_match->me_mountdir, p_list->best_match->me_devname, &tmpfsp); get_path_stats(p_list, &tmpfsp); if (verbose >= 3) -- cgit v0.10-9-g596f From ca3d59cd6918c9e2739e783b721d4c1122640fd3 Mon Sep 17 00:00:00 2001 From: Kristian Schuster <116557017+KriSchu@users.noreply.github.com> Date: Sun, 19 Feb 2023 23:00:21 +0100 Subject: check_disk: add new tests for new ignore-missing feature diff --git a/plugins/t/check_disk.t b/plugins/t/check_disk.t index a534fd4..275db70 100644 --- a/plugins/t/check_disk.t +++ b/plugins/t/check_disk.t @@ -23,7 +23,7 @@ my $mountpoint2_valid = getTestParameter( "NP_MOUNTPOINT2_VALID", "Path to anoth if ($mountpoint_valid eq "" or $mountpoint2_valid eq "") { plan skip_all => "Need 2 mountpoints to test"; } else { - plan tests => 84; + plan tests => 86; } $result = NPTest->testCmd( @@ -355,14 +355,24 @@ like( $result->output, qr/$mountpoint2_valid/,"ignore: output data does have $mo # ignore-missing: exit okay, when fs is not accessible $result = NPTest->testCmd( "./check_disk --ignore-missing -w 0% -c 0% -p /bob"); cmp_ok( $result->return_code, '==', 0, "ignore-missing: return okay for not existing filesystem /bob"); -like( $result->output, '/^DISK OK - /bob is not accessible .*$/', 'Output OK'); +like( $result->output, '/^DISK OK - No disks were found for provided parameters; ignored paths: /bob;.*$/', 'Output OK'); # ignore-missing: exit okay, when regex does not match $result = NPTest->testCmd( "./check_disk --ignore-missing -w 0% -c 0% -r /bob"); cmp_ok( $result->return_code, '==', 0, "ignore-missing: return okay for regular expression not matching"); -like( $result->output, '/^DISK OK: Regular expression did not match any path or disk.*$/', 'Output OK'); +like( $result->output, '/^DISK OK - No disks were found for provided parameters;.*$/', 'Output OK'); # ignore-missing: exit okay, when fs with exact match (-E) is not found -$result = NPTest->testCmd( "./check_disk --ignore-missing -E -w 0% -c 0% -p /etc"); +$result = NPTest->testCmd( "./check_disk --ignore-missing -w 0% -c 0% -E -p /etc"); cmp_ok( $result->return_code, '==', 0, "ignore-missing: return okay when exact match does not find fs"); -like( $result->output, '/^DISK OK: /etc not found.*$/', 'Output OK'); +like( $result->output, '/^DISK OK - No disks were found for provided parameters; ignored paths: /etc;.*$/', 'Output OK'); + +# ignore-missing: exit okay, when checking one existing fs and one non-existing fs (regex) +$result = NPTest->testCmd( "./check_disk --ignore-missing -w 0% -c 0% -r '/bob' -r '^/$'"); +cmp_ok( $result->return_code, '==', 0, "ignore-missing: return okay for regular expression not matching"); +like( $result->output, '/^DISK OK - free space: / .*$/', 'Output OK'); + +# ignore-missing: exit okay, when checking one existing fs and one non-existing fs (path) +$result = NPTest->testCmd( "./check_disk --ignore-missing -w 0% -c 0% -p '/bob' -p '/'"); +cmp_ok( $result->return_code, '==', 0, "ignore-missing: return okay for regular expression not matching"); +like( $result->output, '/^DISK OK - free space: / .*; ignored paths: /bob;.*$/', 'Output OK'); \ No newline at end of file -- cgit v0.10-9-g596f From a58293a0c288ee0e050c79715073da9fbdfc4c58 Mon Sep 17 00:00:00 2001 From: Kristian Schuster <116557017+KriSchu@users.noreply.github.com> Date: Mon, 20 Feb 2023 01:27:23 +0100 Subject: check_disk: fix tests by setting correct test number and escaping line end regex diff --git a/plugins/t/check_disk.t b/plugins/t/check_disk.t index 275db70..73f1e37 100644 --- a/plugins/t/check_disk.t +++ b/plugins/t/check_disk.t @@ -23,7 +23,7 @@ my $mountpoint2_valid = getTestParameter( "NP_MOUNTPOINT2_VALID", "Path to anoth if ($mountpoint_valid eq "" or $mountpoint2_valid eq "") { plan skip_all => "Need 2 mountpoints to test"; } else { - plan tests => 86; + plan tests => 88; } $result = NPTest->testCmd( @@ -126,7 +126,7 @@ my $free_mb_on_all = $free_mb_on_mp1 + $free_mb_on_mp2; $result = NPTest->testCmd( "./check_disk -e -w 1 -c 1 -p $more_free" ); -is( $result->only_output, "DISK OK", "No print out of disks with -e for OKs"); +is( $result->only_output, "DISK OK - No disks were found for provided parameters;", "No print out of disks with -e for OKs"); $result = NPTest->testCmd( "./check_disk 100 100 $more_free" ); cmp_ok( $result->return_code, '==', 0, "Old syntax okay" ); @@ -368,9 +368,9 @@ cmp_ok( $result->return_code, '==', 0, "ignore-missing: return okay when exact m like( $result->output, '/^DISK OK - No disks were found for provided parameters; ignored paths: /etc;.*$/', 'Output OK'); # ignore-missing: exit okay, when checking one existing fs and one non-existing fs (regex) -$result = NPTest->testCmd( "./check_disk --ignore-missing -w 0% -c 0% -r '/bob' -r '^/$'"); +$result = NPTest->testCmd( "./check_disk --ignore-missing -w 0% -c 0% -r '/bob' -r '^/\$'"); cmp_ok( $result->return_code, '==', 0, "ignore-missing: return okay for regular expression not matching"); -like( $result->output, '/^DISK OK - free space: / .*$/', 'Output OK'); +like( $result->output, '/^DISK OK - free space: \/ .*$/', 'Output OK'); # ignore-missing: exit okay, when checking one existing fs and one non-existing fs (path) $result = NPTest->testCmd( "./check_disk --ignore-missing -w 0% -c 0% -p '/bob' -p '/'"); -- cgit v0.10-9-g596f From e102b8a49e857a474db516455d2e871e6834ae34 Mon Sep 17 00:00:00 2001 From: Kristian Schuster <116557017+KriSchu@users.noreply.github.com> Date: Mon, 20 Feb 2023 02:03:01 +0100 Subject: check_disk: fix ugly output with -e option and adapt tests accordingly diff --git a/plugins/check_disk.c b/plugins/check_disk.c index d32841d..c52d1df 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c @@ -186,8 +186,8 @@ main (int argc, char **argv) char mountdir[32]; #endif - preamble = strdup (" free space:"); - ignored_preamble = strdup (" ignored paths:"); + preamble = strdup (" - free space:"); + ignored_preamble = strdup (" - ignored paths:"); output = strdup (""); ignored = strdup (""); details = strdup (""); @@ -455,12 +455,12 @@ main (int argc, char **argv) if (verbose >= 2) xasprintf (&output, "%s%s", output, details); - if (strcmp(output, "") == 0) { + if (strcmp(output, "") == 0 && ! erronly) { preamble = ""; - xasprintf (&output, " No disks were found for provided parameters;"); + xasprintf (&output, " - No disks were found for provided parameters;"); } - printf ("DISK %s -%s%s%s%s|%s\n", state_text (result), ((erronly && result==STATE_OK)) ? "" : preamble, output, (strcmp(ignored, "") == 0) ? "" : ignored_preamble, ignored, perf); + printf ("DISK %s%s%s%s%s|%s\n", state_text (result), ((erronly && result==STATE_OK)) ? "" : preamble, output, (strcmp(ignored, "") == 0) ? "" : ignored_preamble, ignored, perf); return result; } diff --git a/plugins/t/check_disk.t b/plugins/t/check_disk.t index 73f1e37..c8f08f5 100644 --- a/plugins/t/check_disk.t +++ b/plugins/t/check_disk.t @@ -126,7 +126,7 @@ my $free_mb_on_all = $free_mb_on_mp1 + $free_mb_on_mp2; $result = NPTest->testCmd( "./check_disk -e -w 1 -c 1 -p $more_free" ); -is( $result->only_output, "DISK OK - No disks were found for provided parameters;", "No print out of disks with -e for OKs"); +is( $result->only_output, "DISK OK", "No print out of disks with -e for OKs"); $result = NPTest->testCmd( "./check_disk 100 100 $more_free" ); cmp_ok( $result->return_code, '==', 0, "Old syntax okay" ); @@ -355,7 +355,7 @@ like( $result->output, qr/$mountpoint2_valid/,"ignore: output data does have $mo # ignore-missing: exit okay, when fs is not accessible $result = NPTest->testCmd( "./check_disk --ignore-missing -w 0% -c 0% -p /bob"); cmp_ok( $result->return_code, '==', 0, "ignore-missing: return okay for not existing filesystem /bob"); -like( $result->output, '/^DISK OK - No disks were found for provided parameters; ignored paths: /bob;.*$/', 'Output OK'); +like( $result->output, '/^DISK OK - No disks were found for provided parameters; - ignored paths: /bob;.*$/', 'Output OK'); # ignore-missing: exit okay, when regex does not match $result = NPTest->testCmd( "./check_disk --ignore-missing -w 0% -c 0% -r /bob"); @@ -365,7 +365,7 @@ like( $result->output, '/^DISK OK - No disks were found for provided parameters; # ignore-missing: exit okay, when fs with exact match (-E) is not found $result = NPTest->testCmd( "./check_disk --ignore-missing -w 0% -c 0% -E -p /etc"); cmp_ok( $result->return_code, '==', 0, "ignore-missing: return okay when exact match does not find fs"); -like( $result->output, '/^DISK OK - No disks were found for provided parameters; ignored paths: /etc;.*$/', 'Output OK'); +like( $result->output, '/^DISK OK - No disks were found for provided parameters; - ignored paths: /etc;.*$/', 'Output OK'); # ignore-missing: exit okay, when checking one existing fs and one non-existing fs (regex) $result = NPTest->testCmd( "./check_disk --ignore-missing -w 0% -c 0% -r '/bob' -r '^/\$'"); @@ -375,4 +375,4 @@ like( $result->output, '/^DISK OK - free space: \/ .*$/', 'Output OK'); # ignore-missing: exit okay, when checking one existing fs and one non-existing fs (path) $result = NPTest->testCmd( "./check_disk --ignore-missing -w 0% -c 0% -p '/bob' -p '/'"); cmp_ok( $result->return_code, '==', 0, "ignore-missing: return okay for regular expression not matching"); -like( $result->output, '/^DISK OK - free space: / .*; ignored paths: /bob;.*$/', 'Output OK'); \ No newline at end of file +like( $result->output, '/^DISK OK - free space: / .*; - ignored paths: /bob;.*$/', 'Output OK'); \ No newline at end of file -- cgit v0.10-9-g596f From 3e7da5f970d73df91fad32f4dce259d30cdbbd65 Mon Sep 17 00:00:00 2001 From: Kristian Schuster <116557017+KriSchu@users.noreply.github.com> Date: Mon, 6 Mar 2023 14:03:10 +0100 Subject: check_disk: use cleaner code for ignore-missing option - use datatype bool for new vars ignore_missing and path_ignored instead of int - directly initialize preamble and ignored_preamble with their strings diff --git a/plugins/check_disk.c b/plugins/check_disk.c index c52d1df..bd84c82 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c @@ -141,7 +141,7 @@ int verbose = 0; int erronly = FALSE; int display_mntp = FALSE; int exact_match = FALSE; -int ignore_missing = FALSE; +bool ignore_missing = false; int freespace_ignore_reserved = FALSE; int display_inodes_perfdata = FALSE; char *warn_freespace_units = NULL; @@ -157,7 +157,7 @@ char *crit_usedinodes_percent = NULL; char *warn_freeinodes_percent = NULL; char *crit_freeinodes_percent = NULL; int path_selected = FALSE; -int path_ignored = FALSE; +bool path_ignored = false; char *group = NULL; struct stat *stat_buf; struct name_list *seen = NULL; @@ -173,8 +173,8 @@ main (int argc, char **argv) char *details; char *perf; char *perf_ilabel; - char *preamble; - char *ignored_preamble; + char *preamble = " - free space:"; + char *ignored_preamble = " - ignored paths:"; char *flag_header; int temp_result; @@ -186,8 +186,6 @@ main (int argc, char **argv) char mountdir[32]; #endif - preamble = strdup (" - free space:"); - ignored_preamble = strdup (" - ignored paths:"); output = strdup (""); ignored = strdup (""); details = strdup (""); @@ -210,7 +208,7 @@ main (int argc, char **argv) /* If a list of paths has not been selected, find entire mount list and create list of paths */ - if (path_selected == FALSE && path_ignored == FALSE) { + if (path_selected == FALSE && path_ignored == false) { for (me = mount_list; me; me = me->me_next) { if (! (path = np_find_parameter(path_select_list, me->me_mountdir))) { path = np_add_parameter(&path_select_list, me->me_mountdir); @@ -221,7 +219,7 @@ main (int argc, char **argv) } } - if (path_ignored == FALSE) { + if (path_ignored == false) { np_set_best_match(path_select_list, mount_list, exact_match); } @@ -229,7 +227,7 @@ main (int argc, char **argv) temp_list = path_select_list; while (path_select_list) { - if (! path_select_list->best_match && ignore_missing == 1) { + if (! path_select_list->best_match && ignore_missing == true) { /* If the first element will be deleted, the temp_list must be updated with the new start address as well */ if (path_select_list == temp_list) { temp_list = path_select_list->name_next; @@ -249,7 +247,7 @@ main (int argc, char **argv) path_select_list = temp_list; - if (! path_select_list && ignore_missing == 1) { + if (! path_select_list && ignore_missing == true) { result = STATE_OK; if (verbose >= 2) { printf ("None of the provided paths were found\n"); @@ -295,7 +293,7 @@ main (int argc, char **argv) /* Skip remote filesystems if we're not interested in them */ if (me->me_remote && show_local_fs) { if (stat_remote_fs) { - if (!stat_path(path) && ignore_missing == 1) { + if (!stat_path(path) && ignore_missing == true) { result = STATE_OK; xasprintf (&ignored, "%s %s;", ignored, path->name); } @@ -319,7 +317,7 @@ main (int argc, char **argv) } if (!stat_path(path)) { - if (ignore_missing == 1) { + if (ignore_missing == true) { result = STATE_OK; xasprintf (&ignored, "%s %s;", ignored, path->name); } @@ -682,8 +680,8 @@ process_arguments (int argc, char **argv) if (! (se = np_find_parameter(path_select_list, optarg))) { se = np_add_parameter(&path_select_list, optarg); - if (stat(optarg, &stat_buf[0]) && ignore_missing == 1) { - path_ignored = TRUE; + if (stat(optarg, &stat_buf[0]) && ignore_missing == true) { + path_ignored = true; break; } } @@ -775,7 +773,7 @@ process_arguments (int argc, char **argv) break; case IGNORE_MISSING: - ignore_missing = 1; + ignore_missing = true; break; case 'A': optarg = strdup(".*"); @@ -812,8 +810,8 @@ process_arguments (int argc, char **argv) } } - if (!fnd && ignore_missing == 1) { - path_ignored = TRUE; + if (!fnd && ignore_missing == true) { + path_ignored = true; /* path_selected = TRUE;*/ break; } else if (!fnd) @@ -1031,7 +1029,7 @@ stat_path (struct parameter_list *p) if (stat (p->name, &stat_buf[0])) { if (verbose >= 3) printf("stat failed on %s\n", p->name); - if (ignore_missing == 1) { + if (ignore_missing == true) { return false; } else { printf("DISK %s - ", _("CRITICAL")); -- cgit v0.10-9-g596f From 03f86b5d0809967855fbaafb4d600dc5b82081fa Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Tue, 7 Mar 2023 19:51:33 +0100 Subject: check_curl: in SSL host caching mode try to connect and bind and take the first getaddrinfo result which succeeds diff --git a/plugins/check_curl.c b/plugins/check_curl.c index c37d45d..e1bc98d 100644 --- a/plugins/check_curl.c +++ b/plugins/check_curl.c @@ -386,6 +386,7 @@ lookup_host (const char *host, char *buf, size_t buflen) struct addrinfo hints, *res, *result; int errcode; void *ptr; + int s; memset (&hints, 0, sizeof (hints)); hints.ai_family = address_family; @@ -399,19 +400,26 @@ lookup_host (const char *host, char *buf, size_t buflen) res = result; while (res) { - inet_ntop (res->ai_family, res->ai_addr->sa_data, buf, buflen); - switch (res->ai_family) { - case AF_INET: - ptr = &((struct sockaddr_in *) res->ai_addr)->sin_addr; + inet_ntop (res->ai_family, res->ai_addr->sa_data, buf, buflen); + switch (res->ai_family) { + case AF_INET: + ptr = &((struct sockaddr_in *) res->ai_addr)->sin_addr; + break; + case AF_INET6: + ptr = &((struct sockaddr_in6 *) res->ai_addr)->sin6_addr; break; - case AF_INET6: - ptr = &((struct sockaddr_in6 *) res->ai_addr)->sin6_addr; - break; } + inet_ntop (res->ai_family, ptr, buf, buflen); if (verbose >= 1) printf ("* getaddrinfo IPv%d address: %s\n", res->ai_family == PF_INET6 ? 6 : 4, buf); + + if (s = socket (res->ai_family, res->ai_socktype, res->ai_protocol) == -1) + continue; + if (bind (s, res->ai_addr, res->ai_addrlen == 0) ) + break; + res = res->ai_next; } -- cgit v0.10-9-g596f From 2902381c5de01f69d61569b0c8dae6a92e2b9843 Mon Sep 17 00:00:00 2001 From: Barak Shohat Date: Wed, 8 Mar 2023 11:56:43 +0200 Subject: check_curl.c: Include all IPs from getaddrinfo() in curl DNS cache diff --git a/plugins/check_curl.c b/plugins/check_curl.c index e1bc98d..512fb88 100644 --- a/plugins/check_curl.c +++ b/plugins/check_curl.c @@ -384,9 +384,12 @@ int lookup_host (const char *host, char *buf, size_t buflen) { struct addrinfo hints, *res, *result; + char addrstr[100]; + size_t addrstr_len; int errcode; void *ptr; int s; + size_t buflen_remaining = buflen - 1; memset (&hints, 0, sizeof (hints)); hints.ai_family = address_family; @@ -396,33 +399,40 @@ lookup_host (const char *host, char *buf, size_t buflen) errcode = getaddrinfo (host, NULL, &hints, &result); if (errcode != 0) return errcode; - + + strcpy(buf, ""); res = result; while (res) { - inet_ntop (res->ai_family, res->ai_addr->sa_data, buf, buflen); switch (res->ai_family) { case AF_INET: ptr = &((struct sockaddr_in *) res->ai_addr)->sin_addr; break; case AF_INET6: ptr = &((struct sockaddr_in6 *) res->ai_addr)->sin6_addr; - break; + break; } - inet_ntop (res->ai_family, ptr, buf, buflen); - if (verbose >= 1) + inet_ntop (res->ai_family, ptr, addrstr, 100); + if (verbose >= 1) { printf ("* getaddrinfo IPv%d address: %s\n", - res->ai_family == PF_INET6 ? 6 : 4, buf); + res->ai_family == PF_INET6 ? 6 : 4, addrstr); + } - if (s = socket (res->ai_family, res->ai_socktype, res->ai_protocol) == -1) - continue; - if (bind (s, res->ai_addr, res->ai_addrlen == 0) ) - break; + // Append all IPs to buf as a comma-separated string + addrstr_len = strlen(addrstr); + if (buflen_remaining > addrstr_len + 1) { + if (buf[0] != NULL) { + strncat(buf, ",", 1); + buflen_remaining -= 1; + } + strncat(buf, addrstr, buflen_remaining); + buflen_remaining -= addrstr_len; + } res = res->ai_next; } - + freeaddrinfo(result); return 0; @@ -453,7 +463,7 @@ check_http (void) int i; char *force_host_header = NULL; struct curl_slist *host = NULL; - char addrstr[100]; + char addrstr[DEFAULT_BUFFER_SIZE/2]; char dnscache[DEFAULT_BUFFER_SIZE]; /* initialize curl */ @@ -505,7 +515,7 @@ check_http (void) // fill dns resolve cache to make curl connect to the given server_address instead of the host_name, only required for ssl, because we use the host_name later on to make SNI happy if(use_ssl && host_name != NULL) { - if ( (res=lookup_host (server_address, addrstr, 100)) != 0) { + if ( (res=lookup_host (server_address, addrstr, DEFAULT_BUFFER_SIZE/2)) != 0) { snprintf (msg, DEFAULT_BUFFER_SIZE, _("Unable to lookup IP address for '%s': getaddrinfo returned %d - %s"), server_address, res, gai_strerror (res)); die (STATE_CRITICAL, "HTTP CRITICAL - %s\n", msg); @@ -800,6 +810,9 @@ check_http (void) /* free header and server IP resolve lists, we don't need it anymore */ curl_slist_free_all (header_list); header_list = NULL; curl_slist_free_all (server_ips); server_ips = NULL; + if (host) { + curl_slist_free_all (host); host = NULL; + } /* Curl errors, result in critical Nagios state */ if (res != CURLE_OK) { -- cgit v0.10-9-g596f From fc927e98db73850e760f490117ed36f2de20270c Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Wed, 8 Mar 2023 16:10:45 +0100 Subject: fixed a wrong compare and a wrong size in strncat diff --git a/plugins/check_curl.c b/plugins/check_curl.c index 512fb88..cc17ef5 100644 --- a/plugins/check_curl.c +++ b/plugins/check_curl.c @@ -422,8 +422,8 @@ lookup_host (const char *host, char *buf, size_t buflen) // Append all IPs to buf as a comma-separated string addrstr_len = strlen(addrstr); if (buflen_remaining > addrstr_len + 1) { - if (buf[0] != NULL) { - strncat(buf, ",", 1); + if (buf[0] != '\0') { + strncat(buf, ",", buflen_remaining); buflen_remaining -= 1; } strncat(buf, addrstr, buflen_remaining); -- cgit v0.10-9-g596f From ea53555f2d6254da5fec0c1061899a01dd5321ec Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sat, 11 Mar 2023 11:40:00 +0100 Subject: check_curl: removed a superflous variable diff --git a/plugins/check_curl.c b/plugins/check_curl.c index cc17ef5..e5be1ad 100644 --- a/plugins/check_curl.c +++ b/plugins/check_curl.c @@ -388,7 +388,6 @@ lookup_host (const char *host, char *buf, size_t buflen) size_t addrstr_len; int errcode; void *ptr; - int s; size_t buflen_remaining = buflen - 1; memset (&hints, 0, sizeof (hints)); -- cgit v0.10-9-g596f From c874f950e8e5b6a805d8adf759d521501b22c7ce Mon Sep 17 00:00:00 2001 From: Sven Nierlein Date: Wed, 15 Mar 2023 09:51:18 +0100 Subject: check_snmp: disable multiplier when unused - if no multiplier is set, simply return the given string. Otherwise we would strip off the unit. - if used, allocate new space to hold the result which might be larger than the initial input Signed-off-by: Sven Nierlein diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index d3968a2..c4ddd0e 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c @@ -46,6 +46,7 @@ const char *email = "devel@monitoring-plugins.org"; #define DEFAULT_PRIV_PROTOCOL "DES" #define DEFAULT_DELIMITER "=" #define DEFAULT_OUTPUT_DELIMITER " " +#define DEFAULT_BUFFER_SIZE 100 #define mark(a) ((a)!=0?"*":"") @@ -157,6 +158,7 @@ int perf_labels = 1; char* ip_version = ""; double multiplier = 1.0; char *fmtstr = ""; +char buffer[DEFAULT_BUFFER_SIZE]; static char *fix_snmp_range(char *th) { @@ -1169,6 +1171,9 @@ multiply (char *str) double val; char *conv = "%f"; + if(multiplier == 1) + return(str); + if(verbose>2) printf(" multiply input: %s\n", str); @@ -1187,15 +1192,15 @@ multiply (char *str) conv = fmtstr; } if (val == (int)val) { - sprintf(str, "%.0f", val); + snprintf(buffer, DEFAULT_BUFFER_SIZE, "%.0f", val); } else { if(verbose>2) printf(" multiply using format: %s\n", conv); - sprintf(str, conv, val); + snprintf(buffer, DEFAULT_BUFFER_SIZE, conv, val); } if(verbose>2) - printf(" multiply result: %s\n", str); - return str; + printf(" multiply result: %s\n", buffer); + return buffer; } -- cgit v0.10-9-g596f From c668f5303522b39466da3e86fecc255474276ac2 Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Wed, 15 Mar 2023 18:16:04 +0100 Subject: Actually build check_mssql too diff --git a/plugins-scripts/Makefile.am b/plugins-scripts/Makefile.am index 088a445..7879791 100644 --- a/plugins-scripts/Makefile.am +++ b/plugins-scripts/Makefile.am @@ -16,13 +16,13 @@ VPATH=$(top_srcdir) $(top_srcdir)/plugins-scripts $(top_srcdir)/plugins-scripts/ libexec_SCRIPTS = check_breeze check_disk_smb check_flexlm check_ircd \ check_log check_oracle check_rpc check_sensors check_wave \ check_ifstatus check_ifoperstatus check_mailq check_file_age \ - check_uptime \ + check_uptime check_mssql \ utils.sh utils.pm EXTRA_DIST=check_breeze.pl check_disk_smb.pl check_flexlm.pl check_ircd.pl \ check_log.sh check_oracle.sh check_rpc.pl check_sensors.sh \ check_ifstatus.pl check_ifoperstatus.pl check_wave.pl check_mailq.pl check_file_age.pl \ - check_uptime.pl \ + check_uptime.pl check_mssql.pl \ utils.sh.in utils.pm.in t EDIT = sed \ -- cgit v0.10-9-g596f From 8a8ee58e8925019b7532e7d14ebe488bb21fb3e6 Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Thu, 16 Mar 2023 15:26:52 +0100 Subject: check_swap: Remove unnecessary and problematic includes diff --git a/plugins/check_swap.c b/plugins/check_swap.c index a607da1..25d5f21 100644 --- a/plugins/check_swap.c +++ b/plugins/check_swap.c @@ -34,9 +34,6 @@ const char *email = "devel@monitoring-plugins.org"; #include "common.h" #include "popen.h" #include "utils.h" -#include -#include -#include #ifdef HAVE_DECL_SWAPCTL # ifdef HAVE_SYS_PARAM_H -- cgit v0.10-9-g596f From cf90f0de7b3c347a6860b50de6a610bd7132668c Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Thu, 16 Mar 2023 16:21:46 +0100 Subject: check_curk: including netinet/in.h (for FreeBSD), fixed an ambigous compare warning diff --git a/plugins/check_curl.c b/plugins/check_curl.c index e5be1ad..c51914a 100644 --- a/plugins/check_curl.c +++ b/plugins/check_curl.c @@ -55,6 +55,7 @@ const char *email = "devel@monitoring-plugins.org"; #include "uriparser/Uri.h" #include +#include #if defined(HAVE_SSL) && defined(USE_OPENSSL) #include @@ -541,7 +542,7 @@ check_http (void) /* compose URL: use the address we want to connect to, set Host: header later */ snprintf (url, DEFAULT_BUFFER_SIZE, "%s://%s:%d%s", use_ssl ? "https" : "http", - use_ssl & host_name != NULL ? host_name : server_address, + ( use_ssl & ( host_name != NULL ) ) ? host_name : server_address, server_port, server_url ); -- cgit v0.10-9-g596f From 9c495e2aefedca270f49987dc31bff983e614281 Mon Sep 17 00:00:00 2001 From: Christian Kujau Date: Mon, 20 Mar 2023 11:35:01 +0100 Subject: check_procs: Implement --exclude-process to exclude specific processes. Signed-off-by: Christian Kujau diff --git a/plugins/check_procs.c b/plugins/check_procs.c index a025ee8..d672dd4 100644 --- a/plugins/check_procs.c +++ b/plugins/check_procs.c @@ -70,6 +70,7 @@ int options = 0; /* bitmask of filter criteria to test against */ #define PCPU 256 #define ELAPSED 512 #define EREG_ARGS 1024 +#define EXCLUDE_PROGS 2048 #define KTHREAD_PARENT "kthreadd" /* the parent process of kernel threads: ppid of procs are compared to pid of this proc*/ @@ -93,6 +94,9 @@ int rss; float pcpu; char *statopts; char *prog; +char *exclude_progs; +char **exclude_progs_arr = NULL; +char exclude_progs_counter = 0; char *args; char *input_filename = NULL; regex_t re_args; @@ -250,6 +254,25 @@ main (int argc, char **argv) continue; } + /* Ignore excluded processes by name */ + if(options & EXCLUDE_PROGS) { + int found = 0; + int i = 0; + + for(i=0; i < (exclude_progs_counter); i++) { + if(!strcmp(procprog, exclude_progs_arr[i])) { + found = 1; + } + } + if(found == 0) { + resultsum |= EXCLUDE_PROGS; + } else + { + if(verbose >= 3) + printf("excluding - by ignorelist\n"); + } + } + /* filter kernel threads (childs of KTHREAD_PARENT)*/ /* TODO adapt for other OSes than GNU/Linux sorry for not doing that, but I've no other OSes to test :-( */ @@ -409,6 +432,7 @@ process_arguments (int argc, char **argv) {"input-file", required_argument, 0, CHAR_MAX+2}, {"no-kthreads", required_argument, 0, 'k'}, {"traditional-filter", no_argument, 0, 'T'}, + {"exclude-process", required_argument, 0, 'X'}, {0, 0, 0, 0} }; @@ -417,7 +441,7 @@ process_arguments (int argc, char **argv) strcpy (argv[c], "-t"); while (1) { - c = getopt_long (argc, argv, "Vvhkt:c:w:p:s:u:C:a:z:r:m:P:T", + c = getopt_long (argc, argv, "Vvhkt:c:w:p:s:u:C:a:z:r:m:P:T:X:", longopts, &option); if (c == -1 || c == EOF) @@ -490,6 +514,23 @@ process_arguments (int argc, char **argv) prog); options |= PROG; break; + case 'X': + if(exclude_progs) + break; + else + exclude_progs = optarg; + xasprintf (&fmt, _("%s%sexclude progs '%s'"), (fmt ? fmt : ""), (options ? ", " : ""), + exclude_progs); + char *p = strtok(exclude_progs, ","); + + while(p){ + exclude_progs_arr = realloc(exclude_progs_arr, sizeof(char*) * ++exclude_progs_counter); + exclude_progs_arr[exclude_progs_counter-1] = p; + p = strtok(NULL, ","); + } + + options |= EXCLUDE_PROGS; + break; case 'a': /* args (full path name with args) */ /* TODO: allow this to be passed in with --metric */ if (args) @@ -745,6 +786,8 @@ print_help (void) printf (" %s\n", _("Only scan for processes with args that contain the regex STRING.")); printf (" %s\n", "-C, --command=COMMAND"); printf (" %s\n", _("Only scan for exact matches of COMMAND (without path).")); + printf (" %s\n", "-X, --exclude-process"); + printf (" %s\n", _("Exclude processes which match this comma seperated list")); printf (" %s\n", "-k, --no-kthreads"); printf (" %s\n", _("Only scan for non kernel threads (works on Linux only).")); @@ -786,5 +829,5 @@ print_usage (void) printf ("%s\n", _("Usage:")); printf ("%s -w -c [-m metric] [-s state] [-p ppid]\n", progname); printf (" [-u user] [-r rss] [-z vsz] [-P %%cpu] [-a argument-array]\n"); - printf (" [-C command] [-k] [-t timeout] [-v]\n"); + printf (" [-C command] [-X process_to_exclude] [-k] [-t timeout] [-v]\n"); } -- cgit v0.10-9-g596f From 3e3e225b3f962993a6139bf5a2c22009b9e9cd32 Mon Sep 17 00:00:00 2001 From: Christian Kujau Date: Tue, 21 Mar 2023 11:26:03 +0100 Subject: check_procs: add a test for the newly added -X option. $ make test [...] perl -I .. -I .. ../test.pl No application (check_curl) found for test harness (check_curl.t) No application (check_snmp) found for test harness (check_snmp.t) ./t/check_procs.t ...... ok ./tests/check_nt.t ..... ok ./tests/check_procs.t .. ok All tests successful. Files=4, Tests=73, 8 wallclock secs ( 0.05 usr 0.02 sys + 0.38 cusr 0.22 csys = 0.67 CPU) Result: PASS Signed-off-by: Christian Kujau diff --git a/plugins/tests/check_procs.t b/plugins/tests/check_procs.t index 3af218f..b3a0a30 100755 --- a/plugins/tests/check_procs.t +++ b/plugins/tests/check_procs.t @@ -8,7 +8,7 @@ use Test::More; use NPTest; if (-x "./check_procs") { - plan tests => 52; + plan tests => 54; } else { plan skip_all => "No check_procs compiled"; } @@ -34,9 +34,13 @@ is( $result->return_code, 0, "Checking no threshold breeched" ); is( $result->output, "PROCS OK: 95 processes | procs=95;100;200;0;", "Output correct" ); $result = NPTest->testCmd( "$command -C launchd -c 5" ); -is( $result->return_code, 2, "Checking processes filtered by command name" ); +is( $result->return_code, 2, "Checking processes matched by command name" ); is( $result->output, "PROCS CRITICAL: 6 processes with command name 'launchd' | procs=6;;5;0;", "Output correct" ); +$result = NPTest->testCmd( "$command -X bash -c 5" ); +is( $result->return_code, 2, "Checking processes excluded by command name" ); +is( $result->output, "PROCS CRITICAL: 95 processes with exclude progs 'bash' | procs=95;;5;0;", "Output correct" ); + SKIP: { skip 'user with uid 501 required', 4 unless getpwuid(501); -- cgit v0.10-9-g596f From 6e64973a4486248ff6c3de7d72637e44b6474c3e Mon Sep 17 00:00:00 2001 From: Sven Nierlein Date: Mon, 27 Mar 2023 12:59:53 +0200 Subject: simplify code if statement is always true at this point, so remove it. diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index c4ddd0e..aefda3d 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c @@ -1179,10 +1179,7 @@ multiply (char *str) val = strtod (str, &endptr); if ((val == 0.0) && (endptr == str)) { - if(multiplier != 1) { - die(STATE_UNKNOWN, _("multiplier set (%.1f), but input is not a number: %s"), multiplier, str); - } - return str; + die(STATE_UNKNOWN, _("multiplier set (%.1f), but input is not a number: %s"), multiplier, str); } if(verbose>2) -- cgit v0.10-9-g596f From 431502a82c7b1ac4012b243a70ded4b9b2011ea7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20K=C3=A4stle?= Date: Mon, 3 Apr 2023 17:34:19 +0200 Subject: Ignore built check_mssql in CVS diff --git a/.gitignore b/.gitignore index fdcad9f..02ca61e 100644 --- a/.gitignore +++ b/.gitignore @@ -246,6 +246,7 @@ NP-VERSION-FILE /plugins-scripts/check_ircd /plugins-scripts/check_log /plugins-scripts/check_mailq +/plugins-scripts/check_mssql /plugins-scripts/check_ntp /plugins-scripts/check_oracle /plugins-scripts/check_rpc -- cgit v0.10-9-g596f From cc69e8f76bcde8f75b5828b920bb937682673f49 Mon Sep 17 00:00:00 2001 From: donien Date: Thu, 13 Apr 2023 17:15:16 +0200 Subject: Fix 'requres' typo diff --git a/plugins/check_nwstat.c b/plugins/check_nwstat.c index e7e8de0..3c9d23e 100644 --- a/plugins/check_nwstat.c +++ b/plugins/check_nwstat.c @@ -1668,7 +1668,7 @@ void print_help(void) printf ("\n"); printf ("%s\n", _("Notes:")); - printf (" %s\n", _("- This plugin requres that the MRTGEXT.NLM file from James Drews' MRTG")); + printf (" %s\n", _("- This plugin requires that the MRTGEXT.NLM file from James Drews' MRTG")); printf (" %s\n", _(" extension for NetWare be loaded on the Novell servers you wish to check.")); printf (" %s\n", _(" (available from http://www.engr.wisc.edu/~drews/mrtg/)")); printf (" %s\n", _("- Values for critical thresholds should be lower than warning thresholds")); diff --git a/po/de.po b/po/de.po index 919fae3..c29cbbb 100644 --- a/po/de.po +++ b/po/de.po @@ -3315,7 +3315,7 @@ msgid "Include server version string in results" msgstr "" #: plugins/check_nwstat.c:1671 -msgid "- This plugin requres that the MRTGEXT.NLM file from James Drews' MRTG" +msgid "- This plugin requires that the MRTGEXT.NLM file from James Drews' MRTG" msgstr "" #: plugins/check_nwstat.c:1672 diff --git a/po/fr.po b/po/fr.po index e44cf88..b4de17e 100644 --- a/po/fr.po +++ b/po/fr.po @@ -3372,7 +3372,7 @@ msgid "Include server version string in results" msgstr "" #: plugins/check_nwstat.c:1671 -msgid "- This plugin requres that the MRTGEXT.NLM file from James Drews' MRTG" +msgid "- This plugin requires that the MRTGEXT.NLM file from James Drews' MRTG" msgstr "" #: plugins/check_nwstat.c:1672 diff --git a/po/monitoring-plugins.pot b/po/monitoring-plugins.pot index 5bc2363..45f46a8 100644 --- a/po/monitoring-plugins.pot +++ b/po/monitoring-plugins.pot @@ -3225,7 +3225,7 @@ msgid "Include server version string in results" msgstr "" #: plugins/check_nwstat.c:1671 -msgid "- This plugin requres that the MRTGEXT.NLM file from James Drews' MRTG" +msgid "- This plugin requires that the MRTGEXT.NLM file from James Drews' MRTG" msgstr "" #: plugins/check_nwstat.c:1672 -- cgit v0.10-9-g596f From 0f3703e641f0f995a8abb40056cb5430b6c228c4 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Fri, 14 Apr 2023 14:37:47 +0000 Subject: Fix a lot of typos reported by codespell diff --git a/ACKNOWLEDGEMENTS b/ACKNOWLEDGEMENTS index d73be54..af29c15 100644 --- a/ACKNOWLEDGEMENTS +++ b/ACKNOWLEDGEMENTS @@ -20,7 +20,7 @@ Using the DLPI support on SysV systems to get the host MAC address in check_dhcp Stenberg, Daniel Copyright (c) 1996 - 2004, Daniel Stenberg, http://curl.haxx.se/ -Use of duplication of macros in m4/np_curl.m4 (slighly adapted for m4/uriparser.m4 too) +Use of duplication of macros in m4/np_curl.m4 (slightly adapted for m4/uriparser.m4 too) Coreutils team Copyright (C) 91, 1995-2004 Free Software Foundation, Inc. diff --git a/NEWS b/NEWS index 83d522e..9ec3c5e 100644 --- a/NEWS +++ b/NEWS @@ -9,12 +9,12 @@ This file documents the major additions and syntax changes between releases. check_http/check_curl: add chunked encoding test check_log: Added --exclude to exclude patterns check_log: Add tests - check_disk: Clarify usage possibilites + check_disk: Clarify usage possibilities FIXES fixed two PRId64 to PRIu64 in perfdata_uint64 - check_pgsql: Removing is_pg_dbname alltogether,using postgres API. - check_http: Remove superflous CRLF in HTTP-Requests + check_pgsql: Removing is_pg_dbname altogether,using postgres API. + check_http: Remove superfluous CRLF in HTTP-Requests check_curl: detect ipv6 check_icmp: fix parsing help/version long options check_http: fix test plan @@ -40,7 +40,7 @@ This file documents the major additions and syntax changes between releases. 2.3.2 20th Oct 2022 GENERAL - Use netcat-openbsd for debian explicitely (by @RincewindsHat #1704) + Use netcat-openbsd for debian explicitly (by @RincewindsHat #1704) Replace egrep with grep -E (by @RincewindsHat #1791) Use silent automake by default (by @RincewindsHat #1747) @@ -123,7 +123,7 @@ This file documents the major additions and syntax changes between releases. check_log: Modernize check log (by @RincewindsHat #1692) check_mailq: remove duplicate W=i/C=i args in check_mailq.pl (by @ichdasich #1755) check_ntp: Check ntp remove unused variables (by @RincewindsHat #1781) - check_pgsql: Using snprintf which honors the buffers size and guarantees null temination. (Closes: #1601) (by @waja #1663) + check_pgsql: Using snprintf which honors the buffers size and guarantees null termination. (Closes: #1601) (by @waja #1663) check_procs: Fix double percentage sign in usage (by @RincewindsHat #1743) check_sensors.sh: Make shellcheck happier (by @RincewindsHat #1679) check_snmp: Fixed option description authpassword -> authpasswd + whitespaces (by @RincewindsHat #1676) @@ -165,7 +165,7 @@ This file documents the major additions and syntax changes between releases. check_apt: adding packages-warning option check_load: Adding top consuming processes option check_http: Adding Proxy-Authorization and extra headers - check_snmp: make calcualtion of timeout value in help output more clear + check_snmp: make calculation of timeout value in help output more clear check_uptime: new plugin for checking uptime to see how long the system is running check_curl: check_http replacement based on libcurl check_http: Allow user to specify HTTP method after proxy CONNECT @@ -195,7 +195,7 @@ This file documents the major additions and syntax changes between releases. check_procs: improve command examples for 'at least' processes check_swap: repaired "-n" behaviour check_disk: include -P switch in help - check_mailq: restore accidentially removed options + check_mailq: restore accidentally removed options 2.2 29th November 2016 ENHANCEMENTS @@ -236,7 +236,7 @@ This file documents the major additions and syntax changes between releases. check_ssh now returns CRITICAL for protocol/version errors If a plugin is invoked with -h/--help or -V/--version, the exit status is now UNKNOWN - The superseeded check_ntp.pl was removed, please use check_ntp_peer or + The superseded check_ntp.pl was removed, please use check_ntp_peer or check_ntp_time instead 2.1.2 16th October 2015 @@ -263,7 +263,7 @@ This file documents the major additions and syntax changes between releases. New check_mysql -n option to ignore authentication failures Added IP and port or socket name to error messages New check_ntp_time -o option to add expected offset - check_disk shows now troubled partions in verbose mode + check_disk shows now troubled partitions in verbose mode check_dig has now support for drill and dig check_dig has now support for -6 option Add performance data to check_file_age @@ -357,10 +357,10 @@ This file documents the major additions and syntax changes between releases. New check_procs -k option to ignore kernel threads (on Linux) Let check_procs use /proc//exe (if available) instead of getpid(2), unless -T is specified Let check_mysql support SSL - Let check_mysql add perfromance metrics for all checks + Let check_mysql add performance metrics for all checks New check_mysql -f option to specify a client options file New check_mysql -g option to specify a client options group - New check_snmp --offset option to allow for adding/substracting an offset value to sensor data + New check_snmp --offset option to allow for adding/subtracting an offset value to sensor data Let check_snmp support an arbitrary number of OIDs Let check_ide_smart support NetBSD @@ -375,7 +375,7 @@ This file documents the major additions and syntax changes between releases. Fix deprecated imports of check_nmap.py WARNINGS - check_http behaviour of -k/--header changed since it does not seperate multiple headers by semicolons anymore. Use multiple -k switches instead. + check_http behaviour of -k/--header changed since it does not separate multiple headers by semicolons anymore. Use multiple -k switches instead. check_http's --proxy_authorization option is now called --proxy-authorization (it was always documented this way) The contrib directory has been removed from this distribution @@ -526,7 +526,7 @@ This file documents the major additions and syntax changes between releases. check_ntp and check_ntp_peer now show proper jitter/stratum thresholds longopts in --help check_dns now allow to repeat -a to match multiple possibly returned address (common with load balancers) check_mysql and check_radius now try clearing password in processlist just like check_mysql_query - check_mysql and check_mysql_query now support sockets explicitely (-s, --socket) + check_mysql and check_mysql_query now support sockets explicitly (-s, --socket) negate now has the ability to replace the status text as well (-s, --substitute) Added performance data to check_ping Added support for --extra-opts in all C plugins (disabled by default, see configure --help) @@ -566,7 +566,7 @@ This file documents the major additions and syntax changes between releases. New check_disk option -L: Only check local filesystems, but call stat() on remote ones, too. Thus accessibility of remote filesystems can be checked without any threshold comparison. Check_disk's --help now prints some examples for the new features introduced in 1.4.8 - New check_disk -i/-I option to ignore pathes/partitions based on regular expressions + New check_disk -i/-I option to ignore paths/partitions based on regular expressions New check_disk -A option to select all filesystems explicitly WARNING: check_disk's -E option must now be passed before -p or -r/-R arguments Passing -E after -p or -r results in UNKNOWN state, now @@ -615,7 +615,7 @@ This file documents the major additions and syntax changes between releases. Fixed MKINSTALLDIRS problem in po/ ./configure now detects if possible to compile check_mysql Fixed broken HELO in check_smtp - check_icmp now allows to set a minimum number of hosts required for successs (-m) + check_icmp now allows to set a minimum number of hosts required for success (-m) check_icmp fix for *BSD when running for long time check_ping times out 1 second quicker if host is unreachable Root plugins installed with world executable diff --git a/NPTest.pm b/NPTest.pm index 4b2de39..9b25ac3 100644 --- a/NPTest.pm +++ b/NPTest.pm @@ -151,14 +151,14 @@ of testing against a set of desired exit status values. =item * Firstly, if C<$desiredExitStatus> is a reference to an array of exit -stati, if the actual exit status of the command is present in the +statuses, if the actual exit status of the command is present in the array, it is used in the call to C when testing the exit status. =item * Alternatively, if C<$desiredExitStatus> is a reference to a hash of -exit stati (mapped to the strings "continue" or "skip"), similar +exit statuses(mapped to the strings "continue" or "skip"), similar processing to the above occurs with the side affect of determining if any generated output testing should proceed. Note: only the string "skip" will result in generated output testing being skipped. @@ -207,7 +207,7 @@ under the same terms as the Monitoring Plugins release. my( %CACHE ) = (); -# I'm not really sure wether to house a site-specific cache inside +# I'm not really sure whether to house a site-specific cache inside # or outside of the extracted source / build tree - lets default to outside my( $CACHEFILENAME ) = ( exists( $ENV{'NPTEST_CACHE'} ) && $ENV{'NPTEST_CACHE'} ) ? $ENV{'NPTEST_CACHE'} : "/var/tmp/NPTest.cache"; # "../Cache.pdd"; diff --git a/ROADMAP b/ROADMAP index 28f9b31..6378ec7 100644 --- a/ROADMAP +++ b/ROADMAP @@ -7,7 +7,7 @@ With that done, it's time to figure out what we are doing for release 1.3 development. I have a few ideas. Maybe others do as well. DOCUMENTATION: - We pretty much have decieded that we will doing something along + We pretty much have decided that we will doing something along the lines of a literate programming model. So far, we have site documentation in DocBook. I have some ideas here, which I will discuss in a separate thread. @@ -39,9 +39,9 @@ inconsistent mess and I'd love to ditch it. I only created it to satisfy people that wanted reverse compatibility and did not have GNU getopt. -Bu I would like to urge that all standard plugins contain +But I would like to urge that all standard plugins contain validate_arguments(). I think this will help convey the idea that -validations hould be done, even if we don't insist on the specific +validations should be done, even if we don't insist on the specific extent that each plugin must do that validation. This is the set of standard options I envision: @@ -59,7 +59,7 @@ Reserved: -F, --file = STRING (usually input) -O, --output = STRING (output file) -Recommended, but not reserverd: +Recommended, but not reserved: -I, --ipaddress = STRING -C, --community = STRING @@ -69,7 +69,7 @@ Recommended, but not reserverd: -P, --port = INT -u, --url = STRING (also --username if --url is not needed) -I am suggesting that port alway be '-P' (uppercase) -- we are +I am suggesting that port always be '-P' (uppercase) -- we are currently inconsistent in that regard. I am also adding '-q' for silent running. This is totally self @@ -87,12 +87,12 @@ Programming: length character assignments, at least to the extent possible, from the C-based plugins. To that end, I have made strscpy and friends in utils.c -- I'd like to deploy them. I have comments - that there is alot of duplicated code, and techniques used that + that there is a lot of duplicated code, and techniques used that should be cleaned up. Details in a separate thread. Remote checks: I have a proposal in hand to incorporate ssh check into spopen() - so that remote machine checks can be seemless. A nice idea, but + so that remote machine checks can be seamless. A nice idea, but complex enough to require discussion. Another thread. I also have a wish list, and I'm sure I've forgot some items. I'll diff --git a/build-aux/ltmain.sh b/build-aux/ltmain.sh index 33f642a..2e8548d 100644 --- a/build-aux/ltmain.sh +++ b/build-aux/ltmain.sh @@ -189,7 +189,7 @@ func_basename () # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. -# value retuned in "$func_basename_result" +# value returned in "$func_basename_result" # Implementation must be kept synchronized with func_dirname # and func_basename. For efficiency, we do not delegate to # those functions but instead duplicate the functionality here. @@ -522,7 +522,7 @@ func_mkdir_p () # While some portion of DIR does not yet exist... while test ! -d "$my_directory_path"; do # ...make a list in topmost first order. Use a colon delimited - # list incase some portion of path contains whitespace. + # list in case some portion of path contains whitespace. my_dir_list="$my_directory_path:$my_dir_list" # If the last portion added has no slash in it, the list is done @@ -4394,7 +4394,7 @@ EOF { /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX namespace, but it is not one of the ones we know about and - have already dealt with, above (inluding dump-script), then + have already dealt with, above (including dump-script), then report an error. Otherwise, targets might begin to believe they are allowed to use options in the LTWRAPPER_OPTION_PREFIX namespace. The first time any user complains about this, we'll diff --git a/config_test/child_test.c b/config_test/child_test.c index 4bf8504..2add3bc 100644 --- a/config_test/child_test.c +++ b/config_test/child_test.c @@ -30,7 +30,7 @@ int main(){ /* pipefd[1] is for writing to the pipe. We want the output * that used to go to the standard output (file descriptor 1) * to be written to the pipe. The following command does this, - * creating a new file descripter 1 (the lowest available) + * creating a new file descriptor 1 (the lowest available) * that writes where pipefd[1] goes. */ dup (pipefd[1]); /* points pipefd at file descriptor */ /* the child isn't going to read from the pipe, so diff --git a/configure.ac b/configure.ac index 0c7169e..bad5c53 100644 --- a/configure.ac +++ b/configure.ac @@ -932,7 +932,7 @@ elif ps -Ao 's comm vsz rss uid user pid ppid args' 2>/dev/null | \ then ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]" ac_cv_ps_command="$PATH_TO_PS -Ao 's uid pid ppid vsz rss pcpu comm args'" - # There must be no space between the %s and %n due to a wierd problem in sscanf where + # There must be no space between the %s and %n due to a weird problem in sscanf where # it will return %n as longer than the line length ac_cv_ps_format="%s %d %d %d %d %d %f %s%n" ac_cv_ps_cols=9 @@ -1552,7 +1552,7 @@ if test -n "$PATH_TO_SUDO" then AC_DEFINE_UNQUOTED(PATH_TO_SUDO,"$PATH_TO_SUDO",[path to sudo]) else - AC_MSG_WARN([Could not find sudo or eqivalent]) + AC_MSG_WARN([Could not find sudo or equivalent]) fi AC_PATH_PROG(PATH_TO_MAILQ,mailq) @@ -1563,7 +1563,7 @@ if test -n "$PATH_TO_MAILQ" then AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_MAILQ",[path to mailq]) else - AC_MSG_WARN([Could not find mailq or eqivalent]) + AC_MSG_WARN([Could not find mailq or equivalent]) fi AC_PATH_PROG(PATH_TO_QMAIL_QSTAT,qmail-qstat) @@ -1574,7 +1574,7 @@ if test -n "$PATH_TO_QMAIL_QSTAT" then AC_DEFINE_UNQUOTED(PATH_TO_QMAIL_QSTAT,"$PATH_TO_QMAIL_QSTAT",[path to qmail-qstat]) else - AC_MSG_WARN([Could not find qmail-qstat or eqivalent]) + AC_MSG_WARN([Could not find qmail-qstat or equivalent]) fi dnl SWAP info required is amount allocated/available and amount free @@ -1832,7 +1832,7 @@ AM_GNU_GETTEXT([external], [need-ngettext]) AM_GNU_GETTEXT_VERSION(0.15) dnl Check for Redhat spopen problem -dnl Wierd problem where ECHILD is returned from a wait call in error +dnl Weird problem where ECHILD is returned from a wait call in error dnl Only appears to affect nslookup and dig calls. Only affects redhat around dnl 2.6.9-11 (okay in 2.6.9-5). Redhat investigating root cause dnl We patch plugins/popen.c diff --git a/doc/developer-guidelines.sgml b/doc/developer-guidelines.sgml index 28674e0..1982974 100644 --- a/doc/developer-guidelines.sgml +++ b/doc/developer-guidelines.sgml @@ -31,7 +31,7 @@ Preface The purpose of this guidelines is to provide a reference for - the plugin developers and encourage the standarization of the + the plugin developers and encourage the standardization of the different kind of plugins: C, shell, perl, python, etc. Monitoring Plugins Development Guidelines Copyright (C) 2000-2013 @@ -374,7 +374,7 @@ s - seconds (also us, ms) % - percentage B - bytes (also KB, MB, TB) - c - a continous counter (such as bytes + c - a continuous counter (such as bytes transmitted on an interface) @@ -397,7 +397,7 @@
Don't execute system commands without specifying their full path Don't use exec(), popen(), etc. to execute external - commands without explicity using the full path of the external + commands without explicitly using the full path of the external program. Doing otherwise makes the plugin vulnerable to hijacking @@ -655,7 +655,7 @@ If possible when writing lists, use tokens to make the list easy to remember and non-order dependent - so check_disk uses '-c 10000,10%' so that it is clear which is - the precentage and which is the KB values (note that due to + the percentage and which is the KB values (note that due to my own lack of foresight, that used to be '-c 10000:10%' but such constructs should all be changed for consistency, though providing reverse compatibility is fairly @@ -686,7 +686,7 @@ all the current tests and report an overall success rate. These use perl's Test::More. To do a one time test, run "cd plugins && perl t/check_disk.t". -There will somtimes be failures seen in this output which are known failures that +There will sometimes be failures seen in this output which are known failures that need to be fixed. As long as the return code is 0, it will be reported as "test pass". (If you have a fix so that the specific test passes, that will be gratefully received!) @@ -846,7 +846,7 @@ setup the tests. Run "make test" to run all the tests. It is determined to be not redundant (for instance, we would not add a new version of check_disk just because someone had provide a plugin that had perf checking - we would incorporate the features - into an exisiting plugin) + into an existing plugin) One of the developers has had the time to audit the code and declare diff --git a/lib/parse_ini.c b/lib/parse_ini.c index 25abc89..547af43 100644 --- a/lib/parse_ini.c +++ b/lib/parse_ini.c @@ -78,7 +78,7 @@ static char *default_file_in_path(void); /* * Parse_locator decomposes a string of the form * [stanza][@filename] - * into its seperate parts. + * into its separate parts. */ static void parse_locator(const char *locator, const char *def_stanza, np_ini_info *i) @@ -169,7 +169,7 @@ read_defaults(FILE *f, const char *stanza, np_arg_list **opts) if (isspace(c)) continue; switch (c) { - /* globble up coment lines */ + /* globble up comment lines */ case ';': case '#': GOBBLE_TO(f, c, '\n'); diff --git a/lib/tests/test_cmd.c b/lib/tests/test_cmd.c index 29ca42a..4bb60aa 100644 --- a/lib/tests/test_cmd.c +++ b/lib/tests/test_cmd.c @@ -176,14 +176,14 @@ main (int argc, char **argv) ok (result == UNSET, "(initialised) Checking exit code is reset"); command = (char *)malloc(COMMAND_LINE); - strcpy(command, "/bin/echo3456 non-existant command"); + strcpy(command, "/bin/echo3456 non-existent command"); result = cmd_run (command, &chld_out, &chld_err, 0); ok (chld_out.lines == 0, - "Non existant command, so no output"); + "Non existent command, so no output"); ok (chld_err.lines == 0, "No stderr either"); - ok (result == 3, "Get return code 3 (?) for non-existant command"); + ok (result == 3, "Get return code 3 (?) for non-existent command"); /* ensure everything is empty again */ @@ -192,14 +192,14 @@ main (int argc, char **argv) result = UNSET; command = (char *)malloc(COMMAND_LINE); - strcpy(command, "/bin/sh non-existant-file"); + strcpy(command, "/bin/sh non-existent-file"); result = cmd_run (command, &chld_out, &chld_err, 0); ok (chld_out.lines == 0, "/bin/sh returns no stdout when file is missing..."); ok (chld_err.lines == 1, "...but does give an error line"); - ok (strstr(chld_err.line[0],"non-existant-file") != NULL, "And missing filename is in error message"); + ok (strstr(chld_err.line[0],"non-existent-file") != NULL, "And missing filename is in error message"); ok (result != 0, "Get non-zero return code from /bin/sh"); @@ -219,11 +219,11 @@ main (int argc, char **argv) result = UNSET; command = (char *)malloc(COMMAND_LINE); - strcpy(command, "/bin/non-existant-command"); + strcpy(command, "/bin/non-existent-command"); result = cmd_run (command, &chld_out, &chld_err, 0); ok (chld_out.lines == 0, - "/bin/non-existant-command returns no stdout..."); + "/bin/non-existent-command returns no stdout..."); ok (chld_err.lines == 0, "...and no stderr output either"); ok (result == 3, "Get return code 3 = UNKNOWN when command does not exist"); diff --git a/lib/tests/test_disk.c b/lib/tests/test_disk.c index f6477ac..9bd68c7 100644 --- a/lib/tests/test_disk.c +++ b/lib/tests/test_disk.c @@ -88,10 +88,10 @@ main (int argc, char **argv) cflags, 3,strdup("regex on dev names:")); np_test_mount_entry_regex(dummy_mount_list, strdup("/foo"), cflags, 0, - strdup("regex on non existant dev/path:")); + strdup("regex on non existent dev/path:")); np_test_mount_entry_regex(dummy_mount_list, strdup("/Foo"), cflags | REG_ICASE,0, - strdup("regi on non existant dev/path:")); + strdup("regi on non existent dev/path:")); np_test_mount_entry_regex(dummy_mount_list, strdup("/c.t0"), cflags, 3, strdup("partial devname regex match:")); diff --git a/lib/tests/test_ini3.t b/lib/tests/test_ini3.t index a2ca94a..41169db 100755 --- a/lib/tests/test_ini3.t +++ b/lib/tests/test_ini3.t @@ -10,7 +10,7 @@ if (! -e "./test_ini3") { # array of argument arrays # - First value is the expected return code # - 2nd value is the NAGIOS_CONFIG_PATH -# TODO: looks like we look in default path after looking trough this variable - shall we? +# TODO: looks like we look in default path after looking through this variable - shall we? # - 3rd value is the plugin name # - 4th is the ini locator my @TESTS = ( diff --git a/lib/tests/test_opts3.t b/lib/tests/test_opts3.t index 8d974ca..d77a35c 100755 --- a/lib/tests/test_opts3.t +++ b/lib/tests/test_opts3.t @@ -10,7 +10,7 @@ if (! -e "./test_opts3") { # array of argument arrays # - First value is the expected return code # - 2nd value is the NAGIOS_CONFIG_PATH -# TODO: looks like we look in default path after looking trough this variable - shall we? +# TODO: looks like we look in default path after looking through this variable - shall we? # - 3rd value is the plugin name # - 4th and up are arguments my @TESTS = ( diff --git a/lib/tests/test_utils.c b/lib/tests/test_utils.c index bc00fac..7b10494 100644 --- a/lib/tests/test_utils.c +++ b/lib/tests/test_utils.c @@ -395,7 +395,7 @@ main (int argc, char **argv) ok( temp_state_data==NULL, "Older data version gives NULL" ); temp_state_key->data_version=54; - temp_state_key->_filename="var/nonexistant"; + temp_state_key->_filename="var/nonexistent"; temp_state_data = np_state_read(); ok( temp_state_data==NULL, "Missing file gives NULL" ); ok( this_monitoring_plugin->state->state_data==NULL, "No state information" ); diff --git a/lib/utils_cmd.c b/lib/utils_cmd.c index 795840d..8b8e570 100644 --- a/lib/utils_cmd.c +++ b/lib/utils_cmd.c @@ -161,7 +161,7 @@ _cmd_open (char *const *argv, int *pfd, int *pfderr) } /* parent picks up execution here */ - /* close childs descriptors in our address space */ + /* close children descriptors in our address space */ close (pfd[1]); close (pfderr[1]); diff --git a/m4/np_mysqlclient.m4 b/m4/np_mysqlclient.m4 index 5099a02..9f533ea 100644 --- a/m4/np_mysqlclient.m4 +++ b/m4/np_mysqlclient.m4 @@ -81,7 +81,7 @@ AC_DEFUN([np_check_lib_mariadbclient], ], [with_mysql=no], [$np_mysql_libs]) ]) -dnl Will take $1, find last occurrance of -LDIR and add DIR to LD_RUN_PATH +dnl Will take $1, find last occurrence of -LDIR and add DIR to LD_RUN_PATH AC_DEFUN([np_add_to_runpath], [ dnl Need [[ ]] so autoconf gives us just one set diff --git a/m4/uriparser.m4 b/m4/uriparser.m4 index dbb8a55..5113638 100644 --- a/m4/uriparser.m4 +++ b/m4/uriparser.m4 @@ -1,4 +1,4 @@ -# (this check is rougly based on and inspired libcurl.m4) +# (this check is roughly based on and inspired libcurl.m4) # URIPARSER_CHECK ([DEFAULT-ACTION], [MINIMUM-VERSION], # [ACTION-IF-YES], [ACTION-IF-NO]) # Checks for uriparser library. DEFAULT-ACTION is the string yes or no to diff --git a/plugins-root/check_icmp.c b/plugins-root/check_icmp.c index c3be2ef..9ceb35b 100644 --- a/plugins-root/check_icmp.c +++ b/plugins-root/check_icmp.c @@ -274,7 +274,7 @@ get_icmp_error_msg(unsigned char icmp_type, unsigned char icmp_code) break; case ICMP_TIMXCEED: - /* really 'out of reach', or non-existant host behind a router serving + /* really 'out of reach', or non-existent host behind a router serving * two different subnets */ switch(icmp_code) { case ICMP_TIMXCEED_INTRANS: msg = "Time to live exceeded in transit"; break; diff --git a/plugins-root/pst3.c b/plugins-root/pst3.c index c3589f0..1f69f3a 100644 --- a/plugins-root/pst3.c +++ b/plugins-root/pst3.c @@ -257,6 +257,6 @@ void usage() { printf("\tRSS - Real memory usage (kilobytes)\n"); printf("\t%%CPU - CPU usage\n"); printf("\tCOMMAND - Command being run\n"); - printf("\tARGS - Full command line with arguements\n"); + printf("\tARGS - Full command line with arguments\n"); return; } diff --git a/plugins-root/t/check_icmp.t b/plugins-root/t/check_icmp.t index f6aa681..96addd3 100644 --- a/plugins-root/t/check_icmp.t +++ b/plugins-root/t/check_icmp.t @@ -92,5 +92,5 @@ like( $res->output, $successOutput, "Output OK" ); $res = NPTest->testCmd( "$sudo ./check_icmp -H $host_responsive -b 65507" ); -is( $res->return_code, 0, "Try max paket size" ); +is( $res->return_code, 0, "Try max packet size" ); like( $res->output, $successOutput, "Output OK - Didn't overflow" ); diff --git a/plugins-scripts/check_disk_smb.pl b/plugins-scripts/check_disk_smb.pl index 15d1634..f4d33a7 100644 --- a/plugins-scripts/check_disk_smb.pl +++ b/plugins-scripts/check_disk_smb.pl @@ -28,7 +28,7 @@ use FindBin; use lib "$FindBin::Bin"; use utils qw($TIMEOUT %ERRORS &print_revision &support &usage); -# make us session leader which makes all childs exit if we do +# make us session leader which makes all children exit if we do setsid; sub print_help (); diff --git a/plugins-scripts/check_ifoperstatus.pl b/plugins-scripts/check_ifoperstatus.pl index c190ce9..e335cda 100755 --- a/plugins-scripts/check_ifoperstatus.pl +++ b/plugins-scripts/check_ifoperstatus.pl @@ -134,7 +134,7 @@ if (defined $ifdescr || defined $iftype) { } if ($status==0) { $state = "UNKNOWN"; - printf "$state: could not retrive ifdescr/iftype snmpkey - $status-$snmpkey\n"; + printf "$state: could not retrieve ifdescr/iftype snmpkey - $status-$snmpkey\n"; $session->close; exit $ERRORS{$state}; } @@ -187,7 +187,7 @@ if (defined $ifXTable) { $name = $response->{$snmpIfDescr} ; } -## if AdminStatus is down - some one made a consious effort to change config +## if AdminStatus is down - some one made a conscious effort to change config ## if ( not ($response->{$snmpIfAdminStatus} == 1) ) { $answer = "Interface $name (index $snmpkey) is administratively down."; @@ -286,7 +286,7 @@ sub print_usage() { printf "check_ifoperstatus -k -H [-C ]\n"; printf "Copyright (C) 2000 Christoph Kron\n"; printf "check_ifoperstatus.pl comes with ABSOLUTELY NO WARRANTY\n"; - printf "This programm is licensed under the terms of the "; + printf "This program is licensed under the terms of the "; printf "GNU General Public License\n(check source code for details)\n"; printf "\n\n"; } @@ -424,7 +424,7 @@ sub process_arguments() { if (defined $seclevel && defined $secname) { $session_opts{'-username'} = $secname; - # Must define a security level even though defualt is noAuthNoPriv + # Must define a security level even though default is noAuthNoPriv unless ( grep /^$seclevel$/, qw(noAuthNoPriv authNoPriv authPriv) ) { usage("Must define a valid security level even though default is noAuthNoPriv"); } diff --git a/plugins-scripts/check_ifstatus.pl b/plugins-scripts/check_ifstatus.pl index 32984e5..38b87fc 100755 --- a/plugins-scripts/check_ifstatus.pl +++ b/plugins-scripts/check_ifstatus.pl @@ -354,7 +354,7 @@ sub process_arguments() { if (defined $seclevel && defined $secname) { $session_opts{'-username'} = $secname; - # Must define a security level even though defualt is noAuthNoPriv + # Must define a security level even though default is noAuthNoPriv unless ( grep /^$seclevel$/, qw(noAuthNoPriv authNoPriv authPriv) ) { usage("Must define a valid security level even though default is noAuthNoPriv"); } diff --git a/plugins-scripts/check_ircd.pl b/plugins-scripts/check_ircd.pl index d869ae7..84f2022 100755 --- a/plugins-scripts/check_ircd.pl +++ b/plugins-scripts/check_ircd.pl @@ -60,7 +60,7 @@ sub print_usage (); sub connection ($$$$); sub bindRemote ($$); -# -------------------------------------------------------------[ Enviroment ]-- +# -------------------------------------------------------------[ Environment ]-- $ENV{'PATH'}='@TRUSTED_PATH@'; $ENV{'BASH_ENV'}=''; @@ -208,7 +208,7 @@ MAIN: # Just in case of problems, let's not hang the monitoring system $SIG{'ALRM'} = sub { - print "Somthing is Taking a Long Time, Increase Your TIMEOUT (Currently Set At $TIMEOUT Seconds)\n"; + print "Something is Taking a Long Time, Increase Your TIMEOUT (Currently Set At $TIMEOUT Seconds)\n"; exit $ERRORS{"UNKNOWN"}; }; diff --git a/plugins-scripts/check_mailq.pl b/plugins-scripts/check_mailq.pl index f02c90f..49156af 100755 --- a/plugins-scripts/check_mailq.pl +++ b/plugins-scripts/check_mailq.pl @@ -4,7 +4,7 @@ # transmittal. # # Initial version support sendmail's mailq command -# Support for mutiple sendmail queues (Carlos Canau) +# Support for multiple sendmail queues (Carlos Canau) # Support for qmail (Benjamin Schmid) # License Information: diff --git a/plugins-scripts/check_rpc.pl b/plugins-scripts/check_rpc.pl index 47d6e49..8a56b9f 100755 --- a/plugins-scripts/check_rpc.pl +++ b/plugins-scripts/check_rpc.pl @@ -5,7 +5,7 @@ # usage: # check_rpc host service # -# Check if an rpc serice is registered and running +# Check if an rpc service is registered and running # using rpcinfo - $proto $host $prognum 2>&1 |"; # # Use these hosts.cfg entries as examples diff --git a/plugins-scripts/check_uptime.pl b/plugins-scripts/check_uptime.pl index f954287..d73e40e 100755 --- a/plugins-scripts/check_uptime.pl +++ b/plugins-scripts/check_uptime.pl @@ -110,7 +110,7 @@ $pretty_uptime .= sprintf( "%d week%s, ", $weeks, $weeks == 1 ? "" : "s" ) if $pretty_uptime .= sprintf( "%d day%s, ", $days, $days == 1 ? "" : "s" ) if $days; $pretty_uptime .= sprintf( "%d hour%s, ", $hours, $hours == 1 ? "" : "s" ) if $hours; $pretty_uptime .= sprintf( "%d minute%s, ", $mins, $mins == 1 ? "" : "s" ) if $mins; -# Replace last occurence of comma with "and" +# Replace last occurrence of comma with "and" $pretty_uptime =~ s/, $/ and /; # Always print the seconds (though it may be 0 seconds) $pretty_uptime .= sprintf( "%d second%s", $secs, $secs == 1 ? "" : "s" ); diff --git a/plugins/check_curl.c b/plugins/check_curl.c index c51914a..be5740d 100644 --- a/plugins/check_curl.c +++ b/plugins/check_curl.c @@ -618,7 +618,7 @@ check_http (void) #ifdef LIBCURL_FEATURE_SSL - /* set SSL version, warn about unsecure or unsupported versions */ + /* set SSL version, warn about insecure or unsupported versions */ if (use_ssl) { handle_curl_option_return_code (curl_easy_setopt (curl, CURLOPT_SSLVERSION, ssl_version), "CURLOPT_SSLVERSION"); } @@ -986,7 +986,7 @@ GOT_FIRST_CERT: } } else { /* this is a specific code in the command line to - * be returned when a redirection is encoutered + * be returned when a redirection is encountered */ } result = max_state_alt (onredirect, result); @@ -2051,7 +2051,7 @@ print_usage (void) printf (" %s -H | -I [-u ] [-p ]\n",progname); printf (" [-J ] [-K ] [--ca-cert ] [-D]\n"); printf (" [-w ] [-c ] [-t ] [-L] [-E] [-a auth]\n"); - printf (" [-b proxy_auth] [-f ]\n"); + printf (" [-b proxy_auth] [-f ]\n"); printf (" [-e ] [-d string] [-s string] [-l] [-r | -R ]\n"); printf (" [-P string] [-m :] [-4|-6] [-N] [-M ]\n"); printf (" [-A string] [-k string] [-S ] [--sni]\n"); diff --git a/plugins/check_disk.c b/plugins/check_disk.c index bd84c82..a99f35e 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c @@ -587,7 +587,7 @@ process_arguments (int argc, char **argv) /* Awful mistake where the range values do not make sense. Normally, you alert if the value is within the range, but since we are using - freespace, we have to alert if outside the range. Thus we artifically + freespace, we have to alert if outside the range. Thus we artificially force @ at the beginning of the range, so that it is backwards compatible */ case 'c': /* critical threshold */ @@ -1115,7 +1115,7 @@ get_path_stats (struct parameter_list *p, struct fs_usage *fsp) { p->available_to_root = fsp->fsu_bfree; p->used = fsp->fsu_blocks - fsp->fsu_bfree; if (freespace_ignore_reserved) { - /* option activated : we substract the root-reserved space from the total */ + /* option activated : we subtract the root-reserved space from the total */ p->total = fsp->fsu_blocks - p->available_to_root + p->available; } else { /* default behaviour : take all the blocks into account */ @@ -1130,7 +1130,7 @@ get_path_stats (struct parameter_list *p, struct fs_usage *fsp) { p->inodes_free_to_root = fsp->fsu_ffree; /* Free file nodes for root. */ p->inodes_used = fsp->fsu_files - fsp->fsu_ffree; if (freespace_ignore_reserved) { - /* option activated : we substract the root-reserved inodes from the total */ + /* option activated : we subtract the root-reserved inodes from the total */ /* not all OS report fsp->fsu_favail, only the ones with statvfs syscall */ /* for others, fsp->fsu_ffree == fsp->fsu_favail */ p->inodes_total = fsp->fsu_files - p->inodes_free_to_root + p->inodes_free; diff --git a/plugins/check_dns.c b/plugins/check_dns.c index 9de6caf..7ffce98 100644 --- a/plugins/check_dns.c +++ b/plugins/check_dns.c @@ -75,7 +75,7 @@ main (int argc, char **argv) { char *command_line = NULL; char input_buffer[MAX_INPUT_BUFFER]; - char *address = NULL; /* comma seperated str with addrs/ptrs (sorted) */ + char *address = NULL; /* comma separated str with addrs/ptrs (sorted) */ char **addresses = NULL; int n_addresses = 0; char *msg = NULL; diff --git a/plugins/check_fping.c b/plugins/check_fping.c index db43316..6f5656e 100644 --- a/plugins/check_fping.c +++ b/plugins/check_fping.c @@ -73,7 +73,7 @@ int wrta_p = FALSE; int main (int argc, char **argv) { -/* normaly should be int result = STATE_UNKNOWN; */ +/* normally should be int result = STATE_UNKNOWN; */ int status = STATE_UNKNOWN; int result = 0; diff --git a/plugins/check_http.c b/plugins/check_http.c index 8dda046..8c03bc8 100644 --- a/plugins/check_http.c +++ b/plugins/check_http.c @@ -198,7 +198,7 @@ test_file (char *path) /* * process command-line arguments - * returns true on succes, false otherwise + * returns true on success, false otherwise */ bool process_arguments (int argc, char **argv) { @@ -1885,7 +1885,7 @@ print_usage (void) printf (" %s -H | -I [-u ] [-p ]\n",progname); printf (" [-J ] [-K ]\n"); printf (" [-w ] [-c ] [-t ] [-L] [-E] [-a auth]\n"); - printf (" [-b proxy_auth] [-f ]\n"); + printf (" [-b proxy_auth] [-f ]\n"); printf (" [-e ] [-d string] [-s string] [-l] [-r | -R ]\n"); printf (" [-P string] [-m :] [-4|-6] [-N] [-M ]\n"); printf (" [-A string] [-k string] [-S ] [--sni]\n"); diff --git a/plugins/check_ldap.c b/plugins/check_ldap.c index 845a4f5..a1bfe1b 100644 --- a/plugins/check_ldap.c +++ b/plugins/check_ldap.c @@ -222,7 +222,7 @@ main (int argc, char *argv[]) /* reset the alarm handler */ alarm (0); - /* calcutate the elapsed time and compare to thresholds */ + /* calculate the elapsed time and compare to thresholds */ microsec = deltime (tv); elapsed_time = (double)microsec / 1.0e6; diff --git a/plugins/check_load.c b/plugins/check_load.c index 00f7c87..313df8a 100644 --- a/plugins/check_load.c +++ b/plugins/check_load.c @@ -107,7 +107,7 @@ main (int argc, char **argv) int i; long numcpus; - double la[3] = { 0.0, 0.0, 0.0 }; /* NetBSD complains about unitialized arrays */ + double la[3] = { 0.0, 0.0, 0.0 }; /* NetBSD complains about uninitialized arrays */ #ifndef HAVE_GETLOADAVG char input_buffer[MAX_INPUT_BUFFER]; # ifdef HAVE_PROC_LOADAVG diff --git a/plugins/check_ntp.c b/plugins/check_ntp.c index 8b776ba..3614650 100644 --- a/plugins/check_ntp.c +++ b/plugins/check_ntp.c @@ -10,7 +10,7 @@ * * This file contains the check_ntp plugin * -* This plugin to check ntp servers independant of any commandline +* This plugin to check ntp servers independent of any commandline * programs or external libraries. * * @@ -79,7 +79,7 @@ typedef struct { /* this structure holds data about results from querying offset from a peer */ typedef struct { time_t waiting; /* ts set when we started waiting for a response */ - int num_responses; /* number of successfully recieved responses */ + int num_responses; /* number of successfully received responses */ uint8_t stratum; /* copied verbatim from the ntp_message */ double rtdelay; /* converted from the ntp_message */ double rtdisp; /* converted from the ntp_message */ @@ -100,7 +100,7 @@ typedef struct { /* NB: not necessarily NULL terminated! */ } ntp_control_message; -/* this is an association/status-word pair found in control packet reponses */ +/* this is an association/status-word pair found in control packet responses */ typedef struct { uint16_t assoc; uint16_t status; @@ -575,7 +575,7 @@ double jitter_request(int *status){ } } } - if(verbose) printf("%d candiate peers available\n", num_candidates); + if(verbose) printf("%d candidate peers available\n", num_candidates); if(verbose && syncsource_found) printf("synchronization source found\n"); if(! syncsource_found){ *status = STATE_UNKNOWN; @@ -597,7 +597,7 @@ double jitter_request(int *status){ /* By spec, putting the variable name "jitter" in the request * should cause the server to provide _only_ the jitter value. * thus reducing net traffic, guaranteeing us only a single - * datagram in reply, and making intepretation much simpler + * datagram in reply, and making interpretation much simpler */ /* Older servers doesn't know what jitter is, so if we get an * error on the first pass we redo it with "dispersion" */ diff --git a/plugins/check_ntp_peer.c b/plugins/check_ntp_peer.c index 6842842..eafafdc 100644 --- a/plugins/check_ntp_peer.c +++ b/plugins/check_ntp_peer.c @@ -86,7 +86,7 @@ typedef struct { /* NB: not necessarily NULL terminated! */ } ntp_control_message; -/* this is an association/status-word pair found in control packet reponses */ +/* this is an association/status-word pair found in control packet responses */ typedef struct { uint16_t assoc; uint16_t status; @@ -189,7 +189,7 @@ setup_control_request(ntp_control_message *p, uint8_t opcode, uint16_t seq){ } /* This function does all the actual work; roughly here's what it does - * beside setting the offest, jitter and stratum passed as argument: + * beside setting the offset, jitter and stratum passed as argument: * - offset can be negative, so if it cannot get the offset, offset_result * is set to UNKNOWN, otherwise OK. * - jitter and stratum are set to -1 if they cannot be retrieved so any @@ -306,7 +306,7 @@ int ntp_request(const char *host, double *offset, int *offset_result, double *ji /* Putting the wanted variable names in the request * cause the server to provide _only_ the requested values. * thus reducing net traffic, guaranteeing us only a single - * datagram in reply, and making intepretation much simpler + * datagram in reply, and making interpretation much simpler */ /* Older servers doesn't know what jitter is, so if we get an * error on the first pass we redo it with "dispersion" */ @@ -585,7 +585,7 @@ int main(int argc, char *argv[]){ /* set socket timeout */ alarm (socket_timeout); - /* This returns either OK or WARNING (See comment preceeding ntp_request) */ + /* This returns either OK or WARNING (See comment proceeding ntp_request) */ result = ntp_request(server_address, &offset, &offset_result, &jitter, &stratum, &num_truechimers); if(offset_result == STATE_UNKNOWN) { diff --git a/plugins/check_ntp_time.c b/plugins/check_ntp_time.c index 391b2df..46cc604 100644 --- a/plugins/check_ntp_time.c +++ b/plugins/check_ntp_time.c @@ -81,7 +81,7 @@ typedef struct { /* this structure holds data about results from querying offset from a peer */ typedef struct { time_t waiting; /* ts set when we started waiting for a response */ - int num_responses; /* number of successfully recieved responses */ + int num_responses; /* number of successfully received responses */ uint8_t stratum; /* copied verbatim from the ntp_message */ double rtdelay; /* converted from the ntp_message */ double rtdisp; /* converted from the ntp_message */ diff --git a/plugins/check_procs.c b/plugins/check_procs.c index d672dd4..c17c699 100644 --- a/plugins/check_procs.c +++ b/plugins/check_procs.c @@ -273,7 +273,7 @@ main (int argc, char **argv) } } - /* filter kernel threads (childs of KTHREAD_PARENT)*/ + /* filter kernel threads (children of KTHREAD_PARENT)*/ /* TODO adapt for other OSes than GNU/Linux sorry for not doing that, but I've no other OSes to test :-( */ if (kthread_filter == 1) { @@ -787,7 +787,7 @@ print_help (void) printf (" %s\n", "-C, --command=COMMAND"); printf (" %s\n", _("Only scan for exact matches of COMMAND (without path).")); printf (" %s\n", "-X, --exclude-process"); - printf (" %s\n", _("Exclude processes which match this comma seperated list")); + printf (" %s\n", _("Exclude processes which match this comma separated list")); printf (" %s\n", "-k, --no-kthreads"); printf (" %s\n", _("Only scan for non kernel threads (works on Linux only).")); diff --git a/plugins/check_real.c b/plugins/check_real.c index 0f1a1ba..fbdb70f 100644 --- a/plugins/check_real.c +++ b/plugins/check_real.c @@ -178,7 +178,7 @@ main (int argc, char **argv) /* watch for the REAL connection string */ result = recv (sd, buffer, MAX_INPUT_BUFFER - 1, 0); - buffer[result] = '\0'; /* null terminate recieved buffer */ + buffer[result] = '\0'; /* null terminate received buffer */ /* return a CRITICAL status if we couldn't read any data */ if (result == -1) { @@ -436,7 +436,7 @@ print_help (void) printf ("\n"); printf ("%s\n", _("This plugin will attempt to open an RTSP connection with the host.")); - printf ("%s\n", _("Successul connects return STATE_OK, refusals and timeouts return")); + printf ("%s\n", _("Successful connects return STATE_OK, refusals and timeouts return")); printf ("%s\n", _("STATE_CRITICAL, other errors return STATE_UNKNOWN. Successful connects,")); printf ("%s\n", _("but incorrect response messages from the host result in STATE_WARNING return")); printf ("%s\n", _("values.")); diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c index c1e92df..eaa7eeb 100644 --- a/plugins/check_smtp.c +++ b/plugins/check_smtp.c @@ -844,7 +844,7 @@ print_help (void) printf (UT_VERBOSE); printf("\n"); - printf ("%s\n", _("Successul connects return STATE_OK, refusals and timeouts return")); + printf ("%s\n", _("Successful connects return STATE_OK, refusals and timeouts return")); printf ("%s\n", _("STATE_CRITICAL, other errors return STATE_UNKNOWN. Successful")); printf ("%s\n", _("connects, but incorrect response messages from the host result in")); printf ("%s\n", _("STATE_WARNING return values.")); diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index aefda3d..c425df3 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c @@ -1274,7 +1274,7 @@ print_help (void) printf (" %s\n", "--rate-multiplier"); printf (" %s\n", _("Converts rate per second. For example, set to 60 to convert to per minute")); printf (" %s\n", "--offset=OFFSET"); - printf (" %s\n", _("Add/substract the specified OFFSET to numeric sensor data")); + printf (" %s\n", _("Add/subtract the specified OFFSET to numeric sensor data")); /* Tests Against Strings */ printf (" %s\n", "-s, --string=STRING"); diff --git a/plugins/check_swap.c b/plugins/check_swap.c index 25d5f21..05f19ad 100644 --- a/plugins/check_swap.c +++ b/plugins/check_swap.c @@ -552,7 +552,7 @@ validate_arguments (void) } else if ((warn.is_percentage == crit.is_percentage) && (warn.value < crit.value)) { /* This is NOT triggered if warn and crit are different units, e.g warn is percentage - * and crit is absolut. We cannot determine the condition at this point since we + * and crit is absolute. We cannot determine the condition at this point since we * dont know the value of total swap yet */ usage4(_("Warning should be more than critical")); diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c index 1365b9c..1d307cf 100644 --- a/plugins/check_tcp.c +++ b/plugins/check_tcp.c @@ -128,7 +128,7 @@ main (int argc, char **argv) SERVICE[i] = toupper(SERVICE[i]); } - /* set up a resonable buffer at first (will be realloc()'ed if + /* set up a reasonable buffer at first (will be realloc()'ed if * user specifies other options) */ server_expect = calloc(sizeof(char *), 2); diff --git a/plugins/check_ups.c b/plugins/check_ups.c index 0de37a2..12bce21 100644 --- a/plugins/check_ups.c +++ b/plugins/check_ups.c @@ -507,7 +507,7 @@ process_arguments (int argc, char **argv) usage2 (_("Invalid hostname/address"), optarg); } break; - case 'T': /* FIXME: to be improved (ie "-T C" for Celsius or "-T F" for Farenheit) */ + case 'T': /* FIXME: to be improved (ie "-T C" for Celsius or "-T F" for Fahrenheit) */ temp_output_c = 1; break; case 'u': /* ups name */ diff --git a/plugins/picohttpparser/picohttpparser.c b/plugins/picohttpparser/picohttpparser.c index d9680b7..d0bfac6 100644 --- a/plugins/picohttpparser/picohttpparser.c +++ b/plugins/picohttpparser/picohttpparser.c @@ -400,7 +400,7 @@ int phr_parse_request(const char *buf_start, size_t len, const char **method, si *num_headers = 0; /* if last_len != 0, check if the request is complete (a fast countermeasure - againt slowloris */ + against slowloris */ if (last_len != 0 && is_complete(buf, buf_end, last_len, &r) == NULL) { return r; } @@ -435,7 +435,7 @@ static const char *parse_response(const char *buf, const char *buf_end, int *maj } PARSE_INT_3(status); - /* get message includig preceding space */ + /* get message including preceding space */ if ((buf = get_token_to_eol(buf, buf_end, msg, msg_len, ret)) == NULL) { return NULL; } diff --git a/plugins/popen.c b/plugins/popen.c index 9eb49b6..723817d 100644 --- a/plugins/popen.c +++ b/plugins/popen.c @@ -14,7 +14,7 @@ * FILE * spopen(const char *); * int spclose(FILE *); * -* Code taken with liitle modification from "Advanced Programming for the Unix +* Code taken with little modification from "Advanced Programming for the Unix * Environment" by W. Richard Stevens * * This is considered safe in that no shell is spawned, and the environment diff --git a/plugins/runcmd.c b/plugins/runcmd.c index a7155d2..1bd2ca1 100644 --- a/plugins/runcmd.c +++ b/plugins/runcmd.c @@ -203,7 +203,7 @@ np_runcmd_open(const char *cmdstring, int *pfd, int *pfderr) } /* parent picks up execution here */ - /* close childs descriptors in our address space */ + /* close children descriptors in our address space */ close(pfd[1]); close(pfderr[1]); diff --git a/plugins/t/check_by_ssh.t b/plugins/t/check_by_ssh.t index 1d2939e..b6479f1 100644 --- a/plugins/t/check_by_ssh.t +++ b/plugins/t/check_by_ssh.t @@ -19,19 +19,19 @@ plan skip_all => "SSH_HOST and SSH_IDENTITY must be defined" unless ($ssh_servic plan tests => 42; # Some random check strings/response -my @responce = ('OK: Everything is fine', +my @response = ('OK: Everything is fine', 'WARNING: Hey, pick me, pick me', 'CRITICAL: Shit happens', 'UNKNOWN: What can I do for ya', 'WOOPS: What did I smoke', ); -my @responce_re; +my @response_re; my @check; -for (@responce) { +for (@response) { push(@check, "echo $_"); my $re_str = $_; $re_str =~ s{(.)} { "\Q$1" }ge; - push(@responce_re, $re_str); + push(@response_re, $re_str); } my $result; @@ -47,7 +47,7 @@ for (my $i=0; $i<4; $i++) { "./check_by_ssh -i $ssh_key -H $ssh_service -C '$check[$i]; exit $i'" ); cmp_ok($result->return_code, '==', $i, "Exit with return code $i"); - is($result->output, $responce[$i], "Status text is correct for check $i"); + is($result->output, $response[$i], "Status text is correct for check $i"); } $result = NPTest->testCmd( @@ -84,7 +84,7 @@ $result = NPTest->testCmd( "./check_by_ssh -i $ssh_key -H $ssh_service -C '$check[4]; exit 8'" ); cmp_ok($result->return_code, '==', 8, "Exit with return code 8 (out of bounds)"); -is($result->output, $responce[4], "Return proper status text even with unknown status codes"); +is($result->output, $response[4], "Return proper status text even with unknown status codes"); $result = NPTest->testCmd( "./check_by_ssh -i $ssh_key -H $ssh_service -F $ssh_conf -C 'exit 0'" @@ -108,7 +108,7 @@ my %linemap = ( foreach my $line (0, 2, 4, 6) { my $code = $linemap{$line}; my $statline = $line+1; - is($lines[$line], "$responce[$code]", "multiple checks status text is correct for line $line"); + is($lines[$line], "$response[$code]", "multiple checks status text is correct for line $line"); is($lines[$statline], "STATUS CODE: $code", "multiple check status code is correct for line $line"); } @@ -124,7 +124,7 @@ close(PASV) or die("Unable to close '/tmp/check_by_ssh.$$': $!"); cmp_ok(scalar(@pasv), '==', 1, 'One passive result for one check performed'); for (0) { if ($pasv[$_]) { - like($pasv[$_], '/^\[\d+\] PROCESS_SERVICE_CHECK_RESULT;flint;serv;2;' . $responce_re[2] . '$/', 'proper result for passive check'); + like($pasv[$_], '/^\[\d+\] PROCESS_SERVICE_CHECK_RESULT;flint;serv;2;' . $response_re[2] . '$/', 'proper result for passive check'); } else { fail('proper result for passive check'); } @@ -144,7 +144,7 @@ for (0, 1, 2, 3, 4) { if ($pasv[$_]) { my $ret = $_; $ret = 9 if ($_ == 4); - like($pasv[$_], '/^\[\d+\] PROCESS_SERVICE_CHECK_RESULT;flint;c' . $_ . ';' . $ret . ';' . $responce_re[$_] . '$/', "proper result for passive check $_"); + like($pasv[$_], '/^\[\d+\] PROCESS_SERVICE_CHECK_RESULT;flint;c' . $_ . ';' . $ret . ';' . $response_re[$_] . '$/', "proper result for passive check $_"); } else { fail("proper result for passive check $_"); } diff --git a/plugins/t/check_disk.t b/plugins/t/check_disk.t index c8f08f5..ca035ce 100644 --- a/plugins/t/check_disk.t +++ b/plugins/t/check_disk.t @@ -326,19 +326,19 @@ cmp_ok( $result->return_code, '==', 0, "grouping: exit ok if the sum of free meg $result = NPTest->testCmd( "./check_disk -w ". ($free_mb_on_all - 1) ." -c ". ($free_mb_on_all - 1) ." -p $mountpoint_valid -g group -p $mountpoint2_valid" ); cmp_ok( $result->return_code, '==', 3, "Invalid options: -p must come after groupname"); -# regex: exit unknown if given regex is not compileable +# regex: exit unknown if given regex is not compilable $result = NPTest->testCmd( "./check_disk -w 1 -c 1 -r '('" ); -cmp_ok( $result->return_code, '==', 3, "Exit UNKNOWN if regex is not compileable"); +cmp_ok( $result->return_code, '==', 3, "Exit UNKNOWN if regex is not compilable"); -# ignore: exit unknown, if all pathes are deselected using -i +# ignore: exit unknown, if all paths are deselected using -i $result = NPTest->testCmd( "./check_disk -w 0% -c 0% -p $mountpoint_valid -p $mountpoint2_valid -i '$mountpoint_valid' -i '$mountpoint2_valid'" ); cmp_ok( $result->return_code, '==', 3, "ignore-ereg: Unknown if all fs are ignored (case sensitive)"); -# ignore: exit unknown, if all pathes are deselected using -I +# ignore: exit unknown, if all paths are deselected using -I $result = NPTest->testCmd( "./check_disk -w 0% -c 0% -p $mountpoint_valid -p $mountpoint2_valid -I '".uc($mountpoint_valid)."' -I '".uc($mountpoint2_valid)."'" ); cmp_ok( $result->return_code, '==', 3, "ignore-ereg: Unknown if all fs are ignored (case insensitive)"); -# ignore: exit unknown, if all pathes are deselected using -i +# ignore: exit unknown, if all paths are deselected using -i $result = NPTest->testCmd( "./check_disk -w 0% -c 0% -p $mountpoint_valid -p $mountpoint2_valid -i '.*'" ); cmp_ok( $result->return_code, '==', 3, "ignore-ereg: Unknown if all fs are ignored using -i '.*'"); @@ -347,7 +347,7 @@ $result = NPTest->testCmd( "./check_disk -w 0% -c 0% -p $mountpoint_valid -p $mo like( $result->output, qr/$mountpoint_valid/, "output data does have $mountpoint_valid in it"); unlike( $result->output, qr/$mountpoint2_valid/, "output data does not have $mountpoint2_valid in it"); -# ignore: test if all pathes are listed when ignore regex doesn't match +# ignore: test if all paths are listed when ignore regex doesn't match $result = NPTest->testCmd( "./check_disk -w 0% -c 0% -p $mountpoint_valid -p $mountpoint2_valid -i '^barbazJodsf\$'"); like( $result->output, qr/$mountpoint_valid/, "ignore: output data does have $mountpoint_valid when regex doesn't match"); like( $result->output, qr/$mountpoint2_valid/,"ignore: output data does have $mountpoint2_valid when regex doesn't match"); diff --git a/plugins/t/check_http.t b/plugins/t/check_http.t index 1ca52f6..1f2fbdf 100644 --- a/plugins/t/check_http.t +++ b/plugins/t/check_http.t @@ -178,13 +178,13 @@ SKIP: { $res = NPTest->testCmd( "./$plugin -I $host_tcp_proxy -p $port_tcp_proxy -u http://$host_tcp_http -e 200,301,302"); is( $res->return_code, 0, "Proxy HTTP works"); - like($res->output, qr/OK: Status line output matched/, "Proxy HTTP Output is sufficent"); + like($res->output, qr/OK: Status line output matched/, "Proxy HTTP Output is sufficient"); $res = NPTest->testCmd( "./$plugin -I $host_tcp_proxy -p $port_tcp_proxy -H $host_tls_http -S -j CONNECT"); is( $res->return_code, 0, "Proxy HTTP CONNECT works"); - like($res->output, qr/HTTP OK:/, "Proxy HTTP CONNECT output sufficent"); + like($res->output, qr/HTTP OK:/, "Proxy HTTP CONNECT output sufficient"); $res = NPTest->testCmd( "./$plugin -I $host_tcp_proxy -p $port_tcp_proxy -H $host_tls_http -S -j CONNECT:HEAD"); is( $res->return_code, 0, "Proxy HTTP CONNECT works with override method"); - like($res->output, qr/HTTP OK:/, "Proxy HTTP CONNECT output sufficent"); + like($res->output, qr/HTTP OK:/, "Proxy HTTP CONNECT output sufficient"); } diff --git a/plugins/t/check_mysql.t b/plugins/t/check_mysql.t index e426bf5..baf3acc 100644 --- a/plugins/t/check_mysql.t +++ b/plugins/t/check_mysql.t @@ -5,7 +5,7 @@ # # # These are the database permissions required for this test: -# GRANT SELECT ON $db.* TO $user@$host INDENTIFIED BY '$password'; +# GRANT SELECT ON $db.* TO $user@$host IDENTIFIED BY '$password'; # GRANT SUPER, REPLICATION CLIENT ON *.* TO $user@$host; # Check with: # mysql -u$user -p$password -h$host $db @@ -23,9 +23,9 @@ plan tests => 15; my $bad_login_output = '/Access denied for user /'; my $mysqlserver = getTestParameter("NP_MYSQL_SERVER", "A MySQL Server hostname or IP with no slaves setup"); my $mysqlsocket = getTestParameter("NP_MYSQL_SOCKET", "Full path to a MySQL Server socket with no slaves setup"); -my $mysql_login_details = getTestParameter("NP_MYSQL_LOGIN_DETAILS", "Command line parameters to specify login access (requires REPLICATION CLIENT privleges)", "-u test -ptest"); +my $mysql_login_details = getTestParameter("NP_MYSQL_LOGIN_DETAILS", "Command line parameters to specify login access (requires REPLICATION CLIENT privileges)", "-u test -ptest"); my $with_slave = getTestParameter("NP_MYSQL_WITH_SLAVE", "MySQL server with slaves setup"); -my $with_slave_login = getTestParameter("NP_MYSQL_WITH_SLAVE_LOGIN", "Login details for server with slave (requires REPLICATION CLIENT privleges)", $mysql_login_details || "-u test -ptest"); +my $with_slave_login = getTestParameter("NP_MYSQL_WITH_SLAVE_LOGIN", "Login details for server with slave (requires REPLICATION CLIENT privileges)", $mysql_login_details || "-u test -ptest"); my $result; diff --git a/plugins/t/check_mysql_query.t b/plugins/t/check_mysql_query.t index 96899ac..c30245b 100644 --- a/plugins/t/check_mysql_query.t +++ b/plugins/t/check_mysql_query.t @@ -31,7 +31,7 @@ $result = NPTest->testCmd("./check_mysql_query -q 'SELECT 1+1' -H $mysqlserver $ cmp_ok( $result->return_code, '==', 0, "Can run query"); $result = NPTest->testCmd("./check_mysql_query -H $mysqlserver $mysql_login_details"); -cmp_ok( $result->return_code, '==', 3, "Missing query parmeter"); +cmp_ok( $result->return_code, '==', 3, "Missing query parameter"); like( $result->output, "/Must specify a SQL query to run/", "Missing query error message"); $result = NPTest->testCmd("./check_mysql_query -q 'SELECT 1+1' -H $mysqlserver -u dummy -d mysql"); diff --git a/plugins/t/check_nagios.t b/plugins/t/check_nagios.t index 81fc24d..f38f5e9 100644 --- a/plugins/t/check_nagios.t +++ b/plugins/t/check_nagios.t @@ -36,7 +36,7 @@ cmp_ok( $result->return_code, '==', 1, "Log over 5 minutes old" ); like ( $result->output, $warningOutput, "Output for warning correct" ); my $now = time; -# This substitution is dependant on the testcase +# This substitution is dependent on the testcase system( "perl -pe 's/1133537544/$now/' $nagios1 > $nagios1.tmp" ) == 0 or die "Problem with munging $nagios1"; $result = NPTest->testCmd( diff --git a/plugins/t/negate.t b/plugins/t/negate.t index d96a109..5ec1c84 100644 --- a/plugins/t/negate.t +++ b/plugins/t/negate.t @@ -84,7 +84,7 @@ foreach my $current_state (keys(%state)) { foreach my $new_state (keys(%state)) { $res = NPTest->testCmd( "./negate -s --$current_state=$new_state ./check_dummy ".$state{$current_state}." 'Fake $new_state'" ); is( $res->return_code, $state{$new_state}, "Got fake $new_state (with substitute)" ); - is( $res->output, uc($new_state).": Fake $new_state", "Substitued fake $new_state output"); + is( $res->output, uc($new_state).": Fake $new_state", "Substituted fake $new_state output"); } } diff --git a/plugins/tests/check_snmp.t b/plugins/tests/check_snmp.t index bc03ec6..bfe42e1 100755 --- a/plugins/tests/check_snmp.t +++ b/plugins/tests/check_snmp.t @@ -53,7 +53,7 @@ if ($pid) { #print "child\n"; print "Please contact SNMP at: $port_snmp\n"; - close(STDERR); # Coment out to debug snmpd problems (most errors sent there are OK) + close(STDERR); # Comment out to debug snmpd problems (most errors sent there are OK) exec("snmpd -c tests/conf/snmpd.conf -C -f -r udp:$port_snmp"); } @@ -227,7 +227,7 @@ is($res->output, 'SNMP OK - "555\"I said\"" | ', "Check string with a double quo $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.15 -r 'CUSTOM CHECK OK'" ); is($res->return_code, 0, "String check should check whole string, not a parsed number" ); -is($res->output, 'SNMP OK - "CUSTOM CHECK OK: foo is 12345" | ', "String check witn numbers returns whole string"); +is($res->output, 'SNMP OK - "CUSTOM CHECK OK: foo is 12345" | ', "String check with numbers returns whole string"); $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.16 -w -2: -c -3:" ); is($res->return_code, 0, "Negative integer check OK" ); diff --git a/plugins/utils.h b/plugins/utils.h index 5b54da3..c76b321 100644 --- a/plugins/utils.h +++ b/plugins/utils.h @@ -7,7 +7,7 @@ /* The purpose of this package is to provide safer alternatives to C functions that might otherwise be vulnerable to hacking. This currently includes a standard suite of validation routines to be sure -that an string argument acually converts to its intended type and a +that an string argument actually converts to its intended type and a suite of string handling routine that do their own memory management in order to resist overflow attacks. In addition, a few functions are provided to standardize version and error reporting across the entire diff --git a/po/de.po b/po/de.po index c29cbbb..eee6245 100644 --- a/po/de.po +++ b/po/de.po @@ -936,12 +936,12 @@ msgstr "" #: plugins/check_fping.c:422 #, c-format msgid "%s: Only one threshold may be packet loss (%s)\n" -msgstr "%s: Nur ein Wert darf für paket loss angegeben werden (%s)\n" +msgstr "%s: Nur ein Wert darf für packet loss angegeben werden (%s)\n" #: plugins/check_fping.c:426 #, c-format msgid "%s: Only one threshold must be packet loss (%s)\n" -msgstr "%s: Nur ein Wert darf für paket loss angegeben werden (%s)\n" +msgstr "%s: Nur ein Wert darf für packet loss angegeben werden (%s)\n" #: plugins/check_fping.c:458 msgid "" @@ -4299,7 +4299,7 @@ msgid "This plugin will attempt to open an RTSP connection with the host." msgstr "Dieses plugin testet Gameserververbindungen zum angegebenen Host." #: plugins/check_real.c:438 plugins/check_smtp.c:830 -msgid "Successul connects return STATE_OK, refusals and timeouts return" +msgid "Successful connects return STATE_OK, refusals and timeouts return" msgstr "" #: plugins/check_real.c:439 @@ -4721,7 +4721,7 @@ msgid "" msgstr "" #: plugins/check_snmp.c:1143 -msgid "Add/substract the specified OFFSET to numeric sensor data" +msgid "Add/subtract the specified OFFSET to numeric sensor data" msgstr "" #: plugins/check_snmp.c:1147 @@ -4943,7 +4943,7 @@ msgid "" msgstr "" #: plugins/check_swap.c:541 -msgid "Exit with CRITCAL status if less than PERCENT of swap space is free" +msgid "Exit with CRITICAL status if less than PERCENT of swap space is free" msgstr "" #: plugins/check_swap.c:543 @@ -6372,7 +6372,7 @@ msgstr "" #~ " Exit with CRITICAL status if less than INTEGER --units of disk are " #~ "free\n" #~ " -c, --critical=PERCENT%%\n" -#~ " Exit with CRITCAL status if less than PERCENT of disk space is free\n" +#~ " Exit with CRITICAL status if less than PERCENT of disk space is free\n" #~ " -C, --clear\n" #~ " Clear thresholds\n" #~ msgstr "" diff --git a/po/fr.po b/po/fr.po index b4de17e..fe74036 100644 --- a/po/fr.po +++ b/po/fr.po @@ -4372,7 +4372,7 @@ msgid "This plugin will attempt to open an RTSP connection with the host." msgstr "Ce plugin va essayer d'ouvrir un connexion RTSP avec l'hôte." #: plugins/check_real.c:438 plugins/check_smtp.c:830 -msgid "Successul connects return STATE_OK, refusals and timeouts return" +msgid "Successful connects return STATE_OK, refusals and timeouts return" msgstr "" #: plugins/check_real.c:439 @@ -4784,7 +4784,7 @@ msgid "" msgstr "" #: plugins/check_snmp.c:1143 -msgid "Add/substract the specified OFFSET to numeric sensor data" +msgid "Add/subtract the specified OFFSET to numeric sensor data" msgstr "" #: plugins/check_snmp.c:1147 @@ -5021,7 +5021,7 @@ msgstr "" "sont libres" #: plugins/check_swap.c:541 -msgid "Exit with CRITCAL status if less than PERCENT of swap space is free" +msgid "Exit with CRITICAL status if less than PERCENT of swap space is free" msgstr "" "Sortir avec un résultat CRITIQUE si moins de X pour cent de mémoire " "virtuelle est libre" diff --git a/po/monitoring-plugins.pot b/po/monitoring-plugins.pot index 45f46a8..1535db8 100644 --- a/po/monitoring-plugins.pot +++ b/po/monitoring-plugins.pot @@ -4193,7 +4193,7 @@ msgid "This plugin will attempt to open an RTSP connection with the host." msgstr "" #: plugins/check_real.c:438 plugins/check_smtp.c:830 -msgid "Successul connects return STATE_OK, refusals and timeouts return" +msgid "Successful connects return STATE_OK, refusals and timeouts return" msgstr "" #: plugins/check_real.c:439 @@ -4597,7 +4597,7 @@ msgid "" msgstr "" #: plugins/check_snmp.c:1143 -msgid "Add/substract the specified OFFSET to numeric sensor data" +msgid "Add/subtract the specified OFFSET to numeric sensor data" msgstr "" #: plugins/check_snmp.c:1147 @@ -4817,7 +4817,7 @@ msgid "" msgstr "" #: plugins/check_swap.c:541 -msgid "Exit with CRITCAL status if less than PERCENT of swap space is free" +msgid "Exit with CRITICAL status if less than PERCENT of swap space is free" msgstr "" #: plugins/check_swap.c:543 diff --git a/tap/tap.3 b/tap/tap.3 index 4b23c24..dce85fc 100644 --- a/tap/tap.3 +++ b/tap/tap.3 @@ -291,7 +291,7 @@ always returns 0. .Xc .El .Pp -For maximum compatability your test program should return a particular +For maximum compatibility your test program should return a particular exit code. This is calculated by .Fn exit_status so it is sufficient to always return from @@ -309,7 +309,7 @@ directory in the source distribution contains numerous tests of functionality, written using .Nm . Examine them for examples of how to construct test suites. -.Sh COMPATABILITY +.Sh COMPATIBILITY .Nm strives to be compatible with the Perl Test::More and Test::Harness modules. The test suite verifies that diff --git a/tap/tap.h b/tap/tap.h index bd81789..8ee525c 100644 --- a/tap/tap.h +++ b/tap/tap.h @@ -25,7 +25,7 @@ */ /* '## __VA_ARGS__' is a gcc'ism. C99 doesn't allow the token pasting - and requires the caller to add the final comma if they've ommitted + and requires the caller to add the final comma if they've omitted the optional arguments */ #ifdef __GNUC__ # define ok(e, test, ...) ((e) ? \ diff --git a/tools/build_perl_modules b/tools/build_perl_modules index 5a57a47..b8cd34c 100755 --- a/tools/build_perl_modules +++ b/tools/build_perl_modules @@ -140,7 +140,7 @@ my $libs = "$destdir/$prefix/lib:$destdir/$prefix/lib/$Config{archname}"; my $topdir = cwd(); -# set an initial value if there isnt one already +# set an initial value if there isn't one already # Need to use PERL5LIB to ensure we get pre-installed mods from earlier # tags in the install_order file $ENV{PERL5LIB} ||= q{}; @@ -149,8 +149,8 @@ $ENV{PERL5LIB} ||= q{}; $ENV{PERL_AUTOINSTALL} = "--skipdeps"; # keep a record of how many times a module build is done. This is so they may -# be built a second time to include optional prereq's that couldnt -# previously be built due to circular dependancies +# be built a second time to include optional prereq's that couldn't +# previously be built due to circular dependencies my %built_modules; foreach my $tarball (@tarballs) { ( my $dir = $tarball ) =~ s/\.(?:tgz|tar.gz)$//; diff --git a/tools/p1.pl b/tools/p1.pl index 2788dbf..9cbe6dc 100644 --- a/tools/p1.pl +++ b/tools/p1.pl @@ -2,7 +2,7 @@ # # Hacked version of the sample code from the perlembedded doco. # -# Only major changes are to separate the compiling and cacheing from +# Only major changes are to separate the compiling and caching from # the execution so that the cache can be kept in "non-volatile" parent # process while the execution is done from "volatile" child processes # and that STDOUT is redirected to a file by means of a tied filehandle diff --git a/tools/tinderbox_build b/tools/tinderbox_build index 48836b1..1a41f57 100755 --- a/tools/tinderbox_build +++ b/tools/tinderbox_build @@ -138,7 +138,7 @@ sub BuildIt { # interprets that as the end of the mail, and truncates the log before # it gets to Tinderbox. (terry weismann, chris yeh) # -# This was replaced by a perl 'port' of the above, writen by +# This was replaced by a perl 'port' of the above, written by # preed@netscape.com; good things: no need for system() call, and now it's # all in perl, so we don't have to do OS checking like before. -- cgit v0.10-9-g596f From 24e99301b4776071b0d65df3426ebb41f4347475 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 16 Apr 2023 17:36:48 +0000 Subject: Fix a psuedo typo diff --git a/plugins/check_pgsql.c b/plugins/check_pgsql.c index c26cd43..94a03b2 100644 --- a/plugins/check_pgsql.c +++ b/plugins/check_pgsql.c @@ -93,7 +93,7 @@ int verbose = 0; /****************************************************************************** -The (psuedo?)literate programming XML is contained within \@\@\- \-\@\@ +The (pseudo?)literate programming XML is contained within \@\@\- \-\@\@ tags in the comments. With in the tags, the XML is assembled sequentially. You can define entities in tags. You also have all the #defines available as entities. diff --git a/plugins/check_radius.c b/plugins/check_radius.c index 96a9555..984aa37 100644 --- a/plugins/check_radius.c +++ b/plugins/check_radius.c @@ -97,7 +97,7 @@ int verbose = FALSE; /****************************************************************************** -The (psuedo?)literate programming XML is contained within \@\@\- \-\@\@ +The (pseudo?)literate programming XML is contained within \@\@\- \-\@\@ tags in the comments. With in the tags, the XML is assembled sequentially. You can define entities in tags. You also have all the #defines available as entities. -- cgit v0.10-9-g596f From 41fb615f3de34c3b3a344e74fd9cc24936cd58a6 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Fri, 14 Apr 2023 15:01:48 +0000 Subject: CI: Adding Codespell (and Super Linter) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 80d49f7..e825eb3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,9 +7,40 @@ on: pull_request: jobs: + codespell: + name: codespell + strategy: + fail-fast: false + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Codespell + uses: codespell-project/actions-codespell@master + 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 + check_filenames: true + check_hidden: true +# super-linter: +# name: super-linter +# strategy: +# fail-fast: false +# runs-on: ubuntu-latest +# steps: +# - name: Checkout +# uses: actions/checkout@v3 +# - name: Lint Code Base +# uses: github/super-linter@v5.0.0 +# env: +# DEFAULT_BRANCH: master +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # macos: # ... linux: + needs: + - codespell +# - super-linter runs-on: ubuntu-latest name: Running tests on ${{ matrix.distro }} strategy: -- cgit v0.10-9-g596f