From 3da21634e793f9b34c9df33d2d60a7baf2f3f39f Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 10 May 2023 15:40:43 +0000 Subject: [PATCH] Adding d/p/21_check_pgsql_extra_output from upstream --- debian/patches/21_check_pgsql_extra_output | 46 ++++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 47 insertions(+) create mode 100644 debian/patches/21_check_pgsql_extra_output diff --git a/debian/patches/21_check_pgsql_extra_output b/debian/patches/21_check_pgsql_extra_output new file mode 100644 index 0000000..773443b --- /dev/null +++ b/debian/patches/21_check_pgsql_extra_output @@ -0,0 +1,46 @@ +From 9f15dac8e789a4b13d4f9e8897ee03fee84f494a Mon Sep 17 00:00:00 2001 +From: phowen +Date: Wed, 26 Apr 2017 13:40:27 +0100 +Subject: [PATCH] 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 c26cd439c..05fdc1568 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; + } + diff --git a/debian/patches/series b/debian/patches/series index ff76318..c04e2ed 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -12,6 +12,7 @@ 18_check_mysql_fix_typo 19_check_nwstat_fix_typ 20_chech_nt_fix_encoding +21_check_pgsql_extra_output # feature patches 30_check_radius_radcli_1.3.1_support 31_checl_mailq_separate_submission_queue