X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=showlatlon.py;h=ea0891c006dad9b29a6008609d53933f0fc3ee68;hb=refs%2Fheads%2F1.0;hp=fbed374300096280b164b20a4202ed4d133ddce5;hpb=6496f5b4a0220e4055fee76c97f92293f9559117;p=monitor.git diff --git a/showlatlon.py b/showlatlon.py index fbed374..ea0891c 100755 --- a/showlatlon.py +++ b/showlatlon.py @@ -1,8 +1,7 @@ #!/usr/bin/python import plc -import auth -api = plc.PLC(auth.auth, auth.plc) +api = plc.getAuthAPI() import sys import reboot @@ -13,7 +12,6 @@ import comon from nodecommon import color_pcu_state, datetime_fromstr from nodehistory import get_filefromglob import time -import traceback # region # total @@ -30,11 +28,11 @@ def gethardwarequality(nodename, fb): for field in ['cpuspeed', 'memsize', 'disksize']: if field not in cstat: cstat[field] = "null" - if cstat['cpuspeed'] != "null" and float(cstat['cpuspeed']) < 2.4: + if cstat['cpuspeed'] != "null" and float(cstat['cpuspeed']) < 2.2: return "BAD" # "cpu_slow", - if cstat['memsize'] != "null" and float(cstat['memsize']) < 2.9: + if cstat['memsize'] != "null" and float(cstat['memsize']) < 2.8: return "BAD" # "mem_small", - if cstat['disksize'] != "null" and float(cstat['disksize']) < 320.0: + if cstat['disksize'] != "null" and float(cstat['disksize']) < 250.0: return "BAD" # "disk_small", if cstat['disksize'] == "null" and \ @@ -43,9 +41,9 @@ def gethardwarequality(nodename, fb): return "N/A" try: - if float(cstat['cpuspeed']) >= 2.4 and \ - float(cstat['memsize']) >= 2.9 and \ - (cstat['disksize'] == "null" or float(cstat['disksize']) >= 320.0): + if float(cstat['cpuspeed']) >= 2.2 and \ + float(cstat['memsize']) >= 2.8 and \ + (cstat['disksize'] == "null" or float(cstat['disksize']) >= 250.0): return "A-OK" except: print cstat @@ -84,8 +82,8 @@ def main(): begin = time.strftime(format) d = datetime_fromstr(begin) - fbstr = get_filefromglob(d, "production.findbad") - fbpcustr = get_filefromglob(d, "production.findbadpcus") + fbstr = get_filefromglob(d, "production.findbad")[0] + fbpcustr = get_filefromglob(d, "production.findbadpcus")[0] l_plcnodes = database.dbLoad("l_plcnodes") l_plcsites = database.dbLoad("l_plcsites") @@ -151,7 +149,6 @@ def main(): 'hardware' : gethardwarequality(hostname, fb), 'pcuok' : color_pcu_state(fb['nodes'][hostname]['values']) } #except: - # print traceback.print_exc() # print args # print fb['nodes'][hostname]['values'] results.append("%(cc)7s %(status)8s %(hardware)8s %(pcuok)8s %(site)15s %(host)42s " % args)