X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=nodehistory.py;h=f68d7b957848712b854b1edbc08d826f6ec6e283;hb=refs%2Fheads%2F1.0;hp=a7f030baa39c9126f9e10ed764d7b5910bab5504;hpb=32e6f3bdf4fe68b057cf070b756418333ae707d6;p=monitor.git diff --git a/nodehistory.py b/nodehistory.py index a7f030b..f68d7b9 100755 --- a/nodehistory.py +++ b/nodehistory.py @@ -23,17 +23,20 @@ def get_filefromglob(d, str): glob_str = "%s*.%s.pkl" % (d.strftime("%Y-%m-%d"), str) os.chdir(path) #print glob_str - file = glob.glob(glob_str)[0] + #file = glob.glob(glob_str)[0] + files = glob.glob(glob_str) #print "loading %s" % file os.chdir("..") - return file[:-4] + files_chng = [ file[:-4] for file in files ] + return files_chng #fb = archive.load(file[:-4]) def fb_print_nodeinfo(fbnode, verbose, date=None): if verbose: print " state | ssh | pcu | bootcd | category | kernel" if 'checked' in fbnode: - print "%11.11s " % diff_time(fbnode['checked']), + if date: print date, + #print "%11.11s " % diff_time(fbnode['checked']), else: if date: print date, else: print "Unknown", @@ -106,21 +109,22 @@ def main(): verbose = 1 while True: - file = get_filefromglob(d, "production.findbad") - #file = "%s.production.findbad" % d.strftime("%Y-%m-%d") try: - fb = archive.load(file) - if config.node in fb['nodes']: - fb_nodeinfo = fb['nodes'][config.node]['values'] - fb_print_nodeinfo(fb_nodeinfo, verbose, d.strftime("%Y-%m-%d")) + for file in get_filefromglob(d, "production.findbad"): + #file = get_filefromglob(d, "production.findbad") + #file = "%s.production.findbad" % d.strftime("%Y-%m-%d") + fb = archive.load(file) + if config.node in fb['nodes']: + fb_nodeinfo = fb['nodes'][config.node]['values'] + fb_print_nodeinfo(fb_nodeinfo, verbose, d.strftime("%Y-%m-%d")) + + del fb + verbose = 0 - del fb - verbose = 0 except KeyboardInterrupt: sys.exit(1) except: - #import traceback; print traceback.print_exc() print d.strftime("%Y-%m-%d"), "No record" d = d + tdelta