7 from monitor.wrapper import plc
9 def argv_to_dict(argv):
11 NOTE: very bare-bones, no error checking, will fail easily.
25 d = argv_to_dict(sys.argv[1:])
28 if 'hostname' in d or 'H' in d:
34 print "UNKNOWN: Argument error"
38 n = api.RebootNodeWithPCU(hostname, True)
40 if "No PCUs associated with Node" in str(e):
41 print "CRITICAL: Failure: %s" % str(e)
44 print "UNKNOWN: Failure: %s" % str(e)
51 print "OK: PCU test successful"
54 print "WARNING: PCU configuration incomplete: %s" % n
57 print "FAKE-CRITICAL: PCU test failed"
61 if __name__ == '__main__':
62 f = open("/tmp/checkpcu", 'a')
63 f.write("checkpcu %s %s\n" % (time.time(), " ".join(sys.argv[1:])))