X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=nodehistory.py;h=7ea30fbc8b30a23802da6024d3acbf32d7fffb94;hb=da913fbd1629fc4669b186915df8ff3a340482d3;hp=abbcee8bb78f44df9b3245131c5086f5875b7e82;hpb=c3f2afdc81c6711c3825c82e2cd4970671575438;p=monitor.git diff --git a/nodehistory.py b/nodehistory.py index abbcee8..7ea30fb 100755 --- a/nodehistory.py +++ b/nodehistory.py @@ -11,7 +11,7 @@ import calendar import sys import time -from model import * +from monitor.model import * from nodecommon import * def get_filefromglob(d, str): @@ -23,10 +23,12 @@ 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]) @@ -43,9 +45,10 @@ def fb_print_nodeinfo(fbnode, verbose, date=None): else: fbnode['bootcd'] = "unknown" fbnode['state'] = color_boot_state(get_current_state(fbnode)) + fbnode['boot_state'] = getvalue(fbnode, 'plcnode/boot_state') if len(fbnode['kernel'].split()) >= 3: fbnode['kernel'] = fbnode['kernel'].split()[2] - print " %(state)5s | %(ssh)5.5s | %(pcu)5.5s | %(bootcd)6.6s | %(category)8.8s | %(kernel)s" % fbnode + print " %(state)5s | %(boot_state)s | %(ssh)5.5s | %(pcu)5.5s | %(bootcd)6.6s | %(category)8.8s | %(kernel)s" % fbnode def pcu_print_info(pcuinfo, hostname): print " Checked: ", @@ -105,17 +108,19 @@ 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: