Exemplo n.º 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()
Exemplo n.º 2
0
                # [webcheck]
                # frequency = 120
                if section in checkModules:
                    self.__checkModulesSettings[section] = content.copy()
                    Logger.debug("Load Default Settings for %s" % section)

    def run(self):
        try:
            daemon.load_config(config_file)
        except (Exception), e:
            raise e
        # 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()