add a directory for running nagios scale/performance tests
[monitor.git] / nagios / plugins / checkcycle.py
1 #!/usr/bin/python
2
3 import time
4 import sys
5 import plc
6
7 def argv_to_dict(argv):
8     """
9         NOTE: very bare-bones, no error checking, will fail easily.
10     """
11     d = {}
12     prev=None
13     for a in argv:
14         if "--" == a[0:2]:
15             prev = a[2:]
16         elif "-" == a[0:1]:
17             prev = a[1:]
18         else:
19             d[prev] = a
20     return d
21
22 def main():
23     d = argv_to_dict(sys.argv[1:])
24
25     type = None
26     if 'type' in d:
27         type = d['type']
28     else:
29         print "No type specified (--type <type>)"
30         sys.exit(1)
31
32     if 'H' in d:
33         hostname = d['H']
34     else:
35         print "No hostname specified (-H <hostname>)"
36         sys.exit(1)
37
38     # TODO: have two thresholds.  One for warning, another for critical.
39
40     print "No cycles detected for %s" % hostname
41     sys.exit(0)
42
43         
44 if __name__ == '__main__':
45     main()