X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=policy.py;h=c1f69a51c67afdcf554296661ff56432d3c61456;hb=bf02dca4b0f09d86990a50a4406ab8ecd79cbd5d;hp=43b37cad5a8d1f53e5ef797a2d3db0b027b6c2b4;hpb=6a452e8ece2ca8a47105c128eaebc38507bc76c5;p=monitor.git diff --git a/policy.py b/policy.py index 43b37ca..c1f69a5 100755 --- a/policy.py +++ b/policy.py @@ -33,7 +33,7 @@ api = plc.getAuthAPI() def logic(): - plc.nodeBootState(host, 'rins') + plc.nodeBootState(host, 'reinstall') node_end_record(host) def main(hostnames, sitenames): @@ -67,6 +67,8 @@ def main(hostnames, sitenames): changed_lessthan(nodehist.last_changed, 1.0) and \ found_within(recent_actions, 'down_notice', 7.0) and \ not found_within(recent_actions, 'online_notice', 0.5): + # NOTE: chronicly flapping nodes will not get 'online' notices + # since, they are never up long enough to be 'good'. # NOTE: searching for down_notice proves that the node has # gone through a 'down' state first, rather than just # flapping through: good, offline, online, ... @@ -79,12 +81,12 @@ def main(hostnames, sitenames): # if a node is offline and doesn't have a PCU, remind the user that they should have one. - if not nodehist.haspcu and nodehist.status in ['offline', 'down'] and \ - changed_greaterthan(nodehist.last_changed,1.0) and \ - not found_within(recent_actions, 'pcumissing_notice', 7.0): - - sitehist.sendMessage('pcumissing_notice', hostname=host) - print "send message for host %s pcumissing_notice" % host + #if not nodehist.haspcu and nodehist.status in ['offline', 'down'] and \ + # changed_greaterthan(nodehist.last_changed,1.0) and \ + # not found_within(recent_actions, 'pcumissing_notice', 7.0): + # + # sitehist.sendMessage('pcumissing_notice', hostname=host) + # print "send message for host %s pcumissing_notice" % host # if it is offline and HAS a PCU, then try to use it. if nodehist.haspcu and nodehist.status in ['offline', 'down'] and \ @@ -149,7 +151,7 @@ def main(hostnames, sitenames): # TODO: catch errors sitehist.increasePenalty() - #sitehist.applyPenalty() + sitehist.applyPenalty() sitehist.sendMessage('increase_penalty') print "send message for site %s penalty increase" % site @@ -162,7 +164,7 @@ def main(hostnames, sitenames): # send message that penalties are cleared. sitehist.clearPenalty() - #sitehist.applyPenalty() + sitehist.applyPenalty() sitehist.sendMessage('clear_penalty') sitehist.closeTicket()