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

Naparuba naparuba at gmail.com
Tue Feb 28 22:19:59 UTC 2012


The following commit has been merged in the debian/master branch:
commit d186a6d4e7f12d9d89d0d49dcfdbf7223ba8d8ef
Author: Naparuba <naparuba at gmail.com>
Date:   Tue Feb 7 09:50:08 2012 +0100

    Fix : #148 : STOP_ACCEPTING_PASSIVE_SVC_CHECKS got not effect

diff --git a/shinken/external_command.py b/shinken/external_command.py
index 77c89e7..fbb1a00 100644
--- a/shinken/external_command.py
+++ b/shinken/external_command.py
@@ -1317,13 +1317,13 @@ class ExternalCommandManager:
 
     # STOP_ACCEPTING_PASSIVE_HOST_CHECKS
     def STOP_ACCEPTING_PASSIVE_HOST_CHECKS(self):
-        self.accept_passive_host_checks = False
+        self.conf.accept_passive_host_checks = False
         self.conf.explode_global_conf()
         self.sched.get_and_register_update_program_status_brok()
 
     # STOP_ACCEPTING_PASSIVE_SVC_CHECKS
     def STOP_ACCEPTING_PASSIVE_SVC_CHECKS(self):
-        self.accept_passive_service_checks = False
+        self.conf.accept_passive_service_checks = False
         self.conf.explode_global_conf()
         self.sched.get_and_register_update_program_status_brok()
 
diff --git a/test/etc/nagios_1r_1h_1s.cfg b/test/etc/nagios_not_execute_host_check.cfg
similarity index 87%
copy from test/etc/nagios_1r_1h_1s.cfg
copy to test/etc/nagios_not_execute_host_check.cfg
index 1566c73..45fa330 100644
--- a/test/etc/nagios_1r_1h_1s.cfg
+++ b/test/etc/nagios_not_execute_host_check.cfg
@@ -8,14 +8,14 @@ auto_rescheduling_interval=30
 auto_rescheduling_window=180
 cached_host_check_horizon=15
 cached_service_check_horizon=15
-cfg_file=1r_1h_1s/hosts.cfg
-cfg_file=1r_1h_1s/services.cfg
-cfg_file=1r_1h_1s/contacts.cfg
-cfg_file=1r_1h_1s/commands.cfg
-cfg_file=1r_1h_1s/timeperiods.cfg
-cfg_file=1r_1h_1s/hostgroups.cfg
-cfg_file=1r_1h_1s/servicegroups.cfg
-cfg_file=1r_1h_1s/shinken-specific.cfg
+cfg_file=not_execute_host_check/hosts.cfg
+cfg_file=not_execute_host_check/services.cfg
+cfg_file=not_execute_host_check/contacts.cfg
+cfg_file=not_execute_host_check/commands.cfg
+cfg_file=not_execute_host_check/timeperiods.cfg
+cfg_file=not_execute_host_check/hostgroups.cfg
+cfg_file=not_execute_host_check/servicegroups.cfg
+cfg_file=not_execute_host_check/shinken-specific.cfg
 check_external_commands=1
 check_for_orphaned_hosts=1
 check_for_orphaned_services=1
@@ -39,7 +39,7 @@ enable_predictive_host_dependency_checks=1
 enable_predictive_service_dependency_checks=1
 event_broker_options=-1
 event_handler_timeout=30
-execute_host_checks=1
+execute_host_checks=0
 execute_service_checks=1
 external_command_buffer_slots=4096
 high_host_flap_threshold=20
diff --git a/test/etc/1r_1h_1s/commands.cfg b/test/etc/not_execute_host_check/commands.cfg
similarity index 100%
copy from test/etc/1r_1h_1s/commands.cfg
copy to test/etc/not_execute_host_check/commands.cfg
diff --git a/test/etc/1r_1h_1s/contacts.cfg b/test/etc/not_execute_host_check/contacts.cfg
similarity index 100%
copy from test/etc/1r_1h_1s/contacts.cfg
copy to test/etc/not_execute_host_check/contacts.cfg
diff --git a/test/etc/1r_1h_1s/hostgroups.cfg b/test/etc/not_execute_host_check/hostgroups.cfg
similarity index 100%
copy from test/etc/1r_1h_1s/hostgroups.cfg
copy to test/etc/not_execute_host_check/hostgroups.cfg
diff --git a/test/etc/1r_1h_1s/hosts.cfg b/test/etc/not_execute_host_check/hosts.cfg
similarity index 100%
copy from test/etc/1r_1h_1s/hosts.cfg
copy to test/etc/not_execute_host_check/hosts.cfg
diff --git a/test/etc/1r_1h_1s/servicegroups.cfg b/test/etc/not_execute_host_check/servicegroups.cfg
similarity index 100%
copy from test/etc/1r_1h_1s/servicegroups.cfg
copy to test/etc/not_execute_host_check/servicegroups.cfg
diff --git a/test/etc/1r_1h_1s/services.cfg b/test/etc/not_execute_host_check/services.cfg
similarity index 100%
copy from test/etc/1r_1h_1s/services.cfg
copy to test/etc/not_execute_host_check/services.cfg
diff --git a/test/etc/1r_1h_1s/shinken-specific.cfg b/test/etc/not_execute_host_check/shinken-specific.cfg
similarity index 100%
copy from test/etc/1r_1h_1s/shinken-specific.cfg
copy to test/etc/not_execute_host_check/shinken-specific.cfg
diff --git a/test/etc/10r_1000h_20000s/timeperiods.cfg b/test/etc/not_execute_host_check/timeperiods.cfg
similarity index 100%
copy from test/etc/10r_1000h_20000s/timeperiods.cfg
copy to test/etc/not_execute_host_check/timeperiods.cfg
diff --git a/test/test_bad_escalation_on_groups.py b/test/test_not_execute_host_check.py
similarity index 55%
copy from test/test_bad_escalation_on_groups.py
copy to test/test_not_execute_host_check.py
index 1158de1..f8da949 100755
--- a/test/test_bad_escalation_on_groups.py
+++ b/test/test_not_execute_host_check.py
@@ -26,15 +26,15 @@
 from shinken_test import *
 
 
-class TestBadEscaOnGroups(ShinkenTest):
+class TestNoHostCheck(ShinkenTest):
     #Uncomment this is you want to use a specific configuration
     #for your test
     def setUp(self):
-        self.setup_with_file('etc/nagios_bad_escalation_on_groups.cfg')
+        self.setup_with_file('etc/nagios_not_execute_host_check.cfg')
 
     
-    #Change ME :)
-    def test_escalation_inheritance(self):
+    # We must look taht host checks are disable, and services ones are running
+    def test_no_host_check(self):
         #
         # Config is not correct because of a wrong relative path
         # in the main config file
@@ -42,20 +42,37 @@ class TestBadEscaOnGroups(ShinkenTest):
         print "Get the hosts and services"
         now = time.time()
         host = self.sched.hosts.find_by_name("test_host_0")
-        host.checks_in_progress = []
-        host.act_depend_of = [] # ignore the router
-        router = self.sched.hosts.find_by_name("test_router_0")
-        router.checks_in_progress = []
-        router.act_depend_of = [] # ignore the router
+        print host.checks_in_progress
+        self.assert_(len(host.checks_in_progress) == 0)
+        #
         svc = self.sched.services.find_srv_by_name_and_hostname("test_host_0", "test_ok_0")
-        svc.checks_in_progress = []
-        svc.act_depend_of = [] # no hostchecks on critical checkresults
-        print svc.escalations
+        print svc.checks_in_progress
+        self.assert_(len(svc.checks_in_progress) != 0)
+
+        # Now launch passive checks
+        cmd = "[%lu] PROCESS_HOST_CHECK_RESULT;test_host_0;1;bobo" % now
+        self.sched.run_external_command(cmd)
+
+        self.scheduler_loop(2, [])
+
+        print "Output", host.output
+        self.assert_(host.output == 'bobo')
 
-        self.assert_(len(svc.escalations) > 0)
-        es = svc.escalations.pop()
-        self.assert_(es.is_correct())
+        # Now disable passive host check
+        cmd = "[%lu] STOP_ACCEPTING_PASSIVE_HOST_CHECKS" % now
+        self.sched.run_external_command(cmd)
         
+        # And now run a new command
+        cmd = "[%lu] PROCESS_HOST_CHECK_RESULT;test_host_0;1;bobo2" % now
+        self.sched.run_external_command(cmd)
+
+        self.scheduler_loop(2, [])
+
+        # This should NOT change this time
+        print "Output", host.output
+        self.assert_(host.output == 'bobo')
+
+
 
 if __name__ == '__main__':
     unittest.main()

-- 
UNNAMED PROJECT



More information about the Pkg-nagios-changes mailing list