X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=nodecommon.py;h=f318949ccc3e04ebf8b6e1a7d58ceb78dfb4e4e1;hb=bc5910f95a3f037ffdc0e66c4e8dd0a1436847eb;hp=ba67625799e6c78eb98a00e4ab71532cc19dd5a6;hpb=6d46ab9b534b60675a3dcb11fcb664589a3691f8;p=monitor.git diff --git a/nodecommon.py b/nodecommon.py index ba67625..f318949 100644 --- a/nodecommon.py +++ b/nodecommon.py @@ -2,8 +2,9 @@ import struct import reboot import time -import util.file +from monitor import util import plc +from datetime import datetime from monitor import database from unified_model import PersistFlags esc = struct.pack('i', 27) @@ -132,13 +133,16 @@ def nodegroup_display(node, fb, conf=None): node['pcu'] = fb['nodes'][node['hostname']]['values']['pcu'] node['lastupdate'] = diff_time(node['last_contact']) pf = PersistFlags(node['hostname'], 1, db='node_persistflags') - node['lc'] = diff_time(pf.last_changed) + try: + node['lc'] = diff_time(pf.last_changed) + except: + node['lc'] = "err" ut = fb['nodes'][node['hostname']]['values']['comonstats']['uptime'] if ut != "null": ut = diff_time(float(fb['nodes'][node['hostname']]['values']['comonstats']['uptime']), False) node['uptime'] = ut - return "%(hostname)-42s %(boot_state)8s %(current)5s %(pcu)6s %(key)10.10s... %(kernel)33s %(lastupdate)12s, %(lc)s, %(uptime)s" % node + return "%(hostname)-42s %(boot_state)8s %(current)5s %(pcu)6s %(key)10.10s... %(kernel)35.35s %(lastupdate)12s, %(lc)s, %(uptime)s" % node def datetime_fromstr(str): if '-' in str: