git://git.onelab.eu
/
monitor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
changes for 3.0
[monitor.git]
/
clean_policy.py
diff --git
a/clean_policy.py
b/clean_policy.py
index
8e35903
..
2dd737b
100644
(file)
--- a/
clean_policy.py
+++ b/
clean_policy.py
@@
-2,7
+2,6
@@
import config
import database
import time
import mailer
import database
import time
import mailer
-from unified_model import cmpCategoryVal
import sys
import emailTxt
import string
import sys
import emailTxt
import string
@@
-93,8
+92,10
@@
class MonitorMergeDiagnoseSendEscellate:
actnode.update(fbnode)
actnode['ticket_id'] = ""
actnode['prev_category'] = "ERROR"
actnode.update(fbnode)
actnode['ticket_id'] = ""
actnode['prev_category'] = "ERROR"
+ actnode['prev_state'] = "DOWN"
else:
actnode['prev_category']= actnode['category']
else:
actnode['prev_category']= actnode['category']
+ actnode['prev_state'] = actnode['state']
actnode['comonstats'] = fbnode['comonstats']
actnode['category'] = fbnode['category']
actnode['state'] = fbnode['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)
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)
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')
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":
# 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:
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!!!!!"
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') ):
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'):
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()
record.takeAction(0)
diag.resetFlag('BackOff')
diag.save()
@@
-241,7
+249,7
@@
class MonitorMergeDiagnoseSendEscellate:
diag.save()
else:
diag.save()
else:
- print "NOT sending email : %s
%s" % (config.mail, record.data['rt'])
+ print "NOT sending email : %s
" % config.mail
return
return