X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=pcubad.py;fp=pcubad.py;h=9f0468cd2545a7112080960c610063053eef9cb0;hb=1aa6b24594dc485d7232649c50e9773956a1492f;hp=16a8f4ffe95b188724c3ea5003a42ca99675669f;hpb=924b7e5c530ecf25d4c5b002fa89ff73ef11f53c;p=monitor.git diff --git a/pcubad.py b/pcubad.py index 16a8f4f..9f0468c 100755 --- a/pcubad.py +++ b/pcubad.py @@ -31,8 +31,8 @@ def main2(config): l_pcus = None if config.site is not None: - site = api.GetSites(config.site) - l_nodes = api.GetNodes(site[0]['node_ids'], ['pcu_ids']) + site = plccache.GetSitesByName([config.site]) + l_nodes = plccache.GetNodesByIds(site[0]['node_ids']) pcus = [] for node in l_nodes: pcus += node['pcu_ids'] @@ -40,7 +40,7 @@ def main2(config): l_pcus = [pcu for pcu in sets.Set(pcus)] elif config.node: - l_nodes = api.GetNodes(config.node, ['pcu_ids']) + l_nodes = plccache.GetNodeByName(config.node) pcus = [] for node in l_nodes: pcus += node['pcu_ids'] @@ -72,7 +72,7 @@ def check_pcu_state(rec, pcu): pcu.status = 'offline' pcu.last_changed = datetime.now() - if ( pcu_state == 0 or pcu_state == "0" ) and changed_lessthan(pcu.last_changed, 0.5) and pcu.status != 'online': + if ( pcu_state == 0 or pcu_state == "0" ) and pcu.status not in [ 'online', 'good' ]: print "changed status from %s to online" % pcu.status pcu.status = 'online' pcu.last_changed = datetime.now()