2 # Copyright (c) 2004 The Trustees of Princeton University (Trustees).
4 # Faiyaz Ahmed <faiyaza@cs.princeton.edu>
10 #from monitor import *
11 from threading import *
17 logger = logging.getLogger("monitor")
19 # Time to enforce policy
25 # DNS, kinda down (sick)
26 # clock, kinda down (sick)
27 # Full disk, going to be down
31 # suspend slice creation
34 def __init__(self, comonthread, tickets):
35 self.cmn = comonthread
36 self.tickets = tickets
37 # host - > time of email
39 # all sick nodes w/ tickets
40 self.cursickw = tickets
41 # all sick nodes w/o tickets
45 Gets all nodes without tickets and puts them in self.cursick
49 for bucket in self.cmn.comonbkts.keys():
50 for host in getattr(self.cmn, bucket):
51 if host not in self.cursickw.keys():
52 if host not in self.cursick:
53 self.cursick.append(host)
54 logger.debug("Nodes sick wo tickets %s " % len(self.cursick))
60 for node in self.cmn.ssh:
61 if node in self.cursick:
62 if node not in self.emailed.keys():
63 logger.debug("Emailing " + node)
65 self.emailed[node] = "ssh"
66 mailer.email('DISREGARD',
67 emailTxt.mailtxt.STANDARD % {'hostname': node},
68 "tech-" + mailer.siteId(node) + "@sites.planet-lab.org")
69 except Exception, err:
73 Prints, logs, and emails status of up nodes, down nodes, and buckets.