Patch for recovery notifications on dependent hosts

Henri Fallon fallon at fullsix.com
Wed Oct 8 18:18:52 CEST 2003


Hi all,

 it seems nagios sends recovery notifications when a host that
depends on another one comes back, as the latter one just came
back too (eg a router on the way).

 Hopefully the attached patch can help solve this issue.

 hth
-- 
Henri Fallon
-------------- next part --------------
Index: base/checks.c
===================================================================
RCS file: /cvsroot/nagios/nagios/base/checks.c,v
retrieving revision 1.54
diff -U3 -r1.54 checks.c
--- base/checks.c       3 Sep 2003 23:50:58 -0000       1.54
+++ base/checks.c       8 Oct 2003 15:59:52 -0000
@@ -1470,7 +1470,14 @@
                if(temp_dependency->inherits_parent==TRUE){
                        if(check_service_dependencies(temp_service,dependency_type)!=DEPENDENCIES_OK)
                                return DEPENDENCIES_FAILED;
-                       }
+                       /* if the host we depend on is UP, but has been down, don't send recovery message */
+                       if(temp_host->has_been_down==TRUE && temp_host->status==HOST_UP && temp_dependency->fail_on_down==TRUE)
+                               return DEPENDENCIES_FAILED;
+                       /* same for unreachable */
+                       if(temp_host->has_been_unreachable==TRUE && temp_host->status==HOST_UP && temp_dependency->fail_on_unreachable==TRUE)
+                               return DEPENDENCIES_FAILED;
+                               }
+       
                }
 
 #ifdef DEBUG0


More information about the Developers mailing list