Пример #1
0
 def check(self):
     if not SYSTEM["monitor"]["SOURCE"]:
         message = "Source monitor is disable, check your config!"
         self.logger.error(message)
         print message
         time.sleep(60)
         exit(0)
     ancestor_thread_list = []
     file = File()
     profile_list = file.get_check_list()
     profile_list = profile_list[0:len(profile_list)-1]
     if(profile_list):
         for line in profile_list.split('\n'):
             self.logger.debug("Last Check : %s"%(line))
             profile = json.loads(line)
             while threading.activeCount() > profile['thread']:
                 time.sleep(1)
             t = threading.Thread(target=self.check_source,args=(profile['source'],
                 profile['status'],
                 profile['pa_id'],
                 profile['agent'],
                 profile['name'],
                 profile['type'],
                 )
             )
             t.start()
         #time.sleep(30)
             ancestor_thread_list.append(t)
     for ancestor_thread in ancestor_thread_list:
         ancestor_thread.join()
     time.sleep(10)