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

Naparuba naparuba at gmail.com
Tue Feb 28 22:07:21 UTC 2012


The following commit has been merged in the debian/master branch:
commit a469da046cad48af25bd6aaea1295c8640cbcdf2
Author: Naparuba <naparuba at gmail.com>
Date:   Wed Nov 23 10:04:29 2011 +0100

    Fix : if a scheduler restart, we got problem because the arbiter did't resend it the configuration.

diff --git a/shinken/daemons/schedulerdaemon.py b/shinken/daemons/schedulerdaemon.py
index f74c551..95b4473 100644
--- a/shinken/daemons/schedulerdaemon.py
+++ b/shinken/daemons/schedulerdaemon.py
@@ -346,6 +346,10 @@ class Shinken(BaseSatellite):
         #External command need the sched because he can raise checks
         e.load_scheduler(self.sched)
 
+        # We clear our schedulers managed (it's us :) )
+        # and set ourself in it
+        self.schedulers = {self.conf.instance_id : self.sched}
+
 
     # our main function, launch after the init
     def main(self):
diff --git a/shinken/dispatcher.py b/shinken/dispatcher.py
index cc20c4a..a5b6a28 100644
--- a/shinken/dispatcher.py
+++ b/shinken/dispatcher.py
@@ -145,6 +145,16 @@ class Dispatcher:
                         sched.conf.assigned_to = None
                         sched.conf.is_assigned = False
                         sched.conf = None
+                    # Maybe the scheduler restart, so is alive but without the conf we think he was managing
+                    # so ask him what it is really managing, and if not, put the conf unassigned
+                    if not sched.do_i_manage(cfg_id):
+                        self.dispatch_ok = False #so we ask a new dispatching
+                        logger.log("Warning : Scheduler %s did not managed its configuration %d,I am not happy." % (sched.get_name(), cfg_id))
+                        if sched.conf:
+                            sched.conf.assigned_to = None
+                            sched.conf.is_assigned = False
+                        sched.need_conf = True
+                        sched.conf = None
                     # Else: ok the conf is managed by a living scheduler
 
         # Maybe satelite are alive, but do not still have a cfg but
@@ -362,6 +372,9 @@ class Dispatcher:
                         sched.need_conf = False
                         conf.is_assigned = True
                         conf.assigned_to = sched
+
+                        # We update all data for this scheduler
+                        sched.managed_confs = [conf.id]
                         
                         # Now we generate the conf for satellites:
                         cfg_id = conf.id
diff --git a/test/test_end_to_end.sh b/test/test_end_to_end.sh
index f551672..2a04a83 100755
--- a/test/test_end_to_end.sh
+++ b/test/test_end_to_end.sh
@@ -394,7 +394,6 @@ sleep 10
 
 #The number of process changed, we mush look for it
 
-
 #Standard launch process packets
 NB_SCHEDULERS=4
 #1 + nb cpus for stack 1, and same for stack 2
@@ -481,6 +480,69 @@ echo "Now we clean it"
 ./clean.sh
 
 
+
+
+
+echo "####################################################################################"
+echo "#                                                                                  #"
+echo "#                              Scheduler restart                                   #"
+echo "#                                                                                  #"
+echo "####################################################################################"
+
+
+echo "Now we can start some launch tests"
+localize_config etc/nagios.cfg etc/shinken-specific.cfg
+bin/launch_all_debug.sh
+globalize_config etc/nagios.cfg etc/shinken-specific.cfg
+
+
+echo "Now checking for existing apps"
+
+echo "we can sleep 5sec for conf dispatching and so good number of process"
+sleep 10
+
+#The number of process changed, we mush look for it
+
+#Standard launch process packets
+NB_SCHEDULERS=2
+# NB Poller is 1 for core + nb cpus
+NB_POLLERS=$((2 + $NB_CPUS))
+NB_REACTIONNERS=3
+NB_BROKERS=4
+NB_RECEIVERS=2
+NB_ARBITERS=3  # master itself & namedpipe-autogenerated !
+
+#Now check if the run looks good with var in the direct directory
+check_good_run var var var
+
+echo "All launch of LB daemons is OK"
+
+
+#Now look if it's also good in the log file too
+string_in_file "Dispatch OK of for conf in scheduler scheduler-1" $VAR/nagios.log
+string_in_file "OK, no more reactionner sent need" $VAR/nagios.log
+string_in_file "OK, no more poller sent need" $VAR/nagios.log
+string_in_file "OK, no more broker sent need" $VAR/nagios.log
+
+
+#Now we stop the scheduler and restart it
+# We clean the log and restart teh scheduler
+bin/stop_scheduler.sh
+> $VAR/nagios.log
+sleep 3
+bin/launch_scheduler_debug.sh
+sleep 120
+
+
+
+string_in_file "Warning : Scheduler scheduler-1 did not managed its configuration 0,I am not happy." $VAR/nagios.log
+string_in_file "Dispatch OK of for conf in scheduler scheduler-1" $VAR/nagios.log
+string_in_file "We already got the conf 0 (scheduler-1)" $VAR/nagios.log
+
+echo "Now we clean it"
+./clean.sh
+
+
 echo ""
 echo ""
 echo "All check are OK. Congrats! You can go take a Beer ;)"

-- 
UNNAMED PROJECT



More information about the Pkg-nagios-changes mailing list