diff options
author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2003-11-17 06:37:15 +0000 |
---|---|---|
committer | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2003-11-17 06:37:15 +0000 |
commit | 72dac268d3e995d8436b77494a1db30f92496415 (patch) | |
tree | 2ea5a248f31e1f4f1d6ebfa6c2fd7c649db47a92 /plugins | |
parent | a1db47c560432864fe4c6236912583689aa29d64 (diff) | |
download | monitoring-plugins-72dac268d3e995d8436b77494a1db30f92496415.tar.gz |
add perfdata
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@769 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_pgsql.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/plugins/check_pgsql.c b/plugins/check_pgsql.c index 16b9a96e..00b051be 100644 --- a/plugins/check_pgsql.c +++ b/plugins/check_pgsql.c @@ -118,7 +118,7 @@ Please note that all tags must be lowercase to use the DocBook XML DTD. int main (int argc, char **argv) { - int elapsed_time; + int elapsed_time, status; /* begin, by setting the parameters for a backend connection if the * parameters are null, then the system will try to use reasonable @@ -151,27 +151,26 @@ main (int argc, char **argv) /* check to see that the backend connection was successfully made */ if (PQstatus (conn) == CONNECTION_BAD) { - printf (_("PGSQL: CRITICAL - no connection to '%s' (%s).\n"), dbName, - PQerrorMessage (conn)); + printf (_("PGSQL: CRITICAL - no connection to '%s' (%s).\n"), + dbName, PQerrorMessage (conn)); PQfinish (conn); return STATE_CRITICAL; } else if (elapsed_time > tcrit) { - PQfinish (conn); - printf (_("PGSQL: CRITICAL - database %s (%d sec.)\n"), dbName, - elapsed_time); - return STATE_CRITICAL; + status = STATE_CRITICAL; } else if (elapsed_time > twarn) { - PQfinish (conn); - printf (_("PGSQL: WARNING - database %s (%d sec.)\n"), dbName, elapsed_time); - return STATE_WARNING; + status = STATE_WARNING; } else { - PQfinish (conn); - printf (_("PGSQL: ok - database %s (%d sec.)\n"), dbName, elapsed_time); - return STATE_OK; + status = STATE_OK; } + PQfinish (conn); + printf (_("PGSQL: %s - database %s (%d sec.)|%s\n"), + state_text(status), dbName, elapsed_time, + perfdata("time", (long)elapsed_time, "s", + twarn, (long)twarn, tcrit, (long)tcrit, TRUE, 0, FALSE,0)); + return status; } |