diff options
author | phowen <phowen@cisco.com> | 2017-04-26 12:40:27 (GMT) |
---|---|---|
committer | waja <waja@users.noreply.github.com> | 2023-02-03 15:37:19 (GMT) |
commit | 9f15dac8e789a4b13d4f9e8897ee03fee84f494a (patch) | |
tree | c2c7ee1ff2e4fa36e33c0eb7888a1058563bf00e /plugins/check_pgsql.c | |
parent | fc8a233854c0d59cf637e982b84c836920d718bd (diff) | |
download | monitoring-plugins-9f15dac8e789a4b13d4f9e8897ee03fee84f494a.tar.gz |
add extra output to pgsql checkrefs/pull/1486/head
Diffstat (limited to 'plugins/check_pgsql.c')
-rw-r--r-- | plugins/check_pgsql.c | 12 |
1 files changed, 11 insertions, 1 deletions
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) | |||
517 | printf (" %s\n", _("connecting to the server. The result from the query has to be numeric.")); | 517 | printf (" %s\n", _("connecting to the server. The result from the query has to be numeric.")); |
518 | printf (" %s\n", _("Multiple SQL commands, separated by semicolon, are allowed but the result ")); | 518 | printf (" %s\n", _("Multiple SQL commands, separated by semicolon, are allowed but the result ")); |
519 | printf (" %s\n", _("of the last command is taken into account only. The value of the first")); | 519 | printf (" %s\n", _("of the last command is taken into account only. The value of the first")); |
520 | printf (" %s\n\n", _("column in the first row is used as the check result.")); | 520 | printf (" %s\n", _("column in the first row is used as the check result. If a second column is")); |
521 | printf (" %s\n", _("present in the result set, this is added to the plugin output with a")); | ||
522 | printf (" %s\n", _("prefix of \"Extra Info:\". This information can be displayed in the system")); | ||
523 | printf (" %s\n\n", _("executing the plugin.")); | ||
521 | 524 | ||
522 | printf (" %s\n", _("See the chapter \"Monitoring Database Activity\" of the PostgreSQL manual")); | 525 | printf (" %s\n", _("See the chapter \"Monitoring Database Activity\" of the PostgreSQL manual")); |
523 | printf (" %s\n\n", _("for details about how to access internal statistics of the database server.")); | 526 | 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) | |||
557 | PGresult *res; | 560 | PGresult *res; |
558 | 561 | ||
559 | char *val_str; | 562 | char *val_str; |
563 | char *extra_info; | ||
560 | double value; | 564 | double value; |
561 | 565 | ||
562 | char *endptr = NULL; | 566 | char *endptr = NULL; |
@@ -621,6 +625,12 @@ do_query (PGconn *conn, char *query) | |||
621 | printf ("|query=%f;%s;%s;;\n", value, | 625 | printf ("|query=%f;%s;%s;;\n", value, |
622 | query_warning ? query_warning : "", | 626 | query_warning ? query_warning : "", |
623 | query_critical ? query_critical : ""); | 627 | query_critical ? query_critical : ""); |
628 | if (PQnfields (res) > 1) { | ||
629 | extra_info = PQgetvalue (res, 0, 1); | ||
630 | if (extra_info != NULL) { | ||
631 | printf ("Extra Info: %s\n", extra_info); | ||
632 | } | ||
633 | } | ||
624 | return my_status; | 634 | return my_status; |
625 | } | 635 | } |
626 | 636 | ||