Beispiel #1
0
 def run(self):
     daemon.load_config(config_file)
     # We run all the checks initially before
     # to start the scheduling of checks
     for name, check in self.__checks.iteritems():
         Logger.debug('First Run check %s' % (name))
         c = ThreadCheck(check, self.__checkQueue, 0)
         c.start()
         # Ramp Up checks startup by 1 second interval
         time.sleep(1)
     if len(self.__checks) == 0:
         Logger.error('No check have been defined. Exiting...')
         return
     Logger.debug('Check Queue Size is %i' % self.__checkQueue.qsize())
     # Main loop
     # 1) Get the first check from queue
     # 2) Create new thread with wait_time
     # 3) Start the thread and go back to step 1
     while True:
         t, c = self.__checkQueue.get(True)
         wait_time = t - time.time()
         check = c.get_check()
         c.join()
         Logger.debug('wait time %0.2f before running %s' % (wait_time, check.get_name()))
         c = ThreadCheck(check, self.__checkQueue, wait_time)
         c.start()
Beispiel #2
0
         c.start()
         # Ramp Up checks startup by 1 second interval
         time.sleep(1)
     if len(self.__checks) == 0:
         Logger.error('No check have been defined. Exiting...')
         return
     Logger.debug('Check Queue Size is %i' % self.__checkQueue.qsize())
     # Main loop
     # 1) Get the first check from queue
     # 2) Create new thread with wait_time
     # 3) Start the thread and go back to step 1
     while True:
         t, c = self.__checkQueue.get(True)
         wait_time = t - time.time()
         check = c.get_check()
         c.join()
         Logger.debug('wait time %0.2f before running %s' % (wait_time, check.get_name()))
         c = ThreadCheck(check, self.__checkQueue, wait_time)
         c.start()
 
 def signal_handler(self, signal, frame):
     print 'Exiting ...'
     while  self.__checkQueue.qsize() > 0:
         t, c = self.__checkQueue.get(True)
         c.join(0)
     sys.exit(0)
 
 def debug(self):
     '''
     Debug Mode for running from command line
     '''