X-Git-Url: http://git.onelab.eu/?p=monitor.git;a=blobdiff_plain;f=comon.py;h=a380dcb4e67c8b266d32f93d3ccd145f2a17c077;hp=ad4035fe354346be918b92f6feed009dc72dd1e7;hb=3c23a4ed51286bf458448a7353f40bd62560a72f;hpb=356f007eb5b22c187a7c4169c44dca25f78cc694 diff --git a/comon.py b/comon.py index ad4035f..a380dcb 100755 --- a/comon.py +++ b/comon.py @@ -28,16 +28,21 @@ COMONURL = "http://summer.cs.princeton.edu/status/tabulator.cgi?table=table_node class Comon(Thread): """ + cdb is the comon database (dictionary) + all buckets is a queue of all problem nodes. This gets sent to rt to find + tickets open for host. """ def __init__(self, cdb, allbuckets): self.codata = cdb self.updated = time.time() self.allbuckets = allbuckets - self.comonbkts = {"ssh": "sshstatus%20%3E%202h", + self.comonbkts = {"down" : "resptime%20==%200%20&&%20keyok==null", + "ssh": "sshstatus%20%3E%202h", "clock_drift": "drift%20%3E%201m", "dns": "dns1udp%20%3E%2080%20&&%20dns2udp%20%3E%2080", "disk": "resptime%20%3E%200%20&&%20gbfree%20%3C%205", - "filerw": "filerw%3E0"} + "filerw": "filerw%3E0", + "dbg" : "keyok==0"} Thread.__init__(self) def __tohash(self,rawdata): @@ -69,7 +74,7 @@ class Comon(Thread): # Get time of update self.updated = time.time() # Make a Hash, put in self. - self.codata = self.coget(COMONURL + "&format=formatcsv") + self.codata.update(self.coget(COMONURL + "&format=formatcsv")) def coget(self,url): rawdata = None @@ -115,13 +120,21 @@ def main(): t = Queue.Queue() cdb = {} a = Comon(cdb,t) + print a.comonbkts a.start() - time.sleep(3) - print a.ssh + + time.sleep(5) + print a.down + + time.sleep(5) + #print cdb + for host in cdb.keys(): + if cdb[host]['keyok'] == "0": + print("%s \t Bootstate %s nodetype %s kernver %s keyok %s" %(host, cdb[host]['bootstate'], cdb[host]['nodetype'], cdb[host]['kernver'], cdb[host]['keyok'])) #time.sleep(3) #a.push() #print a.filerw - print a.coget(COMONURL + "&format=formatcsv&select='" + a.comonbkts['filerw']) + #print a.coget(COMONURL + "&format=formatcsv&select='" + a.comonbkts['filerw']) os._exit(0) if __name__ == '__main__':