X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=showlatlon.py;h=951802ad15eef0975a3bb6a69685bf8462a8bdc1;hb=4d56ef5473c6486c321dd2797be45b45b0606dae;hp=10367e43bcb8a05b01381d2120074efd3bf6f81f;hpb=c51ad794e8dc07072d705b508e79ba06849aa408;p=monitor.git diff --git a/showlatlon.py b/showlatlon.py index 10367e4..951802a 100755 --- a/showlatlon.py +++ b/showlatlon.py @@ -1,6 +1,6 @@ #!/usr/bin/python -import plc +from monitor.wrapper import plc, plccache api = plc.getAuthAPI() import sys @@ -9,7 +9,7 @@ from datetime import datetime, timedelta import database import comon -from nodecommon import color_pcu_state, datetime_fromstr +from monitor.common import color_pcu_state, datetime_fromstr from nodehistory import get_filefromglob import time import traceback @@ -29,11 +29,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']) < 300.0: return "BAD" # "disk_small", if cstat['disksize'] == "null" and \ @@ -42,9 +42,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']) >= 300.0): return "A-OK" except: print cstat @@ -83,12 +83,12 @@ 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") - lb2hn = database.dbLoad("plcdb_lb2hn") + l_plcnodes = plccache.l_nodes + l_plcsites = plccache.l_sites + lb2hn = plccache.plcdb_lb2hn fb = archive.load(fbstr) fbpcu = archive.load(fbpcustr) reboot.fb = fbpcu