Suggestion to first_notification_delay

Rogerio F Cunha rogerio.cunha at gmail.com
Fri Sep 2 22:15:40 CEST 2011


I have tested those modifications on Nagios 3.2.3 source and I think it
works better than the original code. The patch keeps the first notification
greater then the last  state change, whenever the state changes happens.

Rogerio Cunha.

--- base/notifications.c    2010-08-04 23:43:53.000000000 -0300
+++ base2/notifications.c.4    2011-09-02 16:53:40.139155621 -0300
@@ -504,13 +504,9 @@

         /* determine the time to use of the first problem point */
         first_problem_time=svc->last_time_ok; /* not accurate, but its the
earliest time we could use in the comparison */
-        if((svc->last_time_warning < first_problem_time) &&
(svc->last_time_warning > svc->last_time_ok))
-            first_problem_time=svc->last_time_warning;
-        if((svc->last_time_unknown < first_problem_time) &&
(svc->last_time_unknown > svc->last_time_ok))
-            first_problem_time=svc->last_time_unknown;
-        if((svc->last_time_critical < first_problem_time) &&
(svc->last_time_critical > svc->last_time_ok))
-            first_problem_time=svc->last_time_critical;
-
+        if((svc->last_hard_state_change > svc->last_time_ok)) {
+            first_problem_time=svc->last_hard_state_change;
+        }
         if(current_time <
(time_t)((first_problem_time==(time_t)0L)?program_start:first_problem_time +
(svc->first_notification_delay*interval_length))){
             log_debug_info(DEBUGL_NOTIFICATIONS,1,"Not enough time has
elapsed since the service changed to a non-OK state, so we should not notify
about this problem yet\n");
             return ERROR;
@@ -1393,11 +1389,8 @@

         /* determine the time to use of the first problem point */
         first_problem_time=hst->last_time_up; /* not accurate, but its the
earliest time we could use in the comparison */
-        if((hst->last_time_down < first_problem_time) &&
(hst->last_time_down > hst->last_time_up))
-            first_problem_time=hst->last_time_down;
-        if((hst->last_time_unreachable < first_problem_time) &&
(hst->last_time_unreachable > hst->last_time_unreachable))
-            first_problem_time=hst->last_time_unreachable;
-
+        if((hst->last_hard_state_change > first_problem_time))
+            first_problem_time=hst->last_hard_state_change;
         if(current_time <
(time_t)((first_problem_time==(time_t)0L)?program_start:first_problem_time +
(hst->first_notification_delay*interval_length))){
             log_debug_info(DEBUGL_NOTIFICATIONS,1,"Not enough time has
elapsed since the host changed to a non-UP state (or since program start),
so we shouldn't notify about this problem yet.\n");
             return ERROR;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20110902/d82066ef/attachment.html>
-------------- next part --------------
------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
-------------- next part --------------
_______________________________________________
Nagios-devel mailing list
Nagios-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-devel


More information about the Developers mailing list