X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=nodebad.py;h=9ba6a32b2e49c49e8cae2ebe005d89817d16b807;hb=32e64e33bc81735e22024c5a44510848bb3c88df;hp=7f512e16656e3a499887240d645b495061fae530;hpb=0a49240ceff10f9da64fd470ed883bb17a11c458;p=monitor.git diff --git a/nodebad.py b/nodebad.py index 7f512e1..9ba6a32 100755 --- a/nodebad.py +++ b/nodebad.py @@ -54,6 +54,8 @@ def check_node_state(rec, node): else: node.haspcu = False + node.firewall = rec.firewall + # NOTE: 'DOWN' and 'DEBUG' are temporary states, so only need # 'translations' into the node.status state @@ -63,10 +65,31 @@ def check_node_state(rec, node): ################################################################# # "Initialize" the findbad states into nodebad status if they are not already set - if node_state == 'DOWN' and ( node.status != 'offline' and node.status != 'down' ) and boot_state != 'disabled' : - print "changed status from %s to offline" % node.status - node.status = 'offline' - node.last_changed = datetime.now() + if node_state == 'DOWN': + if boot_state == 'disabled' and changed_lessthan(node.last_changed, 60) and \ + node.status != 'disabled': + # NOTE: if changed less than 2 months, then we can allow this. + # otherwise, apply 'down' status after greater than 2 months (below). + + print "changed status from %s to %s" % (node.status, boot_state) + node.status = boot_state + node.last_changed = datetime.now() + + if node.status not in ['offline', 'down', 'disabled']: + print "changed status from %s to offline" % node.status + node.status = 'offline' + node.last_changed = datetime.now() + + + #if node_state == 'DOWN' and node.status not in ['offline', 'down', 'disabled']: + # if boot_state != 'disabled': + # print "changed status from %s to offline" % node.status + # node.status = 'offline' + # node.last_changed = datetime.now() + # else: + # print "changed status from %s to %s" % (node.status, boot_state) + # node.status = boot_state + # node.last_changed = datetime.now() if node_state == 'DEBUG' and node.status != 'monitordebug' and \ node.status != 'disabled' and \