From 9f15dac8e789a4b13d4f9e8897ee03fee84f494a Mon Sep 17 00:00:00 2001 From: phowen Date: Wed, 26 Apr 2017 13:40:27 +0100 Subject: add extra output to pgsql check --- plugins/check_pgsql.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/plugins/check_pgsql.c b/plugins/check_pgsql.c index c26cd439..05fdc156 100644 --- a/plugins/check_pgsql.c +++ b/plugins/check_pgsql.c @@ -517,7 +517,10 @@ print_help (void) printf (" %s\n", _("connecting to the server. The result from the query has to be numeric.")); printf (" %s\n", _("Multiple SQL commands, separated by semicolon, are allowed but the result ")); printf (" %s\n", _("of the last command is taken into account only. The value of the first")); - printf (" %s\n\n", _("column in the first row is used as the check result.")); + printf (" %s\n", _("column in the first row is used as the check result. If a second column is")); + printf (" %s\n", _("present in the result set, this is added to the plugin output with a")); + printf (" %s\n", _("prefix of \"Extra Info:\". This information can be displayed in the system")); + printf (" %s\n\n", _("executing the plugin.")); printf (" %s\n", _("See the chapter \"Monitoring Database Activity\" of the PostgreSQL manual")); printf (" %s\n\n", _("for details about how to access internal statistics of the database server.")); @@ -557,6 +560,7 @@ do_query (PGconn *conn, char *query) PGresult *res; char *val_str; + char *extra_info; double value; char *endptr = NULL; @@ -621,6 +625,12 @@ do_query (PGconn *conn, char *query) printf ("|query=%f;%s;%s;;\n", value, query_warning ? query_warning : "", query_critical ? query_critical : ""); + if (PQnfields (res) > 1) { + extra_info = PQgetvalue (res, 0, 1); + if (extra_info != NULL) { + printf ("Extra Info: %s\n", extra_info); + } + } return my_status; } -- cgit v1.2.3-74-g34f1 From 431502a82c7b1ac4012b243a70ded4b9b2011ea7 Mon Sep 17 00:00:00 2001 From: Lorenz Kästle Date: Mon, 3 Apr 2023 17:34:19 +0200 Subject: Ignore built check_mssql in CVS --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index fdcad9fc..02ca61e1 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 v1.2.3-74-g34f1 From 5af4db7b4169acee20bfa2d637ce3f3eb5bdef47 Mon Sep 17 00:00:00 2001 From: MisterMountain Date: Tue, 11 Apr 2023 16:26:12 +0200 Subject: fixed the outputs of the --versions options on 3 scripts --- plugins-scripts/check_log.sh | 2 +- plugins-scripts/check_oracle.sh | 2 +- plugins-scripts/check_sensors.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins-scripts/check_log.sh b/plugins-scripts/check_log.sh index c623a8d6..10c56f14 100755 --- a/plugins-scripts/check_log.sh +++ b/plugins-scripts/check_log.sh @@ -109,7 +109,7 @@ while test -n "$1"; do ;; -V | --version) print_revision "$PROGNAME" "$REVISION" - exit "$STATE_OK" + exit "$STATE_UNKNOWN" ;; -F | --filename) logfile=$2 diff --git a/plugins-scripts/check_oracle.sh b/plugins-scripts/check_oracle.sh index b14ec50e..f340b97c 100755 --- a/plugins-scripts/check_oracle.sh +++ b/plugins-scripts/check_oracle.sh @@ -95,7 +95,7 @@ case "$cmd" in ;; --version) print_revision "$PROGNAME" "$REVISION" - exit "$STATE_OK" + exit "$STATE_UNKNOWN" ;; -V) print_revision "$PROGNAME" "$REVISION" diff --git a/plugins-scripts/check_sensors.sh b/plugins-scripts/check_sensors.sh index 921e7b36..3c4cf01b 100755 --- a/plugins-scripts/check_sensors.sh +++ b/plugins-scripts/check_sensors.sh @@ -34,7 +34,7 @@ case "$1" in ;; --version) print_revision "$PROGNAME" "$REVISION" - exit "$STATE_OK" + exit "$STATE_UNKNOWN" ;; -V) print_revision "$PROGNAME" "$REVISION" -- cgit v1.2.3-74-g34f1 From 3dc677e4f1f990e7b26bc714a02608070379cf85 Mon Sep 17 00:00:00 2001 From: MisterMountain Date: Tue, 11 Apr 2023 17:11:06 +0200 Subject: fixed the identation (and also patched -V on check_oracle to behave exactly like --version again) --- plugins-scripts/check_oracle.sh | 10 +++++----- plugins-scripts/check_sensors.sh | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins-scripts/check_oracle.sh b/plugins-scripts/check_oracle.sh index f340b97c..d58cfbea 100755 --- a/plugins-scripts/check_oracle.sh +++ b/plugins-scripts/check_oracle.sh @@ -86,20 +86,20 @@ esac # Information options case "$cmd" in --help) - print_help + print_help exit "$STATE_OK" ;; -h) - print_help + print_help exit "$STATE_OK" ;; --version) - print_revision "$PROGNAME" "$REVISION" + print_revision "$PROGNAME" "$REVISION" exit "$STATE_UNKNOWN" ;; -V) - print_revision "$PROGNAME" "$REVISION" - exit "$STATE_OK" + print_revision "$PROGNAME" "$REVISION" + exit "$STATE_UNKNOWN" ;; esac diff --git a/plugins-scripts/check_sensors.sh b/plugins-scripts/check_sensors.sh index 3c4cf01b..adbfc533 100755 --- a/plugins-scripts/check_sensors.sh +++ b/plugins-scripts/check_sensors.sh @@ -38,7 +38,7 @@ case "$1" in ;; -V) print_revision "$PROGNAME" "$REVISION" - exit "$STATE_OK" + exit "$STATE_UNKNOWN" ;; *) sensordata=$(sensors 2>&1) -- cgit v1.2.3-74-g34f1 From 1568940b3ea871ffb29d9bf1990cfa0528712b8d Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Sun, 5 Mar 2023 10:09:45 +0100 Subject: Implicit function declarations --- plugins/runcmd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/runcmd.c b/plugins/runcmd.c index 1bd2ca1f..c1d675d0 100644 --- a/plugins/runcmd.c +++ b/plugins/runcmd.c @@ -44,6 +44,8 @@ # include #endif +#include "./utils.h" + /** macros **/ #ifndef WEXITSTATUS # define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) -- cgit v1.2.3-74-g34f1 From cee364f219ed73c75a4c4bfb5ac148b8a721780c Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Sun, 5 Mar 2023 15:50:48 +0100 Subject: Remove unused variable from check_http --- plugins/check_http.c | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/check_http.c b/plugins/check_http.c index 8c03bc8b..6956a726 100644 --- a/plugins/check_http.c +++ b/plugins/check_http.c @@ -1391,7 +1391,6 @@ char *unchunk_content(const char *content) { // https://en.wikipedia.org/wiki/Chunked_transfer_encoding // https://www.rfc-editor.org/rfc/rfc7230#section-4.1 char *result = NULL; - size_t content_length = strlen(content); char *start_of_chunk; char* end_of_chunk; long size_of_chunk; -- cgit v1.2.3-74-g34f1 From 6c78f0b5ea82a4bea71ae2024f27d3916175a7a2 Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Sun, 12 Mar 2023 14:16:35 +0100 Subject: Fixes for -Wunused * lib/utils_base.c * plugins/check_curl.c * plugins-root/check_dhcp.c Removed a line which theoretically can not do anything, but there was comment which indicated something else. Still trying this though. --- lib/utils_base.c | 8 ++++---- plugins-root/check_dhcp.c | 4 ---- plugins/check_curl.c | 5 ++--- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/lib/utils_base.c b/lib/utils_base.c index eb1823bb..c458cf61 100644 --- a/lib/utils_base.c +++ b/lib/utils_base.c @@ -24,7 +24,7 @@ * *****************************************************************************/ -#include "common.h" +#include "../plugins/common.h" #include #include "utils_base.h" #include @@ -319,18 +319,18 @@ char *np_extract_value(const char *varlist, const char *name, char sep) { while (1) { /* Strip any leading space */ - for (varlist; isspace(varlist[0]); varlist++); + for (; isspace(varlist[0]); varlist++); if (strncmp(name, varlist, strlen(name)) == 0) { varlist += strlen(name); /* strip trailing spaces */ - for (varlist; isspace(varlist[0]); varlist++); + for (; isspace(varlist[0]); varlist++); if (varlist[0] == '=') { /* We matched the key, go past the = sign */ varlist++; /* strip leading spaces */ - for (varlist; isspace(varlist[0]); varlist++); + for (; isspace(varlist[0]); varlist++); if (tmp = index(varlist, sep)) { /* Value is delimited by a comma */ diff --git a/plugins-root/check_dhcp.c b/plugins-root/check_dhcp.c index ad673237..147db6b3 100644 --- a/plugins-root/check_dhcp.c +++ b/plugins-root/check_dhcp.c @@ -470,10 +470,6 @@ int send_dhcp_discover(int sock){ packet_xid=random(); discover_packet.xid=htonl(packet_xid); - /**** WHAT THE HECK IS UP WITH THIS?!? IF I DON'T MAKE THIS CALL, ONLY ONE SERVER RESPONSE IS PROCESSED!!!! ****/ - /* downright bizzarre... */ - ntohl(discover_packet.xid); - /*discover_packet.secs=htons(65535);*/ discover_packet.secs=0xFF; diff --git a/plugins/check_curl.c b/plugins/check_curl.c index be5740d7..100a97aa 100644 --- a/plugins/check_curl.c +++ b/plugins/check_curl.c @@ -2217,11 +2217,10 @@ curlhelp_parse_statusline (const char *buf, curlhelp_statusline *status_line) if( strchr( p, '.' ) != NULL ) { /* HTTP 1.x case */ - char *ppp; - ppp = strtok( p, "." ); + strtok( p, "." ); status_line->http_major = (int)strtol( p, &pp, 10 ); if( *pp != '\0' ) { free( first_line_buf ); return -1; } - ppp = strtok( NULL, " " ); + strtok( NULL, " " ); status_line->http_minor = (int)strtol( p, &pp, 10 ); if( *pp != '\0' ) { free( first_line_buf ); return -1; } p += 4; /* 1.x SP */ -- cgit v1.2.3-74-g34f1 From b2659391aba7e4a79b678aba5cc21b443626f81f Mon Sep 17 00:00:00 2001 From: Lorenz Kästle Date: Wed, 26 Apr 2023 10:13:51 +0200 Subject: check_nt: change encoding from latin1 to utf8 --- plugins/check_nt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/check_nt.c b/plugins/check_nt.c index 59c135db..babe3b64 100644 --- a/plugins/check_nt.c +++ b/plugins/check_nt.c @@ -341,7 +341,7 @@ int main(int argc, char **argv){ 2) If the counter you're going to measure is percent-based, the code will detect the percent sign in its name and will attribute minimum (0%) and maximum (100%) - values automagically, as well the ¨%" sign to graph units. + values automagically, as well the ¨%" sign to graph units. 3) OTOH, if the counter is "absolute", you'll have to provide the following the counter unit - that is, the dimensions of the counter you're getting. Examples: -- cgit v1.2.3-74-g34f1 From fcf68d702e590bd3e58fb7556f420330ddf0a0ae Mon Sep 17 00:00:00 2001 From: Lorenz <12514511+RincewindsHat@users.noreply.github.com> Date: Thu, 27 Apr 2023 00:42:30 +0200 Subject: Update plugins/check_nt.c Co-authored-by: datamuc --- plugins/check_nt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/check_nt.c b/plugins/check_nt.c index babe3b64..d73d83ce 100644 --- a/plugins/check_nt.c +++ b/plugins/check_nt.c @@ -341,7 +341,7 @@ int main(int argc, char **argv){ 2) If the counter you're going to measure is percent-based, the code will detect the percent sign in its name and will attribute minimum (0%) and maximum (100%) - values automagically, as well the ¨%" sign to graph units. + values automagically, as well the "%" sign to graph units. 3) OTOH, if the counter is "absolute", you'll have to provide the following the counter unit - that is, the dimensions of the counter you're getting. Examples: -- cgit v1.2.3-74-g34f1 From d10ee31d89c2c599ee4c502e82d632aef8554020 Mon Sep 17 00:00:00 2001 From: Lorenz Kästle Date: Fri, 28 Apr 2023 16:51:39 +0200 Subject: Typo in check_mysql --- plugins/check_mysql.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/check_mysql.c b/plugins/check_mysql.c index 0cba50e6..6cfa70ed 100644 --- a/plugins/check_mysql.c +++ b/plugins/check_mysql.c @@ -551,7 +551,7 @@ print_help (void) printf (" %s\n", _("Exit with CRITICAL status if slave server is more then INTEGER seconds")); printf (" %s\n", _("behind master")); printf (" %s\n", "-l, --ssl"); - printf (" %s\n", _("Use ssl encryptation")); + printf (" %s\n", _("Use ssl encryption")); printf (" %s\n", "-C, --ca-cert=STRING"); printf (" %s\n", _("Path to CA signing the cert")); printf (" %s\n", "-a, --cert=STRING"); -- cgit v1.2.3-74-g34f1 From 21885d85d54ce2afe7b9bf962348dc60e31442e0 Mon Sep 17 00:00:00 2001 From: MisterMountain Date: Tue, 2 May 2023 09:40:35 +0200 Subject: also fixed the --help returns --- plugins-scripts/check_log.sh | 2 +- plugins-scripts/check_oracle.sh | 4 ++-- plugins-scripts/check_sensors.sh | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins-scripts/check_log.sh b/plugins-scripts/check_log.sh index 10c56f14..8ecdd316 100755 --- a/plugins-scripts/check_log.sh +++ b/plugins-scripts/check_log.sh @@ -105,7 +105,7 @@ while test -n "$1"; do case "$1" in -h | --help) print_help - exit "$STATE_OK" + exit "$STATE_UNKNOWN" ;; -V | --version) print_revision "$PROGNAME" "$REVISION" diff --git a/plugins-scripts/check_oracle.sh b/plugins-scripts/check_oracle.sh index d58cfbea..59981386 100755 --- a/plugins-scripts/check_oracle.sh +++ b/plugins-scripts/check_oracle.sh @@ -87,11 +87,11 @@ esac case "$cmd" in --help) print_help - exit "$STATE_OK" + exit "$STATE_UNKNOWN" ;; -h) print_help - exit "$STATE_OK" + exit "$STATE_UNKNOWN" ;; --version) print_revision "$PROGNAME" "$REVISION" diff --git a/plugins-scripts/check_sensors.sh b/plugins-scripts/check_sensors.sh index adbfc533..866e0e0f 100755 --- a/plugins-scripts/check_sensors.sh +++ b/plugins-scripts/check_sensors.sh @@ -26,11 +26,11 @@ print_help() { case "$1" in --help) print_help - exit "$STATE_OK" + exit "$STATE_UNKNOWN" ;; -h) print_help - exit "$STATE_OK" + exit "$STATE_UNKNOWN" ;; --version) print_revision "$PROGNAME" "$REVISION" -- cgit v1.2.3-74-g34f1 From 483ae9fca47a424bcdbb75bfd63c90afd28b9ccc Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Thu, 11 May 2023 18:01:38 +0000 Subject: CI: Fallback on software-properties-common --- .github/prepare_debian.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/prepare_debian.sh b/.github/prepare_debian.sh index 5222659e..aa224ef9 100755 --- a/.github/prepare_debian.sh +++ b/.github/prepare_debian.sh @@ -5,13 +5,18 @@ set -e export DEBIAN_FRONTEND=noninteractive -sed "s/main/non-free contrib/g" /etc/apt/sources.list.d/debian.sources > /etc/apt/sources.list.d/debian-nonfree.sources -apt-get update -apt-get -y install software-properties-common -if [ $(lsb_release -is) = "Debian" ]; then - apt-add-repository non-free - apt-get update +source /etc/os-release + +if [ ${ID} = "debian" ]; then + if [ -f /etc/apt/sources.list.d/debian.sources ]; then + sed "s/main/non-free contrib/g" /etc/apt/sources.list.d/debian.sources > /etc/apt/sources.list.d/debian-nonfree.sources + else + apt-get update + apt-get -y install software-properties-common + apt-add-repository non-free + fi fi +apt-get update apt-get -y install perl \ autotools-dev \ libdbi-dev \ -- cgit v1.2.3-74-g34f1 From 0918a6a30b204bd61e4b42c5731e18dc86a9e6c4 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Thu, 11 May 2023 18:23:56 +0000 Subject: CI: Fallback on mysql service --- .github/prepare_debian.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/prepare_debian.sh b/.github/prepare_debian.sh index aa224ef9..7f5592b4 100755 --- a/.github/prepare_debian.sh +++ b/.github/prepare_debian.sh @@ -88,7 +88,7 @@ cp tools/squid.conf /etc/squid/squid.conf service squid start # mariadb -service mariadb start +service mariadb start || service mysql start mysql -e "create database IF NOT EXISTS test;" -uroot # ldap -- cgit v1.2.3-74-g34f1 From 8cb3480b9bf24bf478c81745d49fbea779489872 Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Mon, 15 May 2023 20:17:48 +0200 Subject: Run tests on PRs again --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e825eb34..5685003c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,6 +5,7 @@ on: branches: - '*' pull_request: + - '*' jobs: codespell: -- cgit v1.2.3-74-g34f1