fix repository link and comment out wiki pages as they're not present
[monitor.git] / nodediff.py
1 #!/usr/bin/python
2
3 import sys
4 import database
5 import config
6 import parser as parsermodule
7
8 def nodes_from_time(time_str):
9         path = "archive-pdb"
10         archive = database.SPickle(path)
11         d = datetime_fromstr(config.fromtime)
12         glob_str = "%s*.production.findbad.pkl" % d.strftime("%Y-%m-%d")
13         os.chdir(path)
14         #print glob_str
15         file = glob.glob(glob_str)[0]
16         #print "loading %s" % file
17         os.chdir("..")
18         fb = archive.load(file[:-4])
19
20         nodelist = fb['nodes'].keys()
21         nodelist = node_select(config.select, nodelist, fb)
22         
23
24 def main():
25         parser = parsermodule.getParser()
26         parser.set_defaults(nodeselect=None,)
27         parser.add_option("", "--nodeselect", dest="nodeselect", metavar="state=BOOT", 
28                                                 help="""Query on the nodes to count""")
29
30         parser = parsermodule.getParser(['defaults'], parser)
31         cfg = parsermodule.parse_args(parser)
32
33         time1 = config.args[0]
34         time2 = config.args[1]
35
36         s1 = nodes_from_time(time1)
37         s2 = nodes_from_time(time2)
38
39 # takes two arguments as dates, comparing the number of up nodes from one and
40 # the other.