本文整理汇总了Python中shinken.scheduler.Scheduler.put_results方法的典型用法代码示例。如果您正苦于以下问题:Python Scheduler.put_results方法的具体用法?Python Scheduler.put_results怎么用?Python Scheduler.put_results使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类shinken.scheduler.Scheduler
的用法示例。
在下文中一共展示了Scheduler.put_results方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ShinkenTest
# 需要导入模块: from shinken.scheduler import Scheduler [as 别名]
# 或者: from shinken.scheduler.Scheduler import put_results [as 别名]
#.........这里部分代码省略.........
obj.update_in_checking()
self.fake_check(obj, exit_status, output)
self.sched.manage_internal_checks()
self.sched.consume_results()
self.sched.get_new_actions()
self.sched.get_new_broks()
self.sched.scatter_master_notifications()
self.worker_loop(verbose)
for ref in reflist:
(obj, exit_status, output) = ref
obj.checks_in_progress = []
self.sched.update_downtimes_and_comments()
#time.sleep(ref.retry_interval * 60 + 1)
if do_sleep:
time.sleep(sleep_time)
def worker_loop(self, verbose=True):
self.sched.delete_zombie_checks()
self.sched.delete_zombie_actions()
checks = self.sched.get_to_run_checks(True, False, worker_name='tester')
actions = self.sched.get_to_run_checks(False, True, worker_name='tester')
#print "------------ worker loop checks ----------------"
#print checks
#print "------------ worker loop actions ----------------"
if verbose is True:
self.show_actions()
#print "------------ worker loop new ----------------"
for a in actions:
a.status = 'inpoller'
a.check_time = time.time()
a.exit_status = 0
self.sched.put_results(a)
if verbose is True:
self.show_actions()
#print "------------ worker loop end ----------------"
def show_logs(self):
print "--- logs <<<----------------------------------"
if hasattr(self, "sched"):
broks = self.sched.broks
else:
broks = self.broks
for brok in sorted(broks.values(), lambda x, y: x.id - y.id):
if brok.type == 'log':
brok.prepare()
safe_print("LOG: ", brok.data['log'])
print "--- logs >>>----------------------------------"
def show_actions(self):
print "--- actions <<<----------------------------------"
if hasattr(self, "sched"):
actions = self.sched.actions
else:
actions = self.actions
for a in sorted(actions.values(), lambda x, y: x.id - y.id):
if a.is_a == 'notification':
if a.ref.my_type == "host":
ref = "host: %s" % a.ref.get_name()
else:
ref = "host: %s svc: %s" % (a.ref.host.get_name(), a.ref.get_name())
print "NOTIFICATION %d %s %s %s %s" % (a.id, ref, a.type, time.asctime(time.localtime(a.t_to_go)), a.status)
示例2: ShinkenTest
# 需要导入模块: from shinken.scheduler import Scheduler [as 别名]
# 或者: from shinken.scheduler.Scheduler import put_results [as 别名]
#.........这里部分代码省略.........
print "processing check", loop
for ref in reflist:
(obj, exit_status, output) = ref
obj.update_in_checking()
self.fake_check(obj, exit_status, output)
self.sched.manage_internal_checks()
self.sched.consume_results()
self.sched.get_new_actions()
self.sched.get_new_broks()
self.worker_loop()
for ref in reflist:
(obj, exit_status, output) = ref
obj.checks_in_progress = []
self.sched.update_downtimes_and_comments()
#time.sleep(ref.retry_interval * 60 + 1)
if do_sleep:
time.sleep(sleep_time)
def worker_loop(self):
self.sched.delete_zombie_checks()
self.sched.delete_zombie_actions()
checks = self.sched.get_to_run_checks(True, False, worker_name='tester')
actions = self.sched.get_to_run_checks(False, True, worker_name='tester')
#print "------------ worker loop checks ----------------"
#print checks
#print "------------ worker loop actions ----------------"
self.show_actions()
#print "------------ worker loop new ----------------"
for a in actions:
a.status = 'inpoller'
a.check_time = time.time()
a.exit_status = 0
self.sched.put_results(a)
self.show_actions()
#print "------------ worker loop end ----------------"
def show_logs(self):
print "--- logs <<<----------------------------------"
for brok in sorted(self.sched.broks.values(), lambda x, y: x.id - y.id):
if brok.type == 'log':
print "LOG:", brok.data['log']
print "--- logs >>>----------------------------------"
def show_actions(self):
print "--- actions <<<----------------------------------"
for a in sorted(self.sched.actions.values(), lambda x, y: x.id - y.id):
if a.is_a == 'notification':
if a.ref.my_type == "host":
ref = "host: %s" % a.ref.get_name()
else:
ref = "host: %s svc: %s" % (a.ref.host.get_name(), a.ref.get_name())
print "NOTIFICATION %d %s %s %s %s" % (a.id, ref, a.type, time.asctime(time.localtime(a.t_to_go)), a.status)
elif a.is_a == 'eventhandler':
print "EVENTHANDLER:", a
print "--- actions >>>----------------------------------"
def show_and_clear_logs(self):
self.show_logs()
self.clear_logs()
def show_and_clear_actions(self):
示例3: ShinkenTest
# 需要导入模块: from shinken.scheduler import Scheduler [as 别名]
# 或者: from shinken.scheduler.Scheduler import put_results [as 别名]
#.........这里部分代码省略.........
for loop in range(1, count + 1):
print "processing check", loop
for ref in reflist:
(obj, exit_status, output) = ref
obj.update_in_checking()
self.fake_check(obj, exit_status, output)
self.sched.manage_internal_checks()
self.sched.consume_results()
self.sched.get_new_actions()
self.sched.get_new_broks()
self.worker_loop()
for ref in reflist:
(obj, exit_status, output) = ref
obj.checks_in_progress = []
self.sched.update_downtimes_and_comments()
#time.sleep(ref.retry_interval * 60 + 1)
if do_sleep:
time.sleep(sleep_time)
def worker_loop(self):
self.sched.delete_zombie_checks()
self.sched.delete_zombie_actions()
checks = self.sched.get_to_run_checks(True, False, worker_name='tester')
actions = self.sched.get_to_run_checks(False, True, worker_name='tester')
#print "------------ worker loop checks ----------------"
#print checks
#print "------------ worker loop actions ----------------"
self.show_actions()
#print "------------ worker loop new ----------------"
for a in actions:
a.status = 'inpoller'
a.check_time = time.time()
a.exit_status = 0
self.sched.put_results(a)
self.show_actions()
#print "------------ worker loop end ----------------"
def show_logs(self):
print "--- logs <<<----------------------------------"
for brok in sorted(self.sched.broks.values(), lambda x, y: x.id - y.id):
if brok.type == 'log':
brok.prepare()
print "LOG:", brok.data['log']
print "--- logs >>>----------------------------------"
def show_actions(self):
print "--- actions <<<----------------------------------"
for a in sorted(self.sched.actions.values(), lambda x, y: x.id - y.id):
if a.is_a == 'notification':
if a.ref.my_type == "host":
ref = "host: %s" % a.ref.get_name()
else:
ref = "host: %s svc: %s" % (a.ref.host.get_name(), a.ref.get_name())
print "NOTIFICATION %d %s %s %s %s" % (a.id, ref, a.type, time.asctime(time.localtime(a.t_to_go)), a.status)
elif a.is_a == 'eventhandler':
print "EVENTHANDLER:", a
print "--- actions >>>----------------------------------"
def show_and_clear_logs(self):
self.show_logs()
self.clear_logs()
def show_and_clear_actions(self):
self.show_actions()
self.clear_actions()
示例4: ShinkenTest
# 需要导入模块: from shinken.scheduler import Scheduler [as 别名]
# 或者: from shinken.scheduler.Scheduler import put_results [as 别名]
#.........这里部分代码省略.........
print "processing check", loop
for ref in reflist:
(obj, exit_status, output) = ref
obj.update_in_checking()
self.fake_check(obj, exit_status, output)
self.sched.manage_internal_checks()
self.sched.consume_results()
self.sched.get_new_actions()
self.sched.get_new_broks()
self.worker_loop()
for ref in reflist:
(obj, exit_status, output) = ref
obj.checks_in_progress = []
self.sched.update_downtimes_and_comments()
#time.sleep(ref.retry_interval * 60 + 1)
if do_sleep:
time.sleep(sleep_time)
def worker_loop(self):
self.sched.delete_zombie_checks()
self.sched.delete_zombie_actions()
checks = self.sched.get_to_run_checks(True, False, worker_name='tester')
actions = self.sched.get_to_run_checks(False, True, worker_name='tester')
#print "------------ worker loop checks ----------------"
#print checks
#print "------------ worker loop actions ----------------"
self.show_actions()
#print "------------ worker loop new ----------------"
for a in actions:
a.status = 'inpoller'
a.check_time = time.time()
a.exit_status = 0
self.sched.put_results(a)
self.show_actions()
#print "------------ worker loop end ----------------"
def show_logs(self):
print "--- logs <<<----------------------------------"
for brok in sorted(self.sched.broks.values(), lambda x, y: x.id - y.id):
if brok.type == 'log':
print "LOG:", brok.data['log']
print "--- logs >>>----------------------------------"
def show_actions(self):
print "--- actions <<<----------------------------------"
for a in sorted(self.sched.actions.values(), lambda x, y: x.id - y.id):
if a.is_a == 'notification':
if a.ref.my_type == "host":
ref = "host: %s" % a.ref.get_name()
else:
ref = "host: %s svc: %s" % (a.ref.host.get_name(), a.ref.get_name())
print "NOTIFICATION %d %s %s %s %s" % (a.id, ref, a.type, time.asctime(time.localtime(a.t_to_go)), a.status)
elif a.is_a == 'eventhandler':
print "EVENTHANDLER:", a
print "--- actions >>>----------------------------------"
def show_and_clear_logs(self):
self.show_logs()
self.clear_logs()
def show_and_clear_actions(self):