[Pkg-nagios-changes] [SCM] UNNAMED PROJECT branch, debian/master, updated. 810edbdd3feedbfe37f4a65bee50b57b2f60fa2a

Naparuba naparuba at gmail.com
Tue Feb 28 22:20:14 UTC 2012


The following commit has been merged in the debian/master branch:
commit 247789ec2a3accb475872e9287b10542735aa149
Author: Naparuba <naparuba at gmail.com>
Date:   Thu Feb 9 10:37:58 2012 +0100

    Fix : (reported by Mihai Efrim) flapping notifications

diff --git a/Changelog b/Changelog
index d2b2eda..6ba6653 100644
--- a/Changelog
+++ b/Changelog
@@ -38,6 +38,7 @@ Shinken ChangeLog
 	* Add : TIMEPERIOD TRANSITION logs from the Arbiter to get timeperiods transition output 
 	* Add : is_admin property is now available for contacts
 	* Add : make the nmap discovery do tcp and udp scan
+	* Add : (Victor Igumnov) installation for Solaris
 	
 	CORE FIXES
 	* Fix : use StringIO to read configuration files into a string (much faster with lots of config files)
@@ -68,6 +69,7 @@ Shinken ChangeLog
 	* Fix : if missing alias in objects, put the name if available
 	* Fix : (reported by : denetariko) manage spaces before and after type name in define line
 	* Fix : (reported by: Steve Kieu) missing get_name() method for config
+	* Fix : (reported by : Mihai Efrim) flapping notifications
 	
 	
 
diff --git a/shinken/objects/host.py b/shinken/objects/host.py
index a9af549..c1313db 100644
--- a/shinken/objects/host.py
+++ b/shinken/objects/host.py
@@ -812,8 +812,8 @@ class Host(SchedulingItem):
         return "%02dh %02dm %02ds" % (h, m, s)
 
 
-    #Check if a notification for this host is suppressed at this time
-    #This is a check at the host level. Do not look at contacts here
+    # Check if a notification for this host is suppressed at this time
+    # This is a check at the host level. Do not look at contacts here
     def notification_is_blocked_by_item(self, type, t_wished = None):
         if t_wished is None:
             t_wished = time.time()
@@ -881,7 +881,7 @@ class Host(SchedulingItem):
             return True
 
         # Block if flapping
-        if self.is_flapping:
+        if self.is_flapping and type not in ('FLAPPINGSTART', 'FLAPPINGSTOP', 'FLAPPINGDISABLED'):
             return True
 
         return False
diff --git a/shinken/objects/schedulingitem.py b/shinken/objects/schedulingitem.py
index 82e2a37..939743d 100644
--- a/shinken/objects/schedulingitem.py
+++ b/shinken/objects/schedulingitem.py
@@ -148,6 +148,9 @@ class SchedulingItem(Item):
             self.is_flapping = False
             # We also raise a log entry
             self.raise_flapping_stop_log_entry(r, low_flap_threshold)
+            # and a notification
+            self.remove_in_progress_notifications()
+            self.create_notifications('FLAPPINGSTOP')
             # And update our status for modules
             b = self.get_update_status_brok()
             self.broks.append(b)
@@ -156,6 +159,9 @@ class SchedulingItem(Item):
             self.is_flapping = True
             # We also raise a log entry
             self.raise_flapping_start_log_entry(r, high_flap_threshold)
+            # and a notification
+            self.remove_in_progress_notifications()
+            self.create_notifications('FLAPPINGSTART')
             # And update our status for modules
             b = self.get_update_status_brok()
             self.broks.append(b)
diff --git a/shinken/objects/service.py b/shinken/objects/service.py
index 394e2e2..e38494f 100644
--- a/shinken/objects/service.py
+++ b/shinken/objects/service.py
@@ -888,7 +888,7 @@ class Service(SchedulingItem):
             return True
 
         # Block if flapping
-        if self.is_flapping:
+        if self.is_flapping and type not in ('FLAPPINGSTART', 'FLAPPINGSTOP', 'FLAPPINGDISABLED'):
             return True
 
         # Block if host is down
diff --git a/shinken/scheduler.py b/shinken/scheduler.py
index 3b59d08..2f182fb 100644
--- a/shinken/scheduler.py
+++ b/shinken/scheduler.py
@@ -490,6 +490,7 @@ class Scheduler:
                         # notification_commands) which are executed in the reactionner.
                         item = a.ref
                         childnotifications = []
+
                         if not item.notification_is_blocked_by_item(a.type, now):
                             # If it is possible to send notifications of this type at the current time, then create
                             # a single notification for each contact of this item.
diff --git a/test/test_flapping.py b/test/test_flapping.py
index e22df84..8402456 100755
--- a/test/test_flapping.py
+++ b/test/test_flapping.py
@@ -68,6 +68,7 @@ class TestFlapping(ShinkenTest):
         self.assert_(svc.is_flapping)
         #and get a log about it
         self.assert_(self.any_log_match('SERVICE FLAPPING ALERT.*;STARTED'))
+        self.assert_(self.any_log_match('SERVICE NOTIFICATION.*;FLAPPINGSTART'))
 
         # Now we put it as back :)
         # 10 is not enouth to get back as normal
@@ -82,6 +83,7 @@ class TestFlapping(ShinkenTest):
             print "In flapping?", svc.is_flapping
         self.assert_(not svc.is_flapping)
         self.assert_(self.any_log_match('SERVICE FLAPPING ALERT.*;STOPPED'))
+        self.assert_(self.any_log_match('SERVICE NOTIFICATION.*;FLAPPINGSTART'))
 
 if __name__ == '__main__':
     unittest.main()

-- 
UNNAMED PROJECT



More information about the Pkg-nagios-changes mailing list