7 def argv_to_dict(argv):
9 NOTE: very bare-bones, no error checking, will fail easily.
23 d = argv_to_dict(sys.argv[1:])
27 site = d['site'].replace('site-cluster-for-','')
29 print "No site specified"
32 notificationnumber = 1
33 if 'notificationnumber' in d or 'n' in d:
35 notificationnumber = int(d['notificationnumber'])
37 notificationnumber = int(d['n'])
41 interval = int(d['interval'])
44 if 'notificationtype' in d:
45 type = d['notificationtype']
47 if type == "RECOVERY":
48 f.write("\t %s %s\n" % (time.time(), "enableSiteSliceCreation(%s)" % site ))
49 f.write("\t %s %s\n" % (time.time(), "enableSiteSlices(%s)" % site ))
50 #plc.enableSiteSliceCreation(site)
51 #plc.enableSiteSlices(site)
53 elif type == "PROBLEM":
54 if notificationnumber <= 3:
56 elif notificationnumber <= 6:
57 f.write("\t %s %s\n" % (time.time(), "removeSiteSliceCreation(%s)" % site ))
58 #plc.removeSiteSliceCreation(site)
59 elif notificationnumber > 6:
60 f.write("\t %s %s\n" % (time.time(), "removeSiteSliceCreation(%s)" % site ))
61 f.write("\t %s %s\n" % (time.time(), "suspendSiteSlices(%s)" % site ))
62 #plc.removeSiteSliceCreation(site)
63 #plc.suspendSiteSlices(site)
65 if __name__ == '__main__':
66 f = open("/tmp/escalation", 'a')
67 f.write("escalation %s %s\n" % (time.time(), " ".join(sys.argv[1:])))