From: Stephen Soltesz Date: Mon, 14 Apr 2008 17:59:45 +0000 (+0000) Subject: Add a field for the currently observed status as well as the PLC db X-Git-Tag: Monitor-1.0-1~2 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=d931e6a9b64a42d0a946c741bf4fbd4b9c9f464b;hp=67057812fa308d41e1c50c5d97ff517a7f50555f;p=monitor.git Add a field for the currently observed status as well as the PLC db configuration. --- diff --git a/nodegroups.py b/nodegroups.py index 92465d0..7ec1dde 100755 --- a/nodegroups.py +++ b/nodegroups.py @@ -20,6 +20,15 @@ api = plc.PLC(auth.auth, auth.plc) from config import config from optparse import OptionParser +import soltesz +fb = soltesz.dbLoad("findbad") + +def get_current_state(fbnode): + state = fbnode['state'] + l = state.lower() + if l == "debug": return 'dbg' + return l + parser = OptionParser() parser.set_defaults(nodegroup="Alpha", node=None, @@ -58,7 +67,11 @@ if config.list: i = 0 for node in nodelist: print "%-2d" % i, - print "%(hostname)-38s %(boot_state)5s %(key)s" % node + if node['hostname'] in fb['nodes']: + node['current'] = get_current_state(fb['nodes'][node['hostname']]['values']) + else: + node['current'] = 'none' + print "%(hostname)-38s %(boot_state)5s %(current)5s %(key)s" % node i += 1 elif config.add: