1 """
2 This is what job_function needs as parameter for each job to successfully
3 execute.
4 """
5
6 from command import Command
7
9 i=0
10 while True:
11 yield i
12 i+=1
13
15 - def __init__(self, hostgroupname, members, hosts, hostServices, threshold, parent=None):
16 self.members = members
17 self.hosts = hosts
18 self.hostServices = hostServices
19 self.threshold = threshold
20 self.parent = parent
21 self.name = generateId()
22
23 self.jobs = []
24
27
30
33
35 nextExecution = None
36 for job in self.jobs:
37 jobExec = job.trigger.get_next_fire_time()
38 if nextExecution is None or nextExecution > jobExec:
39 nextExecution = jobExec
40 return nextExecution
41
43 self.log.d("handle call")
44 self.log.d(self.hostServices)
45 try:
46
47 for hs in self.hostServices:
48 self.log.d(str(hs))
49 cmd=Command(hs.service.command, self.log)
50 cmd.call()
51 self.log.d(cmd.getAllOutput())
52 except Error:
53 self.log.d(Error)
54
55
56
57
58
59
60
61
62
63