Update of /cvsroot/nagios-db/nagios-db/neb/postgres
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17327
Modified Files:
inserter.c
Log Message:
accurately report on new database connection status
Index: inserter.c
===================================================================
RCS file: /cvsroot/nagios-db/nagios-db/neb/postgres/inserter.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- inserter.c 11 Mar 2005 01:08:39 -0000 1.8
+++ inserter.c 11 Mar 2005 06:55:04 -0000 1.9
@@ -63,10 +63,20 @@
if(!(pgconn = PQconnectdb("host=meatshake port=5432 dbname=nag user=postgres")))
{
/* couldn't connect; this will be useless. */
- write_to_all_logs("nagios-db: inserter failed to connect to db",NSLOG_INFO_MESSAGE);
+ write_to_all_logs("nagios-db: inserter failed to allocate postgres connection",NSLOG_INFO_MESSAGE);
+ }
+ else
+ {
+ if(CONNECTION_OK != PQstatus(pgconn))
+ {
+ char str[2048];
+ snprintf(str,sizeof(str),"nagios-db: inserter failed to establish postgres connection (%s)",PQerrorMessage(pgconn));
+ write_to_all_logs(str,NSLOG_INFO_MESSAGE);
+ }
+ else
+ write_to_all_logs("nagios-db: inserter locked into db",NSLOG_INFO_MESSAGE);
}
- write_to_all_logs("nagios-db: inserter locked into db",NSLOG_INFO_MESSAGE);
neb_register_callback(NEBCALLBACK_TIMED_EVENT_DATA, 0, processStart);
|