summaryrefslogtreecommitdiffstats
path: root/plugins/check_pgsql.c
diff options
context:
space:
mode:
authorKarl DeBisschop <kdebisschop@users.sourceforge.net>2003-11-17 06:37:15 (GMT)
committerKarl DeBisschop <kdebisschop@users.sourceforge.net>2003-11-17 06:37:15 (GMT)
commit72dac268d3e995d8436b77494a1db30f92496415 (patch)
tree2ea5a248f31e1f4f1d6ebfa6c2fd7c649db47a92 /plugins/check_pgsql.c
parenta1db47c560432864fe4c6236912583689aa29d64 (diff)
downloadmonitoring-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/check_pgsql.c')
-rw-r--r--plugins/check_pgsql.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/plugins/check_pgsql.c b/plugins/check_pgsql.c
index 16b9a96..00b051b 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.
118int 118int
119main (int argc, char **argv) 119main (int argc, char **argv)
120{ 120{
121 int elapsed_time; 121 int elapsed_time, status;
122 122
123 /* begin, by setting the parameters for a backend connection if the 123 /* begin, by setting the parameters for a backend connection if the
124 * parameters are null, then the system will try to use reasonable 124 * parameters are null, then the system will try to use reasonable
@@ -151,27 +151,26 @@ main (int argc, char **argv)
151 151
152 /* check to see that the backend connection was successfully made */ 152 /* check to see that the backend connection was successfully made */
153 if (PQstatus (conn) == CONNECTION_BAD) { 153 if (PQstatus (conn) == CONNECTION_BAD) {
154 printf (_("PGSQL: CRITICAL - no connection to '%s' (%s).\n"), dbName, 154 printf (_("PGSQL: CRITICAL - no connection to '%s' (%s).\n"),
155 PQerrorMessage (conn)); 155 dbName, PQerrorMessage (conn));
156 PQfinish (conn); 156 PQfinish (conn);
157 return STATE_CRITICAL; 157 return STATE_CRITICAL;
158 } 158 }
159 else if (elapsed_time > tcrit) { 159 else if (elapsed_time > tcrit) {
160 PQfinish (conn); 160 status = STATE_CRITICAL;
161 printf (_("PGSQL: CRITICAL - database %s (%d sec.)\n"), dbName,
162 elapsed_time);
163 return STATE_CRITICAL;
164 } 161 }
165 else if (elapsed_time > twarn) { 162 else if (elapsed_time > twarn) {
166 PQfinish (conn); 163 status = STATE_WARNING;
167 printf (_("PGSQL: WARNING - database %s (%d sec.)\n"), dbName, elapsed_time);
168 return STATE_WARNING;
169 } 164 }
170 else { 165 else {
171 PQfinish (conn); 166 status = STATE_OK;
172 printf (_("PGSQL: ok - database %s (%d sec.)\n"), dbName, elapsed_time);
173 return STATE_OK;
174 } 167 }
168 PQfinish (conn);
169 printf (_("PGSQL: %s - database %s (%d sec.)|%s\n"),
170 state_text(status), dbName, elapsed_time,
171 perfdata("time", (long)elapsed_time, "s",
172 twarn, (long)twarn, tcrit, (long)tcrit, TRUE, 0, FALSE,0));
173 return status;
175} 174}
176 175
177 176