From fbbc9fcbd566db60058047870fbd6a2105e96663 Mon Sep 17 00:00:00 2001
From: Lorenz <12514511+RincewindsHat@users.noreply.github.com>
Date: Sun, 11 Sep 2022 06:29:17 +0200
Subject: Check swap compiler warnings (#1756)
* Fix compiler warnings
* Fix superfluous whitespaces
---
plugins/check_swap.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/plugins/check_swap.c b/plugins/check_swap.c
index ff58b15f..a607da1e 100644
--- a/plugins/check_swap.c
+++ b/plugins/check_swap.c
@@ -410,7 +410,6 @@ check_swap(float free_swap_mb, float total_swap_mb)
uint64_t usage_percentage = ((total_swap_mb - free_swap_mb) / total_swap_mb) * 100;
if (crit.is_percentage &&
- usage_percentage >= 0 &&
crit.value != 0 &&
usage_percentage >= (100 - crit.value))
{
@@ -418,7 +417,6 @@ check_swap(float free_swap_mb, float total_swap_mb)
}
if (warn.is_percentage &&
- usage_percentage >= 0 &&
warn.value != 0 &&
usage_percentage >= (100 - warn.value))
{
@@ -475,10 +473,9 @@ process_arguments (int argc, char **argv)
if (is_uint64(optarg, &warn.value)) {
if (warn.value > 100) {
usage4 (_("Warning threshold percentage must be <= 100!"));
- } else {
- break;
}
}
+ break;
} else {
/* It's Bytes */
warn.is_percentage = 0;
@@ -506,10 +503,9 @@ process_arguments (int argc, char **argv)
if (is_uint64(optarg, &crit.value)) {
if (crit.value> 100) {
usage4 (_("Critical threshold percentage must be <= 100!"));
- } else {
- break;
}
}
+ break;
} else {
/* It's Bytes */
crit.is_percentage = 0;
@@ -527,6 +523,7 @@ process_arguments (int argc, char **argv)
if ((no_swap_state = mp_translate_state(optarg)) == ERROR) {
usage4 (_("no-swap result must be a valid state name (OK, WARNING, CRITICAL, UNKNOWN) or integer (0-3)."));
}
+ break;
case 'v': /* verbose */
verbose++;
break;
--
cgit v1.2.3-74-g34f1
From a9cdbc8959a7722494700aaddc63f0c7e0d34062 Mon Sep 17 00:00:00 2001
From: Lorenz <12514511+RincewindsHat@users.noreply.github.com>
Date: Sun, 11 Sep 2022 06:29:36 +0200
Subject: Check load compiler warnings (#1759)
* Fix compiler warnings due to implizit conversion and formats
* Make includes more specific and complement them
* Formatting fixes
---
plugins/check_load.c | 66 ++++++++++++++++++++++++++--------------------------
1 file changed, 33 insertions(+), 33 deletions(-)
diff --git a/plugins/check_load.c b/plugins/check_load.c
index 0e4de54e..d1bb30a4 100644
--- a/plugins/check_load.c
+++ b/plugins/check_load.c
@@ -1,41 +1,43 @@
/*****************************************************************************
-*
+*
* Monitoring check_load plugin
-*
+*
* License: GPL
* Copyright (c) 1999-2007 Monitoring Plugins Development Team
-*
+*
* Description:
-*
+*
* This file contains the check_load plugin
-*
+*
* This plugin tests the current system load average.
-*
-*
+*
+*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-*
+*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
-*
-*
+*
+*
*****************************************************************************/
const char *progname = "check_load";
const char *copyright = "1999-2007";
const char *email = "devel@monitoring-plugins.org";
-#include "common.h"
-#include "runcmd.h"
-#include "utils.h"
-#include "popen.h"
+#include "./common.h"
+#include "./runcmd.h"
+#include "./utils.h"
+#include "./popen.h"
+
+#include
#ifdef HAVE_SYS_LOADAVG_H
#include
@@ -101,7 +103,7 @@ get_threshold(char *arg, double *th)
int
main (int argc, char **argv)
{
- int result;
+ int result = -1;
int i;
long numcpus;
@@ -164,7 +166,7 @@ main (int argc, char **argv)
sscanf (input_buffer, "%*[^l]load averages: %lf, %lf, %lf", &la1, &la5, &la15);
}
else {
- printf (_("could not parse load from uptime %s: %s\n"), PATH_TO_UPTIME, result);
+ printf (_("could not parse load from uptime %s: %d\n"), PATH_TO_UPTIME, result);
return STATE_UNKNOWN;
}
@@ -289,7 +291,6 @@ process_arguments (int argc, char **argv)
}
-
static int
validate_arguments (void)
{
@@ -310,7 +311,6 @@ validate_arguments (void)
}
-
void
print_help (void)
{
@@ -321,7 +321,7 @@ print_help (void)
printf (_("This plugin tests the current system load average."));
- printf ("\n\n");
+ printf ("\n\n");
print_usage ();
@@ -329,15 +329,15 @@ print_help (void)
printf (UT_EXTRA_OPTS);
printf (" %s\n", "-w, --warning=WLOAD1,WLOAD5,WLOAD15");
- printf (" %s\n", _("Exit with WARNING status if load average exceeds WLOADn"));
- printf (" %s\n", "-c, --critical=CLOAD1,CLOAD5,CLOAD15");
- printf (" %s\n", _("Exit with CRITICAL status if load average exceed CLOADn"));
- printf (" %s\n", _("the load average format is the same used by \"uptime\" and \"w\""));
- printf (" %s\n", "-r, --percpu");
- printf (" %s\n", _("Divide the load averages by the number of CPUs (when possible)"));
- printf (" %s\n", "-n, --procs-to-show=NUMBER_OF_PROCS");
- printf (" %s\n", _("Number of processes to show when printing the top consuming processes."));
- printf (" %s\n", _("NUMBER_OF_PROCS=0 disables this feature. Default value is 0"));
+ printf (" %s\n", _("Exit with WARNING status if load average exceeds WLOADn"));
+ printf (" %s\n", "-c, --critical=CLOAD1,CLOAD5,CLOAD15");
+ printf (" %s\n", _("Exit with CRITICAL status if load average exceed CLOADn"));
+ printf (" %s\n", _("the load average format is the same used by \"uptime\" and \"w\""));
+ printf (" %s\n", "-r, --percpu");
+ printf (" %s\n", _("Divide the load averages by the number of CPUs (when possible)"));
+ printf (" %s\n", "-n, --procs-to-show=NUMBER_OF_PROCS");
+ printf (" %s\n", _("Number of processes to show when printing the top consuming processes."));
+ printf (" %s\n", _("NUMBER_OF_PROCS=0 disables this feature. Default value is 0"));
printf (UT_SUPPORT);
}
@@ -345,8 +345,8 @@ print_help (void)
void
print_usage (void)
{
- printf ("%s\n", _("Usage:"));
- printf ("%s [-r] -w WLOAD1,WLOAD5,WLOAD15 -c CLOAD1,CLOAD5,CLOAD15 [-n NUMBER_OF_PROCS]\n", progname);
+ printf ("%s\n", _("Usage:"));
+ printf ("%s [-r] -w WLOAD1,WLOAD5,WLOAD15 -c CLOAD1,CLOAD5,CLOAD15 [-n NUMBER_OF_PROCS]\n", progname);
}
#ifdef PS_USES_PROCPCPU
@@ -384,8 +384,8 @@ static int print_top_consuming_processes() {
#ifdef PS_USES_PROCPCPU
qsort(chld_out.line + 1, chld_out.lines - 1, sizeof(char*), cmpstringp);
#endif /* PS_USES_PROCPCPU */
- int lines_to_show = chld_out.lines < (n_procs_to_show + 1)
- ? chld_out.lines : n_procs_to_show + 1;
+ int lines_to_show = chld_out.lines < (size_t)(n_procs_to_show + 1)
+ ? (int)chld_out.lines : n_procs_to_show + 1;
for (i = 0; i < lines_to_show; i += 1) {
printf("%s\n", chld_out.line[i]);
}
--
cgit v1.2.3-74-g34f1
From ef5796255268cd663a4e66820cf1bd883055ba00 Mon Sep 17 00:00:00 2001
From: Lorenz <12514511+RincewindsHat@users.noreply.github.com>
Date: Sun, 11 Sep 2022 06:29:58 +0200
Subject: Check disk compiler warnings (#1758)
* Use unused variable
* Proper format strings for printf
* Use proper functions for absolute values
* Remove and add comments at some places
---
plugins/check_disk.c | 67 +++++++---------------------------------------------
1 file changed, 8 insertions(+), 59 deletions(-)
diff --git a/plugins/check_disk.c b/plugins/check_disk.c
index 66c5dd39..7018c6fd 100644
--- a/plugins/check_disk.c
+++ b/plugins/check_disk.c
@@ -171,7 +171,6 @@ main (int argc, char **argv)
char *perf_ilabel;
char *preamble;
char *flag_header;
- double inode_space_pct;
int temp_result;
struct mount_entry *me;
@@ -288,7 +287,7 @@ main (int argc, char **argv)
get_stats (path, &fsp);
if (verbose >= 3) {
- printf ("For %s, used_pct=%g free_pct=%g used_units=%llu free_units=%llu total_units=%llu used_inodes_pct=%g free_inodes_pct=%g fsp.fsu_blocksize=%llu mult=%llu\n",
+ printf ("For %s, used_pct=%g free_pct=%g used_units=%lu free_units=%lu total_units=%lu used_inodes_pct=%g free_inodes_pct=%g fsp.fsu_blocksize=%lu mult=%lu\n",
me->me_mountdir,
path->dused_pct,
path->dfree_pct,
@@ -369,10 +368,10 @@ main (int argc, char **argv)
critical_high_tide = UINT64_MAX;
if (path->freeinodes_percent->warning != NULL) {
- warning_high_tide = llabs( min( (double) warning_high_tide, (double) (1.0 - path->freeinodes_percent->warning->end/100)*path->inodes_total ));
+ warning_high_tide = (uint64_t) fabs( min( (double) warning_high_tide, (double) (1.0 - path->freeinodes_percent->warning->end/100)*path->inodes_total ));
}
if (path->freeinodes_percent->critical != NULL) {
- critical_high_tide = llabs( min( (double) critical_high_tide, (double) (1.0 - path->freeinodes_percent->critical->end/100)*path->inodes_total ));
+ critical_high_tide = (uint64_t) fabs( min( (double) critical_high_tide, (double) (1.0 - path->freeinodes_percent->critical->end/100)*path->inodes_total ));
}
xasprintf (&perf_ilabel, "%s (inodes)", (!strcmp(me->me_mountdir, "none") || display_mntp) ? me->me_devname : me->me_mountdir);
@@ -406,15 +405,7 @@ main (int argc, char **argv)
xasprintf(&output, "%s inode=%.0f%%)%s;", output, path->dfree_inodes_percent, ((disk_result && verbose >= 1) ? "]" : ""));
}
free(flag_header);
- /* TODO: Need to do a similar debug line
- xasprintf (&details, _("%s\n\%.0f of %.0f %s (%.0f%% inode=%.0f%%) free on %s (type %s mounted on %s) warn:%lu crit:%lu warn%%:%.0f%% crit%%:%.0f%%"),
- details, dfree_units, dtotal_units, units, dfree_pct, inode_space_pct,
- me->me_devname, me->me_type, me->me_mountdir,
- (unsigned long)w_df, (unsigned long)c_df, w_dfp, c_dfp);
- */
-
}
-
}
if (verbose >= 2)
@@ -689,6 +680,7 @@ process_arguments (int argc, char **argv)
break;
case 'I':
cflags |= REG_ICASE;
+ // Intentional fallthrough
case 'i':
if (!path_selected)
die (STATE_UNKNOWN, "DISK %s: %s\n", _("UNKNOWN"), _("Paths need to be selected before using -i/-I. Use -A to select all paths explicitly"));
@@ -728,8 +720,10 @@ process_arguments (int argc, char **argv)
case 'A':
optarg = strdup(".*");
+ // Intentional fallthrough
case 'R':
cflags |= REG_ICASE;
+ // Intentional fallthrough
case 'r':
if (! (warn_freespace_units || crit_freespace_units || warn_freespace_percent ||
crit_freespace_percent || warn_usedspace_units || crit_usedspace_units ||
@@ -862,51 +856,6 @@ set_all_thresholds (struct parameter_list *path)
set_thresholds(&path->freeinodes_percent, warn_freeinodes_percent, crit_freeinodes_percent);
}
-/* TODO: Remove?
-
-int
-validate_arguments (uintmax_t w, uintmax_t c, double wp, double cp, double iwp, double icp, char *mypath)
-{
- if (w < 0 && c < 0 && wp < 0.0 && cp < 0.0) {
- printf (_("INPUT ERROR: No thresholds specified"));
- print_path (mypath);
- return ERROR;
- }
- else if ((wp >= 0.0 || cp >= 0.0) &&
- (wp < 0.0 || cp < 0.0 || wp > 100.0 || cp > 100.0 || cp > wp)) {
- printf (_("\
-INPUT ERROR: C_DFP (%f) should be less than W_DFP (%.1f) and both should be between zero and 100 percent, inclusive"),
- cp, wp);
- print_path (mypath);
- return ERROR;
- }
- else if ((iwp >= 0.0 || icp >= 0.0) &&
- (iwp < 0.0 || icp < 0.0 || iwp > 100.0 || icp > 100.0 || icp > iwp)) {
- printf (_("\
-INPUT ERROR: C_IDFP (%f) should be less than W_IDFP (%.1f) and both should be between zero and 100 percent, inclusive"),
- icp, iwp);
- print_path (mypath);
- return ERROR;
- }
- else if ((w > 0 || c > 0) && (w == 0 || c == 0 || c > w)) {
- printf (_("\
-INPUT ERROR: C_DF (%lu) should be less than W_DF (%lu) and both should be greater than zero"),
- (unsigned long)c, (unsigned long)w);
- print_path (mypath);
- return ERROR;
- }
-
- return OK;
-}
-
-*/
-
-
-
-
-
-
-
void
print_help (void)
{
@@ -1042,7 +991,7 @@ get_stats (struct parameter_list *p, struct fs_usage *fsp) {
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)
- printf("Group %s: adding %llu blocks sized %llu, (%s) used_units=%lu free_units=%llu total_units=%llu mult=%llu\n",
+ printf("Group %s: adding %lu blocks sized %lu, (%s) used_units=%lu free_units=%lu total_units=%lu mult=%lu\n",
p_list->group,
tmpfsp.fsu_blocks,
tmpfsp.fsu_blocksize,
@@ -1071,7 +1020,7 @@ get_stats (struct parameter_list *p, struct fs_usage *fsp) {
first = 0;
}
if (verbose >= 3)
- printf("Group %s now has: used_units=%llu free_units=%llu total_units=%llu fsu_blocksize=%llu mult=%llu\n",
+ printf("Group %s now has: used_units=%lu free_units=%lu total_units=%lu fsu_blocksize=%lu mult=%lu\n",
p->group,
p->dused_units,
p->dfree_units,
--
cgit v1.2.3-74-g34f1
From b89aee56964f7d933f2da5f371e32b4d7db9410b Mon Sep 17 00:00:00 2001
From: Lorenz <12514511+RincewindsHat@users.noreply.github.com>
Date: Wed, 14 Sep 2022 10:54:46 +0200
Subject: Check ntp remove unused variables (#1781)
* Remove unused argument
* Fix typo in comment
---
plugins/check_ntp.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/plugins/check_ntp.c b/plugins/check_ntp.c
index 914b40ce..8b776ba1 100644
--- a/plugins/check_ntp.c
+++ b/plugins/check_ntp.c
@@ -355,7 +355,7 @@ int best_offset_server(const ntp_server_results *slist, int nservers){
* - we also "manually" handle resolving host names and connecting, because
* we have to do it in a way that our lazy macros don't handle currently :( */
double offset_request(const char *host, int *status){
- int i=0, j=0, ga_result=0, num_hosts=0, *socklist=NULL, respnum=0;
+ int i=0, ga_result=0, num_hosts=0, *socklist=NULL, respnum=0;
int servers_completed=0, one_read=0, servers_readable=0, best_index=-1;
time_t now_time=0, start_ts=0;
ntp_message *req=NULL;
@@ -488,7 +488,7 @@ double offset_request(const char *host, int *status){
/* cleanup */
/* FIXME: Not closing the socket to avoid re-use of the local port
* which can cause old NTP packets to be read instead of NTP control
- * pactets in jitter_request(). THERE MUST BE ANOTHER WAY...
+ * packets in jitter_request(). THERE MUST BE ANOTHER WAY...
* for(j=0; j
Date: Mon, 11 Apr 2016 12:52:02 -0500
Subject: Added ability to correctly check redirects with reference format
//test.server.com/folder
Referenced redirect of the format //www.server.com/folder would result
in check_http trying to contact http://hostname:80//www.server.com/folder
instead of http://www.server.com/folder. Referenced redirect of this format
is listed in rfc3986 ( https://tools.ietf.org/html/rfc3986 ). It should
work as expected now.
---
plugins/check_http.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/plugins/check_http.c b/plugins/check_http.c
index f8ec853b..36f3b253 100644
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
@@ -1364,6 +1364,9 @@ check_http (void)
#define HD3 URI_HTTP "://" URI_HOST ":" URI_PORT
#define HD4 URI_HTTP "://" URI_HOST
#define HD5 URI_PATH
+/* relative reference redirect like //www.site.org/test https://tools.ietf.org/html/rfc3986 */
+#define HD6 "//" URI_HOST "/" URI_PATH
+
void
redir (char *pos, char *status_line)
@@ -1440,6 +1443,21 @@ redir (char *pos, char *status_line)
use_ssl = server_type_check (type);
i = server_port_check (use_ssl);
}
+ else if (sscanf (pos, HD6, addr, url) == 2) {
+ //get type from
+ if(use_ssl){
+ //i = server_port_check (use_ssl);
+ strcpy (type,"https");
+ }
+ //else if(sscanf(server_url,URI_HTTP,type)==1 ){
+ //}
+ else{
+ strcpy (type, server_type);
+ }
+ xasprintf (&url, "/%s", url);
+ use_ssl = server_type_check (type);
+ i = server_port_check (use_ssl);
+ }
/* URI_PATH */
else if (sscanf (pos, HD5, url) == 1) {
--
cgit v1.2.3-74-g34f1
From d57d2b0bdda192dc50e17ebeb8becfe249c3f8e3 Mon Sep 17 00:00:00 2001
From: Eric Wunderlin
Date: Tue, 12 Apr 2016 09:00:08 -0500
Subject: Remove unused code
---
plugins/check_http.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/plugins/check_http.c b/plugins/check_http.c
index 36f3b253..59755acd 100644
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
@@ -1444,13 +1444,9 @@ redir (char *pos, char *status_line)
i = server_port_check (use_ssl);
}
else if (sscanf (pos, HD6, addr, url) == 2) {
- //get type from
if(use_ssl){
- //i = server_port_check (use_ssl);
strcpy (type,"https");
}
- //else if(sscanf(server_url,URI_HTTP,type)==1 ){
- //}
else{
strcpy (type, server_type);
}
--
cgit v1.2.3-74-g34f1
From e2e405596a070ec3b830696ecf574ee3a243c7b1 Mon Sep 17 00:00:00 2001
From: "John C. Frickson"
Date: Mon, 21 Nov 2016 22:40:39 +0100
Subject: I had to make a couple of small changes.
---
plugins/check_http.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/plugins/check_http.c b/plugins/check_http.c
index 59755acd..fb38bc5b 100644
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
@@ -1363,10 +1363,9 @@ check_http (void)
#define HD2 URI_HTTP "://" URI_HOST "/" URI_PATH
#define HD3 URI_HTTP "://" URI_HOST ":" URI_PORT
#define HD4 URI_HTTP "://" URI_HOST
-#define HD5 URI_PATH
/* relative reference redirect like //www.site.org/test https://tools.ietf.org/html/rfc3986 */
-#define HD6 "//" URI_HOST "/" URI_PATH
-
+#define HD5 "//" URI_HOST "/" URI_PATH
+#define HD5 URI_PATH
void
redir (char *pos, char *status_line)
@@ -1443,7 +1442,8 @@ redir (char *pos, char *status_line)
use_ssl = server_type_check (type);
i = server_port_check (use_ssl);
}
- else if (sscanf (pos, HD6, addr, url) == 2) {
+ /* URI_HTTP, URI_HOST, URI_PATH */
+ else if (sscanf (pos, HD5, addr, url) == 2) {
if(use_ssl){
strcpy (type,"https");
}
@@ -1456,7 +1456,7 @@ redir (char *pos, char *status_line)
}
/* URI_PATH */
- else if (sscanf (pos, HD5, url) == 1) {
+ else if (sscanf (pos, HD6, url) == 1) {
/* relative url */
if ((url[0] != '/')) {
if ((x = strrchr(server_url, '/')))
--
cgit v1.2.3-74-g34f1
From 80872917294340a1e399b8a100c5a81c4f719220 Mon Sep 17 00:00:00 2001
From: Jan Wagner
Date: Sat, 31 Dec 2016 13:57:44 +0100
Subject: check_http: Fix HD6 definition
---
plugins/check_http.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins/check_http.c b/plugins/check_http.c
index fb38bc5b..ff39c591 100644
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
@@ -1365,7 +1365,7 @@ check_http (void)
#define HD4 URI_HTTP "://" URI_HOST
/* relative reference redirect like //www.site.org/test https://tools.ietf.org/html/rfc3986 */
#define HD5 "//" URI_HOST "/" URI_PATH
-#define HD5 URI_PATH
+#define HD6 URI_PATH
void
redir (char *pos, char *status_line)
--
cgit v1.2.3-74-g34f1
From b90a5757f77cdc0434fa3f45cf59c63b9e695d90 Mon Sep 17 00:00:00 2001
From: Lorenz <12514511+RincewindsHat@users.noreply.github.com>
Date: Mon, 19 Sep 2022 10:23:49 +0200
Subject: Display total and scaled load values if check_load scales the values
by number of CPUs (#1778)
* Renew copyright
* Display more verbose output, if scaled load values are used
* Actually use scaled value for determining status and print the fitting perfdata depending on input parameters
* Add test cases for scaled mode
---
plugins/check_load.c | 56 +++++++++++++++++++++++++++++++++++---------------
plugins/t/check_load.t | 15 ++++++++++----
2 files changed, 51 insertions(+), 20 deletions(-)
diff --git a/plugins/check_load.c b/plugins/check_load.c
index d1bb30a4..00f7c877 100644
--- a/plugins/check_load.c
+++ b/plugins/check_load.c
@@ -29,7 +29,7 @@
*****************************************************************************/
const char *progname = "check_load";
-const char *copyright = "1999-2007";
+const char *copyright = "1999-2022";
const char *email = "devel@monitoring-plugins.org";
#include "./common.h"
@@ -70,7 +70,7 @@ double cload[3] = { 0.0, 0.0, 0.0 };
#define la15 la[2]
char *status_line;
-int take_into_account_cpus = 0;
+bool take_into_account_cpus = false;
static void
get_threshold(char *arg, double *th)
@@ -178,13 +178,6 @@ main (int argc, char **argv)
# endif
#endif
- if (take_into_account_cpus == 1) {
- if ((numcpus = GET_NUMBER_OF_CPUS()) > 0) {
- la[0] = la[0] / numcpus;
- la[1] = la[1] / numcpus;
- la[2] = la[2] / numcpus;
- }
- }
if ((la[0] < 0.0) || (la[1] < 0.0) || (la[2] < 0.0)) {
#ifdef HAVE_GETLOADAVG
printf (_("Error in getloadavg()\n"));
@@ -202,18 +195,49 @@ main (int argc, char **argv)
result = STATE_OK;
xasprintf(&status_line, _("load average: %.2f, %.2f, %.2f"), la1, la5, la15);
+ xasprintf(&status_line, ("total %s"), status_line);
+
+
+ double scaled_la[3] = { 0.0, 0.0, 0.0 };
+ bool is_using_scaled_load_values = false;
+
+ if (take_into_account_cpus == true && (numcpus = GET_NUMBER_OF_CPUS()) > 0) {
+ is_using_scaled_load_values = true;
+
+ scaled_la[0] = la[0] / numcpus;
+ scaled_la[1] = la[1] / numcpus;
+ scaled_la[2] = la[2] / numcpus;
+
+ char *tmp = NULL;
+ xasprintf(&tmp, _("load average: %.2f, %.2f, %.2f"), scaled_la[0], scaled_la[1], scaled_la[2]);
+ xasprintf(&status_line, "scaled %s - %s", tmp, status_line);
+ }
for(i = 0; i < 3; i++) {
- if(la[i] > cload[i]) {
- result = STATE_CRITICAL;
- break;
+ if (is_using_scaled_load_values) {
+ if(scaled_la[i] > cload[i]) {
+ result = STATE_CRITICAL;
+ break;
+ }
+ else if(scaled_la[i] > wload[i]) result = STATE_WARNING;
+ } else {
+ if(la[i] > cload[i]) {
+ result = STATE_CRITICAL;
+ break;
+ }
+ else if(la[i] > wload[i]) result = STATE_WARNING;
}
- else if(la[i] > wload[i]) result = STATE_WARNING;
}
printf("LOAD %s - %s|", state_text(result), status_line);
- for(i = 0; i < 3; i++)
- printf("load%d=%.3f;%.3f;%.3f;0; ", nums[i], la[i], wload[i], cload[i]);
+ for(i = 0; i < 3; i++) {
+ if (is_using_scaled_load_values) {
+ printf("load%d=%.3f;;;0; ", nums[i], la[i]);
+ printf("scaled_load%d=%.3f;%.3f;%.3f;0; ", nums[i], scaled_la[i], wload[i], cload[i]);
+ } else {
+ printf("load%d=%.3f;%.3f;%.3f;0; ", nums[i], la[i], wload[i], cload[i]);
+ }
+ }
putchar('\n');
if (n_procs_to_show > 0) {
@@ -257,7 +281,7 @@ process_arguments (int argc, char **argv)
get_threshold(optarg, cload);
break;
case 'r': /* Divide load average by number of CPUs */
- take_into_account_cpus = 1;
+ take_into_account_cpus = true;
break;
case 'V': /* version */
print_revision (progname, NP_VERSION);
diff --git a/plugins/t/check_load.t b/plugins/t/check_load.t
index 60837ef6..bba8947c 100644
--- a/plugins/t/check_load.t
+++ b/plugins/t/check_load.t
@@ -11,10 +11,12 @@ use NPTest;
my $res;
my $loadValue = "[0-9]+\.?[0-9]+";
-my $successOutput = "/^LOAD OK - load average: $loadValue, $loadValue, $loadValue/";
-my $failureOutput = "/^LOAD CRITICAL - load average: $loadValue, $loadValue, $loadValue/";
+my $successOutput = "/^LOAD OK - total load average: $loadValue, $loadValue, $loadValue/";
+my $successScaledOutput = "/^LOAD OK - scaled load average: $loadValue, $loadValue, $loadValue - total load average: $loadValue, $loadValue, $loadValue/";
+my $failureOutput = "/^LOAD CRITICAL - total load average: $loadValue, $loadValue, $loadValue/";
+my $failurScaledOutput = "/^LOAD CRITICAL - scaled load average: $loadValue, $loadValue, $loadValue - total load average: $loadValue, $loadValue, $loadValue/";
-plan tests => 11;
+plan tests => 13;
$res = NPTest->testCmd( "./check_load -w 100,100,100 -c 100,100,100" );
cmp_ok( $res->return_code, 'eq', 0, "load not over 100");
@@ -26,7 +28,7 @@ like( $res->output, $failureOutput, "Output OK");
$res = NPTest->testCmd( "./check_load -r -w 0,0,0 -c 0,0,0" );
cmp_ok( $res->return_code, 'eq', 2, "Load over 0 with per cpu division");
-like( $res->output, $failureOutput, "Output OK");
+like( $res->output, $failurScaledOutput, "Output OK");
$res = NPTest->testCmd( "./check_load -w 100 -c 100,110" );
cmp_ok( $res->return_code, 'eq', 0, "Plugin can handle non-triplet-arguments");
@@ -34,3 +36,8 @@ like( $res->output, $successOutput, "Output OK");
like( $res->perf_output, "/load1=$loadValue;100.000;100.000/", "Test handling of non triplet thresholds (load1)");
like( $res->perf_output, "/load5=$loadValue;100.000;110.000/", "Test handling of non triplet thresholds (load5)");
like( $res->perf_output, "/load15=$loadValue;100.000;110.000/", "Test handling of non triplet thresholds (load15)");
+
+
+$res = NPTest->testCmd( "./check_load -w 100,100,100 -c 100,100,100 -r" );
+cmp_ok( $res->return_code, 'eq', 0, "load not over 100");
+like( $res->output, $successScaledOutput, "Output OK");
--
cgit v1.2.3-74-g34f1
From 1ec6b162cb4e9fb96dcc45319b62fc7e2b3c8726 Mon Sep 17 00:00:00 2001
From: Lorenz <12514511+RincewindsHat@users.noreply.github.com>
Date: Fri, 7 Oct 2022 11:44:47 +0200
Subject: Replace egrep with grep -E (#1791)
Replace egrep with grep -E to avoid the deprecation warnings
---
configure.ac | 126 +++++++++++++++++++--------------------
pkg/solaris/solpkg | 2 +-
plugins-scripts/check_sensors.sh | 4 +-
3 files changed, 66 insertions(+), 66 deletions(-)
diff --git a/configure.ac b/configure.ac
index 8c5ca70a..87a84a0c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -427,7 +427,7 @@ if test "$ac_cv_header_utmpx_h" = "no" -a "$ac_cv_header_wtsapi32_h" = "no"
then
AC_PATH_PROG(PATH_TO_WHO,who)
- if [$PATH_TO_WHO -q 2>/dev/null | egrep -i "^# users=[0-9]+$" >/dev/null]
+ if [$PATH_TO_WHO -q 2>/dev/null | grep -E -i "^# users=[0-9]+$" >/dev/null]
then
ac_cv_path_to_who="$PATH_TO_WHO -q"
else
@@ -776,7 +776,7 @@ dnl Removing this for the moment - Ton
dnl Using /usr/ucb/ps on Solaris systems, to avoid truncation
dnl Limitation that command name is not available
dnl elif test "$ac_cv_uname_s" = "SunOS" && /usr/ucb/ps -alxwwn 2>/dev/null | \
-dnl egrep -i ["^ *F +UID +PID +PPID +%C +PRI +NI +SZ +RSS +WCHAN +S +TT +TIME +COMMAND"] > /dev/null
+dnl grep -E -i ["^ *F +UID +PID +PPID +%C +PRI +NI +SZ +RSS +WCHAN +S +TT +TIME +COMMAND"] > /dev/null
dnl then
dnl ac_cv_ps_varlist="[&procuid,&procpid,&procppid,&procpcpu,&procvsz,&procrss,procstat,&pos]"
dnl ac_cv_ps_command="/usr/ucb/ps -alxwwn"
@@ -786,7 +786,7 @@ dnl AC_MSG_RESULT([$ac_cv_ps_command])
dnl This one is the exact same test as the next one but includes etime
elif ps axwo 'stat comm vsz rss user uid pid ppid etime args' 2>/dev/null | \
- egrep -i ["^ *STAT +[UCOMAND]+ +VSZ +RSS +USER +UID +PID +PPID +ELAPSED +COMMAND"] > /dev/null
+ grep -E -i ["^ *STAT +[UCOMAND]+ +VSZ +RSS +USER +UID +PID +PPID +ELAPSED +COMMAND"] > /dev/null
then
ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procetime,procprog,&pos]"
ac_cv_ps_command="$PATH_TO_PS axwo 'stat uid pid ppid vsz rss pcpu etime comm args'"
@@ -797,7 +797,7 @@ then
dnl Some gnu/linux systems (debian for one) don't like -axwo and need axwo.
dnl so test for this first...
elif ps axwo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
- egrep -i ["^ *STAT +[UCOMAND]+ +VSZ +RSS +USER +UID +PID +PPID +COMMAND"] > /dev/null
+ grep -E -i ["^ *STAT +[UCOMAND]+ +VSZ +RSS +USER +UID +PID +PPID +COMMAND"] > /dev/null
then
ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
ac_cv_ps_command="$PATH_TO_PS axwo 'stat uid pid ppid vsz rss pcpu comm args'"
@@ -809,7 +809,7 @@ dnl For OpenBSD 3.2 & 3.3. Must come before ps -weo
dnl Should also work for FreeBSD 5.2.1 and 5.3
dnl STAT UCOMM VSZ RSS USER PPID COMMAND
elif ps -axwo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
- egrep -i ["^ *STAT +[UCOMAND]+ +VSZ +RSS +USER +UID +PID +PPID +COMMAND"] > /dev/null
+ grep -E -i ["^ *STAT +[UCOMAND]+ +VSZ +RSS +USER +UID +PID +PPID +COMMAND"] > /dev/null
then
ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
ac_cv_ps_command="$PATH_TO_PS -axwo 'stat uid pid ppid vsz rss pcpu comm args'"
@@ -821,7 +821,7 @@ dnl Some *BSDs have different format for ps. This is mainly to catch FreeBSD 4.
dnl Limitation: Only first 16 chars returned for ucomm field
dnl Must come before ps -weo
elif ps -axwo 'stat uid pid ppid vsz rss pcpu ucomm command' 2>/dev/null | \
- egrep -i ["^ *STAT +UID +PID +PPID +VSZ +RSS +%CPU +UCOMM +COMMAND"] > /dev/null
+ grep -E -i ["^ *STAT +UID +PID +PPID +VSZ +RSS +%CPU +UCOMM +COMMAND"] > /dev/null
then
ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
ac_cv_ps_command="$PATH_TO_PS -axwo 'stat uid pid ppid vsz rss pcpu ucomm command'"
@@ -831,7 +831,7 @@ then
dnl STAT UCOMM VSZ RSS USER UID PPID COMMAND
elif ps -weo 'stat comm vsz rss user uid pid ppid etime args' 2>/dev/null | \
- egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[ID]+ +P[PID]+ +[ELAPSD]+ +[RGSCOMDNA]+"] >/dev/null
+ grep -E -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[ID]+ +P[PID]+ +[ELAPSD]+ +[RGSCOMDNA]+"] >/dev/null
then
ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procetime,procprog,&pos]"
ac_cv_ps_command="$PATH_TO_PS -weo 'stat uid pid ppid vsz rss pcpu etime comm args'"
@@ -841,7 +841,7 @@ then
dnl FreeBSD
elif ps waxco 'state command vsz rss uid user pid ppid' 2>/dev/null | \
- egrep -i ["^STAT +COMMAND +VSZ +RSS +UID +USER +PID +PPID"] >/dev/null
+ grep -E -i ["^STAT +COMMAND +VSZ +RSS +UID +USER +PID +PPID"] >/dev/null
then
ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
ac_cv_ps_command="$PATH_TO_PS waxco 'state uid pid ppid vsz rss pcpu command command'"
@@ -851,7 +851,7 @@ then
dnl BSD-like mode in RH 6.1
elif ps waxno 'state comm vsz rss uid user pid ppid args' 2>/dev/null | \
- egrep -i ["^S +COMMAND +VSZ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
+ grep -E -i ["^S +COMMAND +VSZ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
then
ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
ac_cv_ps_command="$PATH_TO_PS waxno 'state uid pid ppid vsz rss pcpu comm args'"
@@ -863,7 +863,7 @@ dnl SunOS 4.1.3:
dnl F UID PID PPID CP PRI NI SZ RSS WCHAN STAT TT TIME COMMAND
dnl Need the head -1 otherwise test will work because arguments are found
elif ps -laxnwww 2>/dev/null | head -1 | \
- egrep -i ["^ *F(LAGS)? +UID +PID +PPID +CP +PRI +NI +(SZ)|(VSZ)|(SIZE) +RSS +WCHAN +STAT? +TTY? +TIME +COMMAND"] >/dev/null
+ grep -E -i ["^ *F(LAGS)? +UID +PID +PPID +CP +PRI +NI +(SZ)|(VSZ)|(SIZE) +RSS +WCHAN +STAT? +TTY? +TIME +COMMAND"] >/dev/null
then
ac_cv_ps_varlist="[&procuid,&procpid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
ac_cv_ps_command="$PATH_TO_PS -laxnwww"
@@ -876,7 +876,7 @@ dnl FLAGS UID PID PPID PRI NI SIZE RSS WCHAN STA TTY TIME COMMA
dnl 100 0 1 0 0 0 776 76 c0131c8c S ffff 0:11 init [2]
dnl
elif ps laxnwww 2>/dev/null | \
- egrep -i ["^ *F(LAGS)? +UID +PID +PPID +PRI +NI +(VSZ)|(SIZE) +RSS +WCHAN +STAT? TTY +TIME +COMMAND"] >/dev/null
+ grep -E -i ["^ *F(LAGS)? +UID +PID +PPID +PRI +NI +(VSZ)|(SIZE) +RSS +WCHAN +STAT? TTY +TIME +COMMAND"] >/dev/null
then
ac_cv_ps_varlist="[&procuid,&procpid,&procppid,procstat,&procvsz,&procrss,&pos,procprog]"
ac_cv_ps_command="$PATH_TO_PS laxnwww"
@@ -886,7 +886,7 @@ then
dnl OpenBSD (needs to come early because -exo appears to work, but does not give all procs)
elif ps -axo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
- egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
+ grep -E -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
then
ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
ac_cv_ps_command="$PATH_TO_PS -axo 'stat uid pid ppid vsz rss pcpu comm args'"
@@ -899,7 +899,7 @@ dnl Has /usr/bin/ps and /sbin/ps - force sbin version
dnl Can't use vsize and rssize because comes back with text (eg, 1.5M instead
dnl of 1500). Will need big changes to check_procs to support
elif /sbin/ps -eo 'stat uid pid ppid pcpu etime comm args' 2>/dev/null | \
- egrep -i ["^ *S +[UID]+ +[PID]+ +[PID]+ +[%CPU]+ +[ELAPSD]+ +[COMMAND]+ +[COMMAND]+"] > /dev/null
+ grep -E -i ["^ *S +[UID]+ +[PID]+ +[PID]+ +[%CPU]+ +[ELAPSD]+ +[COMMAND]+ +[COMMAND]+"] > /dev/null
then
ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procpcpu,procetime,procprog,&pos]"
ac_cv_ps_command="/sbin/ps -eo 'stat uid pid ppid pcpu etime comm args'"
@@ -908,7 +908,7 @@ then
AC_MSG_RESULT([$ac_cv_ps_command])
elif ps -eo 's comm vsz rss user uid pid ppid args' 2>/dev/null | \
- egrep -i ["^S[TAUES]* +C[OMDNA]+ +[VSIZE]+ +U[SER]+ +U[ID]+ +P[PID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
+ grep -E -i ["^S[TAUES]* +C[OMDNA]+ +[VSIZE]+ +U[SER]+ +U[ID]+ +P[PID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
then
ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
ac_cv_ps_command="$PATH_TO_PS -eo 's uid pid ppid vsz rss pcpu comm args'"
@@ -918,7 +918,7 @@ then
dnl AIX 4.3.3 and 5.1 do not have an rss field
elif ps -eo 'stat uid pid ppid vsz pcpu comm args' 2>/dev/null | \
- egrep -i ["^ *S[TAUES]* +UID +PID +PPID +VSZ +%CPU +COMMAND +COMMAND"] >/dev/null
+ grep -E -i ["^ *S[TAUES]* +UID +PID +PPID +VSZ +%CPU +COMMAND +COMMAND"] >/dev/null
then
ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procpcpu,procprog,&pos]"
ac_cv_ps_command="$PATH_TO_PS -eo 'stat uid pid ppid vsz pcpu comm args'"
@@ -928,7 +928,7 @@ then
dnl Solaris 2.6
elif ps -Ao 's comm vsz rss uid user pid ppid args' 2>/dev/null | \
- egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
+ grep -E -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/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'"
@@ -939,7 +939,7 @@ then
AC_MSG_RESULT([$ac_cv_ps_command])
elif ps -Ao 'status comm vsz rss uid user pid ppid args' 2>/dev/null | \
- egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
+ grep -E -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
then
ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
ac_cv_ps_command="$PATH_TO_PS -Ao 'status uid pid ppid vsz rss pcpu comm args'"
@@ -948,7 +948,7 @@ then
AC_MSG_RESULT([$ac_cv_ps_command])
elif ps -Ao 'state comm vsz rss uid user pid ppid args' 2>/dev/null | \
- egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
+ grep -E -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
then
ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
ac_cv_ps_command="$PATH_TO_PS -Ao 'state uid pid ppid vsz rss pcpu comm args'"
@@ -958,7 +958,7 @@ then
dnl wonder who takes state instead of stat
elif ps -ao 'state command vsz rss user pid ppid args' 2>/dev/null | \
- egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
+ grep -E -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PID +PPID +[RGSCOMDNA]+"] >/dev/null
then
ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
ac_cv_ps_command="$PATH_TO_PS -ao 'state uid pid ppid vsz rss pcpu command args'"
@@ -968,7 +968,7 @@ then
dnl IRIX 53
elif ps -el 2>/dev/null | \
- egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
+ grep -E -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
then
ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&pos,procprog]"
ac_cv_ps_command="$PATH_TO_PS -el (IRIX 53)"
@@ -978,7 +978,7 @@ then
dnl IRIX 63
elif ps -el 2>/dev/null | \
- egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +ADDR +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
+ grep -E -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +ADDR +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
then
ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&pos,procprog]"
ac_cv_ps_command="$PATH_TO_PS -el (IRIX 63)"
@@ -991,7 +991,7 @@ dnl S UID RUID USER RUSER PID PPID VSZ %CPU COMMAND
dnl S 0 400 root oracle 2805 1 12904 0.00 ora_dism_SEA1X ora_dism_SEA1X
dnl S 400 400 oracle oracle 19261 1 126488 0.00 tnslsnr /u01/app/oracle/product/db/11.2.0.3/bin/tnslsnr LISTENER -inherit
elif env UNIX95=1 ps -eo 'state uid ruid user ruser pid ppid vsz pcpu comm args' 2>/dev/null | head -n 1 | \
- egrep -i ["^ *S +UID +RUID +USER +RUSER +PID +PPID +VSZ +%CPU +COMMAND +COMMAND"] >/dev/null
+ grep -E -i ["^ *S +UID +RUID +USER +RUSER +PID +PPID +VSZ +%CPU +COMMAND +COMMAND"] >/dev/null
then
ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procpcpu,procprog,&pos]"
ac_cv_ps_command="$PATH_TO_ENV UNIX95=1 $PATH_TO_PS -eo 'state uid pid ppid vsz pcpu comm args'"
@@ -1003,7 +1003,7 @@ dnl AIX 4.1:
dnl F S UID PID PPID C PRI NI ADDR SZ RSS WCHAN TTY TIME CMD
dnl 303 A 0 0 0 120 16 -- 1c07 20 24 - 0:45 swapper
elif ps -el 2>/dev/null | \
- egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +ADDR +SZ +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
+ grep -E -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +ADDR +SZ +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
then
ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&pos,procprog]"
ac_cv_ps_command="$PATH_TO_PS -el (AIX 4.1 and HP-UX)"
@@ -1013,7 +1013,7 @@ then
dnl AIX?
elif ps glaxen 2>/dev/null | \
- egrep -i ["^ *F +UID +PID +PPID +PRI +NI +VSZ +RSS +WCHAN +STAT +TTY +TIME +COMMAND"] >/dev/null
+ grep -E -i ["^ *F +UID +PID +PPID +PRI +NI +VSZ +RSS +WCHAN +STAT +TTY +TIME +COMMAND"] >/dev/null
then
ac_cv_ps_varlist="[&procuid,&procpid,&procppid,&procvsz,&procrss,procstat,&pos,procprog]"
ac_cv_ps_command="$PATH_TO_PS glaxen"
@@ -1027,7 +1027,7 @@ dnl Some truncation will happen in UCOMM column
dnl STAT VSZ RSS UID PPID %CPU UCOMM COMMAND
dnl Ss 52756 22496 501 1 6.9 Window Manager /System/Library/CoreServices/WindowServer -daemon
elif ps wwaxo 'state vsz rss uid pid ppid pcpu ucomm command' 2>/dev/null | \
- egrep -i ["^STAT +VSZ +RSS +UID +PPID +%CPU +UCOMM +COMMAND"] >/dev/null
+ grep -E -i ["^STAT +VSZ +RSS +UID +PPID +%CPU +UCOMM +COMMAND"] >/dev/null
then
ac_cv_ps_command="$PATH_TO_PS wwaxo 'state vsz rss uid pid ppid pcpu ucomm command'"
ac_cv_ps_varlist="[procstat,&procvsz,&procrss,&procuid,&procpid,&procppid,&procpcpu,procprog,&pos]"
@@ -1037,7 +1037,7 @@ then
dnl UnixWare
elif ps -Al 2>/dev/null | \
- egrep -i ["^ *F +S +UID +PID +PPID +CLS +PRI +NI +C +ADDR +SZ +WCHAN +TTY +TIME +COMD"] >/dev/null
+ grep -E -i ["^ *F +S +UID +PID +PPID +CLS +PRI +NI +C +ADDR +SZ +WCHAN +TTY +TIME +COMD"] >/dev/null
then
ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&pos,procprog]"
ac_cv_ps_command="$PATH_TO_PS -Al"
@@ -1105,14 +1105,14 @@ then
elif [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
$PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
- egrep -i "^round-trip|^rtt" >/dev/null
+ grep -E -i "^round-trip|^rtt" >/dev/null
then
with_ping_command="$PATH_TO_PING -n -U -c %d %s"
ac_cv_ping_packets_first=yes
AC_MSG_RESULT([$with_ping_command])
elif $PATH_TO_PING -4 -n -U -w 10 -c 1 127.0.0.1 2>/dev/null | \
- egrep -i "^round-trip|^rtt" >/dev/null
+ grep -E -i "^round-trip|^rtt" >/dev/null
then
# check if -4 is supported - issue #1550
with_ping_command="$PATH_TO_PING -4 -n -U -w %d -c %d %s"
@@ -1120,7 +1120,7 @@ then
ac_cv_ping_has_timeout=yes
AC_MSG_RESULT([$with_ping_command])
elif $PATH_TO_PING -n -U -w 10 -c 1 127.0.0.1 2>/dev/null | \
- egrep -i "^round-trip|^rtt" >/dev/null
+ grep -E -i "^round-trip|^rtt" >/dev/null
then
with_ping_command="$PATH_TO_PING -n -U -w %d -c %d %s"
ac_cv_ping_packets_first=yes
@@ -1128,52 +1128,52 @@ then
AC_MSG_RESULT([$with_ping_command])
elif $PATH_TO_PING -n -U -c 1 127.0.0.1 2>/dev/null | \
- egrep -i "^round-trip|^rtt" >/dev/null
+ grep -E -i "^round-trip|^rtt" >/dev/null
then
with_ping_command="$PATH_TO_PING -n -U -c %d %s"
ac_cv_ping_packets_first=yes
AC_MSG_RESULT([$with_ping_command])
elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
- egrep -i "^round-trip|^rtt" >/dev/null
+ grep -E -i "^round-trip|^rtt" >/dev/null
then
with_ping_command="$PATH_TO_PING -n -c %d %s"
ac_cv_ping_packets_first=yes
AC_MSG_RESULT([$with_ping_command])
elif $PATH_TO_PING -n 127.0.0.1 -c 1 2>/dev/null | \
- egrep -i "^round-trip|^rtt" >/dev/null
+ grep -E -i "^round-trip|^rtt" >/dev/null
then
with_ping_command="$PATH_TO_PING -n %s -c %d"
AC_MSG_RESULT([$with_ping_command])
elif $PATH_TO_PING 127.0.0.1 -n 1 2>/dev/null | \
- egrep -i "^round-trip|^rtt" >/dev/null
+ grep -E -i "^round-trip|^rtt" >/dev/null
then
with_ping_command="$PATH_TO_PING %s -n %d"
AC_MSG_RESULT([$with_ping_command])
elif $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
- egrep -i "^round-trip|^rtt" >/dev/null
+ grep -E -i "^round-trip|^rtt" >/dev/null
then
with_ping_command="$PATH_TO_PING -n -s %s 56 %d"
AC_MSG_RESULT([$with_ping_command])
elif $PATH_TO_PING -n -h 127.0.0.1 -s 56 -c 1 2>/dev/null | \
- egrep -i "^round-trip|^rtt" >/dev/null
+ grep -E -i "^round-trip|^rtt" >/dev/null
then
with_ping_command="$PATH_TO_PING -n -h %s -s 56 -c %d"
AC_MSG_RESULT([$with_ping_command])
elif $PATH_TO_PING -n -s 56 -c 1 127.0.0.1 2>/dev/null | \
- egrep -i "^round-trip|^rtt" >/dev/null
+ grep -E -i "^round-trip|^rtt" >/dev/null
then
with_ping_command="$PATH_TO_PING -n -s 56 -c %d %s"
ac_cv_ping_packets_first=yes
AC_MSG_RESULT([$with_ping_command])
elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
- egrep -i "^round-trip|^rtt" >/dev/null
+ grep -E -i "^round-trip|^rtt" >/dev/null
then
with_ping_command="$PATH_TO_PING -n -c %d %s"
ac_cv_ping_packets_first=yes
@@ -1229,14 +1229,14 @@ elif [[ "z$ac_cv_uname_o" = "zCygwin" -a "x$PATH_TO_PING" != "x" ]]; then
elif test "x$PATH_TO_PING6" != "x"; then
if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
$PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
- egrep -i "^round-trip|^rtt" >/dev/null
+ grep -E -i "^round-trip|^rtt" >/dev/null
then
with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
ac_cv_ping6_packets_first=yes
AC_MSG_RESULT([$with_ping6_command])
elif $PATH_TO_PING6 -n -U -w 10 -c 1 ::1 2>/dev/null | \
- egrep -i "^round-trip|^rtt" >/dev/null
+ grep -E -i "^round-trip|^rtt" >/dev/null
then
with_ping6_command="$PATH_TO_PING6 -n -U -w %d -c %d %s"
ac_cv_ping6_packets_first=yes
@@ -1244,52 +1244,52 @@ elif test "x$PATH_TO_PING6" != "x"; then
AC_MSG_RESULT([$with_ping6_command])
elif $PATH_TO_PING6 -n -U -c 1 ::1 2>/dev/null | \
- egrep -i "^round-trip|^rtt" >/dev/null
+ grep -E -i "^round-trip|^rtt" >/dev/null
then
with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s"
ac_cv_ping6_packets_first=yes
AC_MSG_RESULT([$with_ping6_command])
elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
- egrep -i "^round-trip|^rtt" >/dev/null
+ grep -E -i "^round-trip|^rtt" >/dev/null
then
with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
ac_cv_ping6_packets_first=yes
AC_MSG_RESULT([$with_ping6_command])
elif $PATH_TO_PING6 -n ::1 -c 1 2>/dev/null | \
- egrep -i "^round-trip|^rtt" >/dev/null
+ grep -E -i "^round-trip|^rtt" >/dev/null
then
with_ping6_command="$PATH_TO_PING6 -n %s -c %d"
AC_MSG_RESULT([$with_ping6_command])
elif $PATH_TO_PING6 ::1 -n 1 2>/dev/null | \
- egrep -i "^round-trip|^rtt" >/dev/null
+ grep -E -i "^round-trip|^rtt" >/dev/null
then
with_ping6_command="$PATH_TO_PING6 %s -n %d"
AC_MSG_RESULT([$with_ping6_command])
elif $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
- egrep -i "^round-trip|^rtt" >/dev/null
+ grep -E -i "^round-trip|^rtt" >/dev/null
then
with_ping6_command="$PATH_TO_PING6 -n -s %s 56 %d"
AC_MSG_RESULT([$with_ping6_command])
elif $PATH_TO_PING6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
- egrep -i "^round-trip|^rtt" >/dev/null
+ grep -E -i "^round-trip|^rtt" >/dev/null
then
with_ping6_command="$PATH_TO_PING6 -n -h %s -s 56 -c %d"
AC_MSG_RESULT([$with_ping6_command])
elif $PATH_TO_PING6 -n -s 56 -c 1 ::1 2>/dev/null | \
- egrep -i "^round-trip|^rtt" >/dev/null
+ grep -E -i "^round-trip|^rtt" >/dev/null
then
with_ping6_command="$PATH_TO_PING6 -n -s 56 -c %d %s"
ac_cv_ping6_packets_first=yes
AC_MSG_RESULT([$with_ping_command])
elif $PATH_TO_PING6 -n -c 1 ::1 2>/dev/null | \
- egrep -i "^round-trip|^rtt" >/dev/null
+ grep -E -i "^round-trip|^rtt" >/dev/null
then
with_ping6_command="$PATH_TO_PING6 -n -c %d %s"
ac_cv_ping6_packets_first=yes
@@ -1300,59 +1300,59 @@ elif test "x$PATH_TO_PING6" != "x"; then
elif test "x$PATH_TO_PING" != "x"; then
if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
$PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
- egrep -i "^round-trip|^rtt" >/dev/null
+ grep -E -i "^round-trip|^rtt" >/dev/null
then
with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
ac_cv_ping6_packets_first=yes
AC_MSG_RESULT([$with_ping6_command])
elif $PATH_TO_PING -A inet6 -n -U -c 1 ::1 2>/dev/null | \
- egrep -i "^round-trip|^rtt" >/dev/null
+ grep -E -i "^round-trip|^rtt" >/dev/null
then
with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s"
ac_cv_ping6_packets_first=yes
AC_MSG_RESULT([$with_ping6_command])
elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
- egrep -i "^round-trip|^rtt" >/dev/null
+ grep -E -i "^round-trip|^rtt" >/dev/null
then
with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
ac_cv_ping6_packets_first=yes
AC_MSG_RESULT([$with_ping6_command])
elif $PATH_TO_PING -A inet6 -n ::1 -c 1 2>/dev/null | \
- egrep -i "^round-trip|^rtt" >/dev/null
+ grep -E -i "^round-trip|^rtt" >/dev/null
then
with_ping6_command="$PATH_TO_PING -A inet6 -n %s -c %d"
AC_MSG_RESULT([$with_ping6_command])
elif $PATH_TO_PING -A inet6 ::1 -n 1 2>/dev/null | \
- egrep -i "^round-trip|^rtt" >/dev/null
+ grep -E -i "^round-trip|^rtt" >/dev/null
then
with_ping6_command="$PATH_TO_PING -A inet6 %s -n %d"
AC_MSG_RESULT([$with_ping6_command])
elif $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \
- egrep -i "^round-trip|^rtt" >/dev/null
+ grep -E -i "^round-trip|^rtt" >/dev/null
then
with_ping6_command="$PATH_TO_PING -A inet6 -n -s %s 56 %d"
AC_MSG_RESULT([$with_ping6_command])
elif $PATH_TO_PING -A inet6 -n -h ::1 -s 56 -c 1 2>/dev/null | \
- egrep -i "^round-trip|^rtt" >/dev/null
+ grep -E -i "^round-trip|^rtt" >/dev/null
then
with_ping6_command="$PATH_TO_PING -A inet6 -n -h %s -s 56 -c %d"
AC_MSG_RESULT([$with_ping6_command])
elif $PATH_TO_PING -A inet6 -n -s 56 -c 1 ::1 2>/dev/null | \
- egrep -i "^round-trip|^rtt" >/dev/null
+ grep -E -i "^round-trip|^rtt" >/dev/null
then
with_ping6_command="$PATH_TO_PING -A inet6 -n -s 56 -c %d %s"
ac_cv_ping6_packets_first=yes
AC_MSG_RESULT([$with_ping_command])
elif $PATH_TO_PING -A inet6 -n -c 1 ::1 2>/dev/null | \
- egrep -i "^round-trip|^rtt" >/dev/null
+ grep -E -i "^round-trip|^rtt" >/dev/null
then
with_ping6_command="$PATH_TO_PING -A inet6 -n -c %d %s"
ac_cv_ping6_packets_first=yes
@@ -1589,14 +1589,14 @@ then
ac_cv_have_swap=yes
ac_cv_swap_command="$PATH_TO_SWAP -l"
if [$PATH_TO_SWAP -l 2>/dev/null | \
- egrep -i "^lswap +path +pri +swaplo +blocks +free +maxswap" \
+ grep -E -i "^lswap +path +pri +swaplo +blocks +free +maxswap" \
>/dev/null]
then
ac_cv_swap_format=[" %*d %*s %*d,%*d %*d %*d %f %f"]
ac_cv_swap_conv=2048
AC_MSG_RESULT([using IRIX format swap])
- elif [$PATH_TO_SWAP -l 2>/dev/null | egrep -i "^path +dev +swaplo +blocks +free" >/dev/null]
+ elif [$PATH_TO_SWAP -l 2>/dev/null | grep -E -i "^path +dev +swaplo +blocks +free" >/dev/null]
then
ac_cv_swap_format=["%*s %*[0-9,-] %*d %f %f"]
ac_cv_swap_conv=2048
@@ -1615,19 +1615,19 @@ AC_PATH_PROG(PATH_TO_SWAPINFO,swapinfo)
if (test -n "$PATH_TO_SWAPINFO")
then
AC_MSG_CHECKING([for $PATH_TO_SWAPINFO format])
-if [$PATH_TO_SWAPINFO -k 2>&1 | egrep -i "^Device" >/dev/null]
+if [$PATH_TO_SWAPINFO -k 2>&1 | grep -E -i "^Device" >/dev/null]
then
ac_cv_have_swap=yes
ac_cv_swap_command="$PATH_TO_SWAPINFO -k"
- if [$PATH_TO_SWAPINFO -k 2>/dev/null | egrep -i "^Device +1K-blocks +Used +Avail" >/dev/null]
+ if [$PATH_TO_SWAPINFO -k 2>/dev/null | grep -E -i "^Device +1K-blocks +Used +Avail" >/dev/null]
then
ac_cv_swap_format=["%*s %f %*d %f"]
ac_cv_swap_conv=1024
AC_MSG_RESULT([using FreeBSD format swapinfo])
fi
-elif [$PATH_TO_SWAPINFO -dfM 2>/dev/null | egrep -i "^TYPE +AVAIL +USED +FREE" >/dev/null]
+elif [$PATH_TO_SWAPINFO -dfM 2>/dev/null | grep -E -i "^TYPE +AVAIL +USED +FREE" >/dev/null]
then
ac_cv_have_swap=yes
ac_cv_swap_command="$PATH_TO_SWAPINFO -dfM"
@@ -1642,7 +1642,7 @@ AC_PATH_PROG(PATH_TO_LSPS,lsps)
if (test -n "$PATH_TO_LSPS")
then
AC_MSG_CHECKING([for $PATH_TO_LSPS format])
-if [$PATH_TO_LSPS -a 2>/dev/null | egrep -i "^Page Space" > /dev/null]
+if [$PATH_TO_LSPS -a 2>/dev/null | grep -E -i "^Page Space" > /dev/null]
then
ac_cv_have_swap=yes
ac_cv_swap_command="$PATH_TO_LSPS -a"
@@ -1844,7 +1844,7 @@ AC_ARG_ENABLE(redhat-pthread-workaround,
[ac_cv_enable_redhat_pthread_workaround=$enableval],
[ac_cv_enable_redhat_pthread_workaround=test])
if test "$ac_cv_enable_redhat_pthread_workaround" = "test" ; then
- if echo $ac_cv_uname_r | egrep "\.EL(smp)?$" >/dev/null 2>&1 ; then
+ if echo $ac_cv_uname_r | grep -E "\.EL(smp)?$" >/dev/null 2>&1 ; then
AC_MSG_NOTICE([See https://www.monitoring-plugins.org/doc/faq/configure-hangs.html if this next part takes a long time])
AC_MSG_CHECKING(for redhat spopen problem)
( cd config_test && make && make test ) > /dev/null 2>&1
diff --git a/pkg/solaris/solpkg b/pkg/solaris/solpkg
index a21176e4..73b3c647 100755
--- a/pkg/solaris/solpkg
+++ b/pkg/solaris/solpkg
@@ -9,7 +9,7 @@ $pkgtrans = "/usr/bin/pkgtrans";
$prototype = "prototype";
$pkginfo = "pkginfo";
$preinstall = "preinstall";
-$egrep = "/usr/bin/egrep";
+$egrep = "/usr/bin/grep -E";
# Sanity check
diff --git a/plugins-scripts/check_sensors.sh b/plugins-scripts/check_sensors.sh
index ab4e726e..921e7b36 100755
--- a/plugins-scripts/check_sensors.sh
+++ b/plugins-scripts/check_sensors.sh
@@ -49,10 +49,10 @@ case "$1" in
elif test "${status}" -ne 0; then
text="WARNING - sensors returned state $status"
exit=$STATE_WARNING
- elif echo "${sensordata}" | egrep ALARM > /dev/null; then
+ elif echo "${sensordata}" | grep -E ALARM > /dev/null; then
text="SENSOR CRITICAL - Sensor alarm detected!"
exit=$STATE_CRITICAL
- elif echo "${sensordata}" | egrep FAULT > /dev/null \
+ elif echo "${sensordata}" | grep -E FAULT > /dev/null \
&& test "$1" != "-i" -a "$1" != "--ignore-fault"; then
text="SENSOR UNKNOWN - Sensor reported fault"
exit=$STATE_UNKNOWN
--
cgit v1.2.3-74-g34f1
From 6f022ace5242b07840782d24e163cd05950b4add Mon Sep 17 00:00:00 2001
From: Jan Wagner
Date: Sat, 10 Apr 2021 14:04:52 +0200
Subject: Draft NEWS
---
NEWS | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/NEWS b/NEWS
index 3790e8a0..b1b8b7de 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,26 @@ This file documents the major additions and syntax changes between releases.
FIXES
+2.3.1 10 April 2021
+ ENHANCEMENTS
+ check_curl: Add an option to verify the peer certificate & host using the system CA's
+
+ FIXES
+ check_icmp: fix simple typo, conspicuosly -> conspicuously
+ check_curl: fixed help, usage and errors for TLS 1.3
+ check_curl: fixed a potential buffer overflow in url buffer
+ check_dns: split multiple IP addresses passed in one -a argument
+ check_curl: added string_statuscode function for printing HTTP/1.1 and HTTP/2 correctly
+ check_curl: fix crash if http header contains leading spaces
+ check_curl: display a specific human-readable error message where possible
+ check_pgsql: Using snprintf which honors the buffers size and guarantees null termination.
+ check_snmp: put the "c" (to mark a counter) after the perfdata value
+ check_http: Increase regexp limit
+ check_http: make -C obvious
+ check_curl: Increase regexp limit (to 1024 as in check_http)
+ check_curl: make -C obvious (from check_http)
+ check_curl: backported --show-body/-B to print body (from check_http)
+
2.3 10th December 2020
ENHANCEMENTS
check_dns: allow 'expected address' (-a) to be specified in CIDR notation
--
cgit v1.2.3-74-g34f1
From fbdeb52b26cabe00b92d5e17fbfaef516bf86005 Mon Sep 17 00:00:00 2001
From: Jan Wagner
Date: Sat, 10 Apr 2021 14:09:56 +0200
Subject: Adding Andreas Baumann to AUTHORS
---
AUTHORS | 1 +
1 file changed, 1 insertion(+)
diff --git a/AUTHORS b/AUTHORS
index 2d455be3..802efb77 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -22,3 +22,4 @@ Jan Wagner
Holger Weiss
Michael Wirtgen
Oliver Skibbe
+Andreas Baumann
--
cgit v1.2.3-74-g34f1
From a6af5119d0dd5063a36498ca38153cd7389c2c46 Mon Sep 17 00:00:00 2001
From: Jan Wagner
Date: Sat, 10 Apr 2021 14:13:41 +0200
Subject: Updating THANKS.in
---
THANKS.in | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/THANKS.in b/THANKS.in
index 7d1d1ff0..0f1fe6f7 100644
--- a/THANKS.in
+++ b/THANKS.in
@@ -381,3 +381,8 @@ Michael Kraus
Patrick Rauscher
Prathamesh Bhanuse
Valentin Vidic
+Barak Shohat
+Florian Lohoff
+Stefan Bethke
+Tim Gates
+Tomas Mozes
--
cgit v1.2.3-74-g34f1
From d4f71ac2e7370e20b64150db0b859c9ba4b6a098 Mon Sep 17 00:00:00 2001
From: Sven Nierlein
Date: Wed, 19 Oct 2022 14:31:59 +0200
Subject: release v2.3.2
---
AUTHORS | 1 +
NEWS | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++++---
THANKS.in | 14 +++++++++
doc/RELEASING.md | 6 ++--
4 files changed, 108 insertions(+), 8 deletions(-)
diff --git a/AUTHORS b/AUTHORS
index 802efb77..1b1a0366 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -23,3 +23,4 @@ Holger Weiss
Michael Wirtgen
Oliver Skibbe
Andreas Baumann
+Lorenz Kästle
diff --git a/NEWS b/NEWS
index b1b8b7de..b674391b 100644
--- a/NEWS
+++ b/NEWS
@@ -1,9 +1,95 @@
This file documents the major additions and syntax changes between releases.
-2.4 [...]
- ENHANCEMENTS
-
- FIXES
+2.3.2 20th Oct 2022
+ GENERAL
+ Use netcat-openbsd for debian explicitely (by @RincewindsHat #1704)
+ Replace egrep with grep -E (by @RincewindsHat #1791)
+ Use silent automake by default (by @RincewindsHat #1747)
+
+ SINGLE PLUGINS
+ check_by_ssh: added option to exit with an warning, if there is output on STDERR (by @nafets #1301)
+ check_by_ssh: Add "-U" flag (#1123). (by @archiecobbs #1774)
+ check_by_ssh: Let ssh decide if a host is valid, enables usage of ssh .config file (by @RincewindsHat #1691)
+ check_curl: Add an option to check_curl to verify the peer certificate & host using the system CA's (by @bazzisoft #1669)
+ check_curl: fixed -ffollow for HTTP/2.0 (Fixes #1685): added major_version parsing to PicoHTTPParser (by @andreasbaumann #1742)
+ check_curl: fixes check_curl: "CRITICAL - Cannot retrieve certificate subject." (by @andreasbaumann #1689)
+ check_curl: fix if http header contains leading spaces (by @sni #1666)
+ check_curl: Update check_curl.c to display a specific human-readable error message where possible (by @bazzisoft #1668)
+ check_curl: verify certificates option should not force SSL to be used (by @bazzisoft #1688)
+ check_disk: Description for -M was the wrong way around (by @RincewindsHat #1746)
+ check_disk: Fixing the stuff that is broken on btrfs (by @waja #1388)
+ check_disk: Fix perfdata for big values for check disk (by @RincewindsHat #1714)
+ check_disk_smb: Add configfile feature (by @Napsty #1402)
+ check_disk_smb: Add timeout (by @cdruee #1770)
+ check_dns: Add --expect-nxdomain (by @Jonny007-MKD #1623)
+ check_dns: split multiple IP addresses passed in one -a argument (by @DerDakon #1649)
+ check_file_age: Make size parameter a little bit more intelligible (by @RincewindsHat #1730)
+ check_fping: Implements 'host-alive' mode (Closes. #1027) (by @waja #1740)
+ check_game: Update Url to qstat (by @RincewindsHat #1725)
+ check_http: changed 'STATE_CRITICAL' to 'STATE_WARNING' for infinite loop (by @xFuture603 #1690)
+ check_http: Increase regexp limit (by @hydrapolic #1566)
+ check_http: Support http redirect (by @waja #1449)
+ check_icmp: buffer offerflow (by @RincewindsHat #1733)
+ check_icmp: delay set_source_ip() until address_family is detected (by @ghciv6 #1735)
+ check_icmp: Fix "Invalid Argument" from sendmsg() under FreeBSD 13.1 and "setsockopt failed" for TTL setting (by @eriksejr #1771)
+ check_icmp: Fix pkt perfdata in check_host mode (by @sjoegren #1721)
+ check_ldap: Allows check_ldap to read password from environment variable (by @mullumaus #1724)
+ check_load: add LOAD prefix to load plugin (by @haraldj #1694)
+ check_load: Display total and scaled load values if check_load scales the values (by number of CPUs by @RincewindsHat #1778)
+ check_log: Missing oldlog now aborts check_log (by @RincewindsHat #1732)
+ check_mailq: Add mailq -C option for config dir or config file (by @leeclemens #1490)
+ check_mailq: Check mailq domain specific warnings (by @RincewindsHat #1731)
+ check_mailq: Fix regexp for nullmailer "mailq" output (by @darksoul42 #1493)
+ check_mysql: fix segfaults with mysql-connector-c #1562 (by @ghciv6 #1644)
+ check_pgsql: add --queryname parameter to check_pgsql (by @datamuc #1741)
+ check_ping: Do not show RTA if no connection was possible (by @RincewindsHat #1697)
+ check_ping: understang ping6 output from iputils package (by @glensc #1412)
+ check_proc: Fix check proc ps detection (by @sni #1712)
+ check_procs: exchange needle and haystack in strstr() for proper st… (by @wolfgangkarall #1654)
+ check_smtp: add -L flag to support LMTP (LHLO instead of HELO/EHLO). (by @ghen2 #1715)
+ check_snmp: Added option for null zero length string exit codes (by @FracKenA #1496)
+ check_snmp: fix performance thresholds when using multiple oids (by @sni #1722)
+ check_snmp fix segfaults (by @adrb #1589)
+ check_snmp: put the "c" (to mark a counter) after the perfdata value (by @lausser #1465)
+ check_swap: fix parsing swap values (by @sni #1780)
+ check_swap: Fix perfdata for check swap (by @RincewindsHat #1707)
+ check_swap: Fix unit for total in perfdata (by @RincewindsHat #1779)
+ check_swap: Handle cached swap (by @mdavranche #1642)
+ check_swap: Small fix to threshold validation and style (indentation) fixes (by @RincewindsHat #1723)
+ check_ups: Fix possible overflow in check_ups (by @phibos #1727)
+ check_uptime: Add option to report uptime in days instead of seconds (by @amotl #1750)
+ check_uptime: Fix/improve output message "Uptime is ..." (by @amotl #1751)
+
+ MULTIPLE PLUGINS
+ check_http, check_curl: added --max-redirs=N option (feature #1684) (by @andreasbaumann #1744)
+ check_http, check_curl: Enhancement --continue-after-certificate (backport from nagios-plugins) (by @andreasbaumann #1762)
+ check_http, check_curl: Remove check_http and check_curl test which are somehow always failing (by @RincewindsHat #1777)
+ check_log, check_oracle, check_sensors: Several fixes shellcheck complaining about (by @waja #1459)
+ sslutils: use chain from client certificates (by @tobiaswiese #1664)
+
+ NON FUNCTIONAL CHANGES
+ Trivial source code whitespace formatting fixes to standard. (by @ziesemer #1424)
+ docs: fix simple typo, conspicuosly -> conspicuously (by @timgates42 #1652)
+ Migrate to GitHub actions (by @jacobbaungard #1686)
+ Point to Icinga Exchange instead of dead Monitoring Exchange (by @RincewindsHat #1737)
+ github actions: fix check_users test case (by @sni #1713)
+ Add CodeQL checks (by @phibos #1682)
+ Fix some QL problems (by @RincewindsHat #1729)
+ Update CodeQL and update runner before installing (by @RincewindsHat #1775)
+ check_disk: Check disk compiler warnings (by @RincewindsHat #1758)
+ check_disk: Trivial printf fix and a little bit of code style (by @RincewindsHat #1695)
+ check_http: Docs: make -C obvious (by @stblassitude #1554)
+ check_ifoperstatus: Re-attach a comment to where it actually belongs (by @peternewman #1699)
+ check_ircd: Restrict the nickname length of the test user for check_ircd (by @RincewindsHat #1710)
+ check_load: Check load compiler warnings (by @RincewindsHat #1759)
+ 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_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)
+ check_swap: Check swap compiler warnings (by @RincewindsHat #1756)
2.3.1 10 April 2021
ENHANCEMENTS
@@ -549,4 +635,3 @@ This file documents the major additions and syntax changes between releases.
check_swap % thresholds changed to measure amount free, instead of amount used
check_disk syntax changes for -p, -m/-M, defaults to MB instead of kB
check_procs -C expects no path for the command name
-
diff --git a/THANKS.in b/THANKS.in
index 0f1fe6f7..89201404 100644
--- a/THANKS.in
+++ b/THANKS.in
@@ -386,3 +386,17 @@ Florian Lohoff
Stefan Bethke
Tim Gates
Tomas Mozes
+Aksel Sjögren
+Andreas Motl
+Claudio Kuenzler
+Daniel Uhlmann
+Eric Wunderlin
+Geert Hendrickx
+Ken D
+Klaus Ethgen
+Lee Clemens
+Linda Guo
+Peter Newman
+Tobias Fiebig
+Tobias Wiese
+Wolfgang Karall-Ahlborn
diff --git a/doc/RELEASING.md b/doc/RELEASING.md
index bcd2c5ac..58ec3e16 100644
--- a/doc/RELEASING.md
+++ b/doc/RELEASING.md
@@ -2,14 +2,14 @@ Releasing a New Monitoring Plugins Version
==========================================
Throughout this document, it is assumed that the current Monitoring
-Plugins version is 2.2.1, and that we're about to publish version 2.3.
+Plugins version is 2.3.2, and that we're about to publish version 2.4.
It is also assumed that the official repository on GitHub is tracked
using the remote name `monitoring-plugins` (rather than `origin`).
Before you start
----------------
-- Check Travis CI status.
+- Check Github Actions status.
- Update local Git repository to the current `master` tip. For a
maintenance release (e.g., version 2.3.2), update to the current
`maint-2.3` tip, instead.
@@ -55,7 +55,7 @@ Build the tarball
-----------------
cd /tmp/plugins
- tools/setup
+ tools/setup # requires docbook to be installed
./configure
make dist
--
cgit v1.2.3-74-g34f1
From 817ac2e5dad1ce5d0e0ea96fa7f726566251b08d Mon Sep 17 00:00:00 2001
From: Andreas Baumann <202930+andreasbaumann@users.noreply.github.com>
Date: Fri, 21 Oct 2022 18:31:12 +0200
Subject: using PRId64 and PRIu64 instead of %ld directly (#1800)
---
plugins/utils.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/plugins/utils.c b/plugins/utils.c
index 17dd5814..f75cf03b 100644
--- a/plugins/utils.c
+++ b/plugins/utils.c
@@ -615,27 +615,27 @@ char *perfdata_uint64 (const char *label,
char *data = NULL;
if (strpbrk (label, "'= "))
- xasprintf (&data, "'%s'=%ld%s;", label, val, uom);
+ xasprintf (&data, "'%s'=%" PRId64 "%s;", label, val, uom);
else
- xasprintf (&data, "%s=%ld%s;", label, val, uom);
+ xasprintf (&data, "%s=%" PRId64 "%s;", label, val, uom);
if (warnp)
- xasprintf (&data, "%s%lu;", data, warn);
+ xasprintf (&data, "%s%" PRIu64 ";", data, warn);
else
xasprintf (&data, "%s;", data);
if (critp)
- xasprintf (&data, "%s%lu;", data, crit);
+ xasprintf (&data, "%s%" PRIu64 ";", data, crit);
else
xasprintf (&data, "%s;", data);
if (minp)
- xasprintf (&data, "%s%lu;", data, minv);
+ xasprintf (&data, "%s%" PRIu64 ";", data, minv);
else
xasprintf (&data, "%s;", data);
if (maxp)
- xasprintf (&data, "%s%lu", data, maxv);
+ xasprintf (&data, "%s%" PRIu64, data, maxv);
return data;
}
@@ -656,27 +656,27 @@ char *perfdata_int64 (const char *label,
char *data = NULL;
if (strpbrk (label, "'= "))
- xasprintf (&data, "'%s'=%ld%s;", label, val, uom);
+ xasprintf (&data, "'%s'=%" PRId64 "%s;", label, val, uom);
else
- xasprintf (&data, "%s=%ld%s;", label, val, uom);
+ xasprintf (&data, "%s=%" PRId64 "%s;", label, val, uom);
if (warnp)
- xasprintf (&data, "%s%ld;", data, warn);
+ xasprintf (&data, "%s%" PRId64 ";", data, warn);
else
xasprintf (&data, "%s;", data);
if (critp)
- xasprintf (&data, "%s%ld;", data, crit);
+ xasprintf (&data, "%s%" PRId64 ";", data, crit);
else
xasprintf (&data, "%s;", data);
if (minp)
- xasprintf (&data, "%s%ld;", data, minv);
+ xasprintf (&data, "%s%" PRId64 ";", data, minv);
else
xasprintf (&data, "%s;", data);
if (maxp)
- xasprintf (&data, "%s%ld", data, maxv);
+ xasprintf (&data, "%s%" PRId64, data, maxv);
return data;
}
--
cgit v1.2.3-74-g34f1
From eb2dfdd5c24b87198b66397b224d6406c468a0bc Mon Sep 17 00:00:00 2001
From: Andreas Baumann <202930+andreasbaumann@users.noreply.github.com>
Date: Thu, 27 Oct 2022 22:48:18 +0200
Subject: fixed two PRId64 to PRIu64 in perfdata_uint64 (#1802)
---
plugins/utils.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/plugins/utils.c b/plugins/utils.c
index f75cf03b..b4214c61 100644
--- a/plugins/utils.c
+++ b/plugins/utils.c
@@ -615,9 +615,9 @@ char *perfdata_uint64 (const char *label,
char *data = NULL;
if (strpbrk (label, "'= "))
- xasprintf (&data, "'%s'=%" PRId64 "%s;", label, val, uom);
+ xasprintf (&data, "'%s'=%" PRIu64 "%s;", label, val, uom);
else
- xasprintf (&data, "%s=%" PRId64 "%s;", label, val, uom);
+ xasprintf (&data, "%s=%" PRIu64 "%s;", label, val, uom);
if (warnp)
xasprintf (&data, "%s%" PRIu64 ";", data, warn);
--
cgit v1.2.3-74-g34f1
From 2d9c6276d0a380f831bf94734359f071d0c7e958 Mon Sep 17 00:00:00 2001
From: waja
Date: Fri, 4 Nov 2022 19:16:01 +0100
Subject: Removing is_pg_dbname alltogether,using postgres API. (Closes: #1660)
(#1803)
The problem is that check_pgsql validates the Database name and has different assumptions
that postgres itself.
I fail to see a reason to validate the database name here. Postgres'es API should
do this - So i would suggest a fix like this by removing is_pg_dbname alltogether.
Co-authored-by: Florian Lohoff
---
plugins/check_pgsql.c | 48 ++++--------------------------------------------
1 file changed, 4 insertions(+), 44 deletions(-)
diff --git a/plugins/check_pgsql.c b/plugins/check_pgsql.c
index c893386c..c26cd439 100644
--- a/plugins/check_pgsql.c
+++ b/plugins/check_pgsql.c
@@ -69,7 +69,6 @@ int process_arguments (int, char **);
int validate_arguments (void);
void print_usage (void);
void print_help (void);
-int is_pg_dbname (char *);
int is_pg_logname (char *);
int do_query (PGconn *, char *);
@@ -347,10 +346,10 @@ process_arguments (int argc, char **argv)
pgport = optarg;
break;
case 'd': /* database name */
- if (!is_pg_dbname (optarg)) /* checks length and valid chars */
- usage2 (_("Database name is not valid"), optarg);
- else /* we know length, and know optarg is terminated, so us strcpy */
- snprintf(dbName, NAMEDATALEN, "%s", optarg);
+ if (strlen(optarg) >= NAMEDATALEN) {
+ usage2 (_("Database name exceeds the maximum length"), optarg);
+ }
+ snprintf(dbName, NAMEDATALEN, "%s", optarg);
break;
case 'l': /* login name */
if (!is_pg_logname (optarg))
@@ -414,45 +413,6 @@ validate_arguments ()
return OK;
}
-
-/******************************************************************************
-
-@@-
-
-is_pg_dbname
-
-&PROTO_is_pg_dbname;
-
-Given a database name, this function returns TRUE if the string
-is a valid PostgreSQL database name, and returns false if it is
-not.
-
-Valid PostgreSQL database names are less than &NAMEDATALEN;
-characters long and consist of letters, numbers, and underscores. The
-first character cannot be a number, however.
-
-
--@@
-******************************************************************************/
-
-
-
-int
-is_pg_dbname (char *dbname)
-{
- char txt[NAMEDATALEN];
- char tmp[NAMEDATALEN];
- if (strlen (dbname) > NAMEDATALEN - 1)
- return (FALSE);
- strncpy (txt, dbname, NAMEDATALEN - 1);
- txt[NAMEDATALEN - 1] = 0;
- if (sscanf (txt, "%[_a-zA-Z]%[^_a-zA-Z0-9-]", tmp, tmp) == 1)
- return (TRUE);
- if (sscanf (txt, "%[_a-zA-Z]%[_a-zA-Z0-9-]%[^_a-zA-Z0-9-]", tmp, tmp, tmp) ==
- 2) return (TRUE);
- return (FALSE);
-}
-
/**
the tango program should eventually create an entity here based on the
--
cgit v1.2.3-74-g34f1
From edc84e5d669089fa3f047dc52740679e7cb58fc1 Mon Sep 17 00:00:00 2001
From: Lorenz <12514511+RincewindsHat@users.noreply.github.com>
Date: Sat, 5 Nov 2022 13:59:45 +0100
Subject: Remove superflous CRLF in HTTP-Requests in check_http (#1798)
* Remove superflous CRLF in HTTP-Requests in check_http
---
plugins/check_http.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/plugins/check_http.c b/plugins/check_http.c
index ff39c591..41d47816 100644
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
@@ -1070,9 +1070,8 @@ check_http (void)
}
xasprintf (&buf, "%sContent-Length: %i\r\n\r\n", buf, (int)strlen (http_post_data));
- xasprintf (&buf, "%s%s%s", buf, http_post_data, CRLF);
- }
- else {
+ xasprintf (&buf, "%s%s", buf, http_post_data);
+ } else {
/* or just a newline so the server knows we're done with the request */
xasprintf (&buf, "%s%s", buf, CRLF);
}
--
cgit v1.2.3-74-g34f1
From f7f7309b99f9f0eb4176a4c7cb8e5991d23b5b74 Mon Sep 17 00:00:00 2001
From: Lorenz <12514511+RincewindsHat@users.noreply.github.com>
Date: Sun, 6 Nov 2022 23:12:41 +0100
Subject: Update GitHub runner (#1810)
* Update action/checkout to v3
* Format debian prepare script
---
.github/prepare_debian.sh | 61 ++++++++++++++++++++++++++++++++++------------
.github/workflows/test.yml | 2 +-
2 files changed, 46 insertions(+), 17 deletions(-)
diff --git a/.github/prepare_debian.sh b/.github/prepare_debian.sh
index 4021c104..d8a76da6 100755
--- a/.github/prepare_debian.sh
+++ b/.github/prepare_debian.sh
@@ -11,21 +11,51 @@ if [ $(lsb_release -is) = "Debian" ]; then
apt-add-repository non-free
apt-get update
fi
-apt-get -y install perl autotools-dev libdbi-dev libldap2-dev libpq-dev libradcli-dev libnet-snmp-perl procps
-apt-get -y install libdbi0-dev libdbd-sqlite3 libssl-dev dnsutils snmp-mibs-downloader libsnmp-perl snmpd
-apt-get -y install fping snmp netcat-openbsd smbclient vsftpd apache2 ssl-cert postfix libhttp-daemon-ssl-perl
-apt-get -y install libdbd-sybase-perl libnet-dns-perl
-apt-get -y install slapd ldap-utils
-apt-get -y install gcc make autoconf automake gettext
-apt-get -y install faketime
-apt-get -y install libmonitoring-plugin-perl
-apt-get -y install libcurl4-openssl-dev
-apt-get -y install liburiparser-dev
-apt-get -y install squid
-apt-get -y install openssh-server
-apt-get -y install mariadb-server mariadb-client libmariadb-dev
-apt-get -y install cron iputils-ping
-apt-get -y install iproute2
+apt-get -y install perl \
+ autotools-dev \
+ libdbi-dev \
+ libldap2-dev \
+ libpq-dev \
+ libradcli-dev \
+ libnet-snmp-perl \
+ procps \
+ libdbi0-dev \
+ libdbd-sqlite3 \
+ libssl-dev \
+ dnsutils \
+ snmp-mibs-downloader \
+ libsnmp-perl \
+ snmpd \
+ fping \
+ snmp \
+ netcat-openbsd \
+ smbclient \
+ vsftpd \
+ apache2 \
+ ssl-cert \
+ postfix \
+ libhttp-daemon-ssl-perl \
+ libdbd-sybase-perl \
+ libnet-dns-perl \
+ slapd \
+ ldap-utils \
+ gcc \
+ make \
+ autoconf \
+ automake \
+ gettext \
+ faketime \
+ libmonitoring-plugin-perl \
+ libcurl4-openssl-dev \
+ liburiparser-dev \
+ squid \
+ openssh-server \
+ mariadb-server \
+ mariadb-client \
+ libmariadb-dev \
+ cron \
+ iputils-ping \
+ iproute2
# remove ipv6 interface from hosts
if [ $(ip addr show | grep "inet6 ::1" | wc -l) -eq "0" ]; then
@@ -37,7 +67,6 @@ ip addr show
cat /etc/hosts
-
# apache
a2enmod ssl
a2ensite default-ssl
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 0f93930a..d2785a41 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -24,7 +24,7 @@ jobs:
#...
steps:
- name: Git clone repository
- uses: actions/checkout@v2
+ uses: actions/checkout@v3
#- name: Setup tmate session, see https://github.com/marketplace/actions/debugging-with-tmate
# uses: mxschmitt/action-tmate@v3
- name: Run the tests on ${{ matrix.distro }}
--
cgit v1.2.3-74-g34f1
From 8708fd21a66656e297f1a7e6b2b679d932845ef1 Mon Sep 17 00:00:00 2001
From: waja
Date: Mon, 7 Nov 2022 17:47:30 +0100
Subject: Adding dependabot config which takes care of updating github actions
(#1811)
---
.github/dependabot.yml | 10 ++++++++++
1 file changed, 10 insertions(+)
create mode 100644 .github/dependabot.yml
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 00000000..282063c4
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,10 @@
+version: 2
+updates:
+ - package-ecosystem: github-actions
+ directory: "/"
+ schedule:
+ interval: daily
+ time: "04:00"
+ pull-request-branch-name:
+ separator: "-"
+ open-pull-requests-limit: 10
--
cgit v1.2.3-74-g34f1
From 4a5ddd201119260028db6a4f27027d72aa9a160a Mon Sep 17 00:00:00 2001
From: Lorenz <12514511+RincewindsHat@users.noreply.github.com>
Date: Mon, 7 Nov 2022 17:48:28 +0100
Subject: Check curl detect ipv6 (#1809)
* If server_address is an IPv6 address surround it with brackets
* If the message is too short, we should not have an underflow
* Add simple conditional test case available if IPv6 is
---
.github/workflows/test.yml | 2 +-
plugins/check_curl.c | 22 ++++++++++++++++++----
plugins/t/check_curl.t | 39 ++++++++++++++++++++++++++++-----------
3 files changed, 47 insertions(+), 16 deletions(-)
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index d2785a41..80d49f7e 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -40,7 +40,7 @@ jobs:
${{ matrix.distro }} \
/bin/sh -c '${{ matrix.prepare }} && \
tools/setup && \
- ./configure --enable-libtap --with-ipv6=no && \
+ ./configure --enable-libtap --with-ipv6=no && \
make && \
make test'
docker container prune -f
diff --git a/plugins/check_curl.c b/plugins/check_curl.c
index a69854a8..2ad373c0 100644
--- a/plugins/check_curl.c
+++ b/plugins/check_curl.c
@@ -476,6 +476,18 @@ check_http (void)
printf ("* curl CURLOPT_RESOLVE: %s\n", dnscache);
}
+ // If server_address is an IPv6 address it must be surround by square brackets
+ struct in6_addr tmp_in_addr;
+ if (inet_pton(AF_INET6, server_address, &tmp_in_addr) == 1) {
+ char *new_server_address = malloc(strlen(server_address) + 3);
+ if (new_server_address == NULL) {
+ die(STATE_UNKNOWN, "HTTP UNKNOWN - Unable to allocate memory\n");
+ }
+ snprintf(new_server_address, strlen(server_address)+3, "[%s]", server_address);
+ free(server_address);
+ server_address = new_server_address;
+ }
+
/* 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",
@@ -999,10 +1011,12 @@ GOT_FIRST_CERT:
result = max_state_alt(get_status(total_time, thlds), result);
/* Cut-off trailing characters */
- if(msg[strlen(msg)-2] == ',')
- msg[strlen(msg)-2] = '\0';
- else
- msg[strlen(msg)-3] = '\0';
+ if (strlen(msg) >= 2) {
+ if(msg[strlen(msg)-2] == ',')
+ msg[strlen(msg)-2] = '\0';
+ else
+ msg[strlen(msg)-3] = '\0';
+ }
/* TODO: separate _() msg and status code: die (result, "HTTP %s: %s\n", state_text(result), msg); */
die (result, "HTTP %s: %s %d %s%s%s - %d bytes in %.3f second response time %s|%s\n%s%s",
diff --git a/plugins/t/check_curl.t b/plugins/t/check_curl.t
index 693f4b25..eae98cc1 100644
--- a/plugins/t/check_curl.t
+++ b/plugins/t/check_curl.t
@@ -1,15 +1,22 @@
#! /usr/bin/perl -w -I ..
#
-# HyperText Transfer Protocol (HTTP) Test via check_http
+# HyperText Transfer Protocol (HTTP) Test via check_curl
#
#
use strict;
use Test::More;
use POSIX qw/mktime strftime/;
-use NPTest;
-plan tests => 57;
+use vars qw($tests $has_ipv6);
+
+BEGIN {
+ use NPTest;
+ $has_ipv6 = NPTest::has_ipv6();
+ $tests = $has_ipv6 ? 59 : 57;
+ plan tests => $tests;
+}
+
my $successOutput = '/OK.*HTTP.*second/';
@@ -18,6 +25,7 @@ my $plugin = 'check_http';
$plugin = 'check_curl' if $0 =~ m/check_curl/mx;
my $host_tcp_http = getTestParameter("NP_HOST_TCP_HTTP", "A host providing the HTTP Service (a web server)", "localhost");
+my $host_tcp_http_ipv6 = getTestParameter("NP_HOST_TCP_HTTP_IPV6", "An IPv6 address providing a HTTP Service (a web server)", "::1");
my $host_tls_http = getTestParameter("NP_HOST_TLS_HTTP", "A host providing the HTTPS Service (a tls web server)", "localhost");
my $host_tls_cert = getTestParameter("NP_HOST_TLS_CERT", "the common name of the certificate.", "localhost");
my $host_nonresponsive = getTestParameter("NP_HOST_NONRESPONSIVE", "The hostname of system not responsive to network requests", "10.0.0.1");
@@ -31,26 +39,35 @@ my $faketime = -x '/usr/bin/faketime' ? 1 : 0;
$res = NPTest->testCmd(
- "./$plugin $host_tcp_http -wt 300 -ct 600"
- );
+ "./$plugin $host_tcp_http -wt 300 -ct 600"
+ );
cmp_ok( $res->return_code, '==', 0, "Webserver $host_tcp_http responded" );
like( $res->output, $successOutput, "Output OK" );
+if ($has_ipv6) {
+ # Test for IPv6 formatting
+ $res = NPTest->testCmd(
+ "./$plugin -I $host_tcp_http_ipv6 -wt 300 -ct 600"
+ );
+ cmp_ok( $res->return_code, '==', 0, "IPv6 URL formatting is working" );
+ like( $res->output, $successOutput, "Output OK" );
+}
+
$res = NPTest->testCmd(
- "./$plugin $host_tcp_http -wt 300 -ct 600 -v -v -v -k 'bob:there' -k 'carl:frown'"
- );
+ "./$plugin $host_tcp_http -wt 300 -ct 600 -v -v -v -k 'bob:there' -k 'carl:frown'"
+ );
like( $res->output, '/bob:there\r\ncarl:frown\r\n/', "Got headers with multiple -k options" );
$res = NPTest->testCmd(
- "./$plugin $host_nonresponsive -wt 1 -ct 2 -t 3"
- );
+ "./$plugin $host_nonresponsive -wt 1 -ct 2 -t 3"
+ );
cmp_ok( $res->return_code, '==', 2, "Webserver $host_nonresponsive not responding" );
# was CRITICAL only, but both check_curl and check_http print HTTP CRITICAL (puzzle?!)
like( $res->output, "/HTTP CRITICAL - Invalid HTTP response received from host on port 80: cURL returned 28 - Connection timed out after/", "Output OK");
$res = NPTest->testCmd(
- "./$plugin $hostname_invalid -wt 1 -ct 2"
- );
+ "./$plugin $hostname_invalid -wt 1 -ct 2"
+ );
cmp_ok( $res->return_code, '==', 2, "Webserver $hostname_invalid not valid" );
# The first part of the message comes from the OS catalogue, so cannot check this.
# On Debian, it is Name or service not known, on Darwin, it is No address associated with nodename
--
cgit v1.2.3-74-g34f1
From de06e5832eb45ed0a23d4ad9f66d4faa51cb5371 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 7 Nov 2022 17:49:31 +0100
Subject: Bump github/codeql-action from 1 to 2 (#1812)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 1 to 2.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v1...v2)
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot]
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/codeql-analysis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index afe6ab4f..860c783c 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -43,7 +43,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
- uses: github/codeql-action/init@v1
+ uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
--
cgit v1.2.3-74-g34f1
From 1bc6d81651c5b5fe865515d420fc2772f4997059 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 11 Nov 2022 04:26:26 +0000
Subject: Bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot]
---
.github/workflows/codeql-analysis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index 860c783c..ab8bfaae 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -39,7 +39,7 @@ jobs:
steps:
- name: Checkout repository
- uses: actions/checkout@v2
+ uses: actions/checkout@v3
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
--
cgit v1.2.3-74-g34f1