Page 1 of 1

[Nagios-devel] log message when {host,service} check fails

Posted: Wed Nov 14, 2012 12:25 pm
by Guest
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);





This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]