log message when {host,service} check fails

Ricardo Jose Maraschini ricardo.maraschini at opservices.com.br
Wed Nov 14 13:21:20 CET 2012


i think it's ok to notify user when a check couldn't happen.

ok?

Index: base/checks.c
===================================================================
--- base/checks.c	(revision 2472)
+++ base/checks.c	(working copy)
@@ -154,6 +154,7 @@
 	host *temp_host = NULL;
 	double old_latency = 0.0;
 	check_result *cr;
+	int runchk_result = OK;
 #ifdef USE_EVENT_BROKER
 	int neb_result = OK;
 #endif
@@ -292,7 +293,10 @@
 	update_check_stats((scheduled_check == TRUE) ? ACTIVE_SCHEDULED_SERVICE_CHECK_STATS : ACTIVE_ONDEMAND_SERVICE_CHECK_STATS, start_time.tv_sec);
 
 	/* paw off the check to a worker to run */
-	wproc_run_check(cr, processed_command, &mac);
+	runchk_result = wproc_run_check(cr, processed_command, &mac);
+	if (runchk_result == ERROR) {
+		logit(NSLOG_RUNTIME_ERROR, TRUE, "Unable to run check for service '%s' on host '%s'\n", svc->description, svc->host_name);
+	}
 
 	/* free memory */
 	my_free(processed_command);
@@ -2285,6 +2289,7 @@
 	struct timeval start_time, end_time;
 	double old_latency = 0.0;
 	check_result *cr;
+	int runchk_result = OK;
 #ifdef USE_EVENT_BROKER
 	int neb_result = OK;
 #endif
@@ -2409,7 +2414,10 @@
 	update_check_stats((scheduled_check == TRUE) ? ACTIVE_SCHEDULED_HOST_CHECK_STATS : ACTIVE_ONDEMAND_HOST_CHECK_STATS, start_time.tv_sec);
 	update_check_stats(PARALLEL_HOST_CHECK_STATS, start_time.tv_sec);
 
-	wproc_run_check(cr, processed_command, &mac);
+	runchk_result = wproc_run_check(cr, processed_command, &mac);
+	if (runchk_result == ERROR) {
+		logit(NSLOG_RUNTIME_ERROR, TRUE, "Unable to run check for host '%s'\n", hst->name);
+	}
 
 	/* free memory */
 	clear_volatile_macros_r(&mac);

------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov




More information about the Developers mailing list