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 diff --git a/plugins/check_pgsql.c b/plugins/check_pgsql.c index c26cd43..05fdc15 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 v0.10-9-g596f From 431502a82c7b1ac4012b243a70ded4b9b2011ea7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20K=C3=A4stle?= Date: Mon, 3 Apr 2023 17:34:19 +0200 Subject: Ignore built check_mssql in CVS diff --git a/.gitignore b/.gitignore index fdcad9f..02ca61e 100644 --- a/.gitignore +++ b/.gitignore @@ -246,6 +246,7 @@ NP-VERSION-FILE /plugins-scripts/check_ircd /plugins-scripts/check_log /plugins-scripts/check_mailq +/plugins-scripts/check_mssql /plugins-scripts/check_ntp /plugins-scripts/check_oracle /plugins-scripts/check_rpc -- cgit v0.10-9-g596f From 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 diff --git a/plugins-scripts/check_log.sh b/plugins-scripts/check_log.sh index c623a8d..10c56f1 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 b14ec50..f340b97 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 921e7b3..3c4cf01 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 v0.10-9-g596f 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) diff --git a/plugins-scripts/check_oracle.sh b/plugins-scripts/check_oracle.sh index f340b97..d58cfbe 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 3c4cf01..adbfc53 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 v0.10-9-g596f 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 diff --git a/plugins/runcmd.c b/plugins/runcmd.c index 1bd2ca1..c1d675d 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 v0.10-9-g596f 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 diff --git a/plugins/check_http.c b/plugins/check_http.c index 8c03bc8..6956a72 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 v0.10-9-g596f 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. diff --git a/lib/utils_base.c b/lib/utils_base.c index eb1823b..c458cf6 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 ad67323..147db6b 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 be5740d..100a97a 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 v0.10-9-g596f From b2659391aba7e4a79b678aba5cc21b443626f81f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20K=C3=A4stle?= Date: Wed, 26 Apr 2023 10:13:51 +0200 Subject: check_nt: change encoding from latin1 to utf8 diff --git a/plugins/check_nt.c b/plugins/check_nt.c index 59c135d..babe3b6 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 v0.10-9-g596f 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 diff --git a/plugins/check_nt.c b/plugins/check_nt.c index babe3b6..d73d83c 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 v0.10-9-g596f From d10ee31d89c2c599ee4c502e82d632aef8554020 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20K=C3=A4stle?= Date: Fri, 28 Apr 2023 16:51:39 +0200 Subject: Typo in check_mysql diff --git a/plugins/check_mysql.c b/plugins/check_mysql.c index 0cba50e..6cfa70e 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 v0.10-9-g596f 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 diff --git a/plugins-scripts/check_log.sh b/plugins-scripts/check_log.sh index 10c56f1..8ecdd31 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 d58cfbe..5998138 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 adbfc53..866e0e0 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 v0.10-9-g596f 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 diff --git a/.github/prepare_debian.sh b/.github/prepare_debian.sh index 5222659..aa224ef 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 v0.10-9-g596f 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 diff --git a/.github/prepare_debian.sh b/.github/prepare_debian.sh index aa224ef..7f5592b 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 v0.10-9-g596f 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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e825eb3..5685003 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,6 +5,7 @@ on: branches: - '*' pull_request: + - '*' jobs: codespell: -- cgit v0.10-9-g596f