X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=clean_policy.py;h=2dd737bd35c387ee9da494d6e95bba1735aec01e;hb=refs%2Fheads%2F1.0;hp=8e35903e434b5dfb4bc578382c809368c9d90c9c;hpb=6df6b8cf9b9a5e78f4f68445e1b2dabc2ae272e6;p=monitor.git diff --git a/clean_policy.py b/clean_policy.py index 8e35903..2dd737b 100644 --- a/clean_policy.py +++ b/clean_policy.py @@ -2,7 +2,6 @@ import config import database import time import mailer -from unified_model import cmpCategoryVal import sys import emailTxt import string @@ -93,8 +92,10 @@ class MonitorMergeDiagnoseSendEscellate: actnode.update(fbnode) actnode['ticket_id'] = "" actnode['prev_category'] = "ERROR" + actnode['prev_state'] = "DOWN" else: actnode['prev_category']= actnode['category'] + actnode['prev_state'] = actnode['state'] actnode['comonstats'] = fbnode['comonstats'] actnode['category'] = fbnode['category'] actnode['state'] = fbnode['state'] @@ -116,6 +117,10 @@ class MonitorMergeDiagnoseSendEscellate: actnode= self.getActionRecord() actrec = self.mergeRecord(fbnode, actnode) record = Record(self.hostname, actrec) + #print record + #print actrec + #print record.data['time'] + #print time.time() - record.data['time'] diag = self.diagnose(record) if self.act and diag is not None: self.action(record,diag) @@ -138,6 +143,9 @@ class MonitorMergeDiagnoseSendEscellate: if 'resolved' in ticket['Status']: diag.setFlag('RTEndRecord') + # NOTE: try to give a default value to catch the errors for + # planetlab1.ias.csusb.edu which seems to have an out-of-date node config + record.data['message_series'] = emailTxt.mailtxt.newdown # NOTE: take category, and prepare action category = record.getCategory() if category == "error": @@ -198,7 +206,6 @@ class MonitorMergeDiagnoseSendEscellate: print "action: getting message" message = record.getMessage(record.data['ticket_id']) if message: - #message.reset() print "action: sending email" message.send(record.getContacts()) #print "DEBUG NOT SENDING MESSAGE WHEN I SHOULD BE!!!!!" @@ -210,11 +217,12 @@ class MonitorMergeDiagnoseSendEscellate: record.data['ticket_id'] = message.rt.ticket_id if ( record.data['takeaction'] and diag.getFlag('Squeeze') ): - print "action: taking action" + print "action: taking squeeze action" record.takeAction(record.data['action-level']) diag.resetFlag('Squeeze') diag.save() if diag.getFlag('BackOff'): + print "action: taking backoff action" record.takeAction(0) diag.resetFlag('BackOff') diag.save() @@ -241,7 +249,7 @@ class MonitorMergeDiagnoseSendEscellate: diag.save() else: - print "NOT sending email : %s %s" % (config.mail, record.data['rt']) + print "NOT sending email : %s" % config.mail return