Patch: Fix spurious host check orphan messages

Luke Ross l-ross at northwestern.edu
Fri May 16 20:26:48 CEST 2008


In testing Nagios 3 I've found that I often get host check orphan 
warnings, even when the host check actually completed successfully. 
This seems to be happening because the next_check time is incorrect 
in an on-demand check--either it's 0 because the host had never been 
checked, or it's from the last time the host was checked, which could 
be hours or days ago. This causes check_for_orphaned_hosts to think 
that the check is way overdue even though it actually isn't.

This patch corrects that problem by setting the host's next_check 
time to the current time when performing on-demand checks.

Thanks,
Luke

--- checks.c.orig	2008-05-15 10:23:40.000000000 -0500
+++ checks.c	2008-05-15 10:55:18.000000000 -0500
@@ -2908,6 +2908,10 @@

  	/* get the command start time */
  	gettimeofday(&start_time,NULL);
+	
+	/* set check time for on demand checks so they're not incorrectly 
detected as orphaned */
+	if(scheduled_check==FALSE)
+		hst->next_check=start_time.tv_sec;

  	/* increment number of host checks that are currently running... */
  	currently_running_host_checks++;



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/




More information about the Developers mailing list