[icinga-checkins] icinga.org: icinga-core/master: add syslog output, if ido2db is unable to do initial db query

git at icinga.org git at icinga.org
Tue Apr 20 16:57:47 CEST 2010


Module: icinga-core
Branch: master
Commit: 1c0957dca998e0b0bf0979f87474f7ae9a7a8381
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=1c0957dca998e0b0bf0979f87474f7ae9a7a8381

Author: Michael Friedrich <michael.friedrich at univie.ac.at>
Date:   Tue Apr 20 16:56:38 2010 +0200

add syslog output, if ido2db is unable to do initial db query

ido2db now bails out with a telling error message in syslog.
before it was misleading - ido2db "died" and noboby reflected that error.

fixes #369

---

 Changelog                |    1 +
 module/idoutils/src/db.c |   12 +++++++++++-
 2 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/Changelog b/Changelog
index 7f09f17..323e0f0 100644
--- a/Changelog
+++ b/Changelog
@@ -8,6 +8,7 @@ ENHANCEMENTS
 * idoutils: remove mysql binary selects, use case-sensitive collation instead (William Preston)
 * idoutils: Spread the list of linked lists thinner (extend objects hash slots) (Opsera Ltd)
 * idoutils: change select * into select [*_]id if unused results
+* idoutils: add syslog output, if ido2db is unable to do initial db query
 
 FIXES
 * core: fix spurious dollar signs added to command_lines (Alexander Wirt)
diff --git a/module/idoutils/src/db.c b/module/idoutils/src/db.c
index e37041a..d542cff 100644
--- a/module/idoutils/src/db.c
+++ b/module/idoutils/src/db.c
@@ -956,7 +956,7 @@ int ndo2db_db_disconnect(ndo2db_idi *idi) {
 	dbi_conn_close(idi->dbinfo.dbi_conn);
 	dbi_shutdown();
 
-	syslog(LOG_USER | LOG_INFO, "Successfully disconnected from database");
+	syslog(LOG_USER | LOG_INFO, "Successfully disconnected from %s database", ndo2db_db_settings.dbserver);
 #else /* Oracle ocilib specific */
 
 	/* close prepared statements */
@@ -1089,6 +1089,11 @@ int ndo2db_db_hello(ndo2db_idi *idi) {
 		}
 	}
         else {
+		/* there was an error with the initial db handshake, bail out */
+		/* could be missing database, missing db schema */
+		syslog(LOG_USER | LOG_INFO, "Error: Initial %s database query failed! Please check %s database configuration and schema!", ndo2db_db_settings.dbserver, ndo2db_db_settings.dbserver);
+		syslog(LOG_USER | LOG_INFO, "Exiting ...");
+
                 ndo2db_log_debug_info(NDO2DB_DEBUGL_PROCESSINFO, 2, "ndo2db_db_hello() query against existing instance not possible, cleaning up and exiting\n");
                 /* cleanup the socket */
                 ndo2db_cleanup_socket();
@@ -1114,6 +1119,11 @@ int ndo2db_db_hello(ndo2db_idi *idi) {
 
         /* execute statement */
         if(!OCI_Execute(idi->dbinfo.oci_statement_instances_select)) {
+		/* there was an error with the initial db handshake, bail out */
+		/* could be missing database, missing db schema */
+		syslog(LOG_USER | LOG_INFO, "Error: Initial oracle database query failed! Please check oracle database configuration and schema!");
+		syslog(LOG_USER | LOG_INFO, "Exiting ...");
+
 	        ndo2db_log_debug_info(NDO2DB_DEBUGL_PROCESSINFO, 2, "ndo2db_db_hello() query against existing instance not possible, cleaning up and exiting\n");
 
 		/* cleanup the socket */





More information about the icinga-checkins mailing list