Package ZenEvents :: Module zenactions :: Class ZenActions
[hide private]
[frames] | no frames]

Class ZenActions

source code

Products.ZenUtils.ZCmdBase.ZCmdBase --+
                                      |
                                     ZenActions

Take actions based on events in the event manager. Start off by sending emails and pages.

Instance Methods [hide private]
 
__init__(self) source code
 
loadActionRules(self)
Load the ActionRules into the system.
source code
 
execute(self, stmt) source code
 
query(self, stmt) source code
 
getUrl(self, evid) source code
 
getEventsUrl(self, device) source code
 
getAckUrl(self, evid) source code
 
getDeleteUrl(self, evid) source code
 
getUndeleteUrl(self, evid) source code
 
processRules(self, zem)
Run through all rules matching them against events.
source code
 
checkVersion(self, zem) source code
 
processEvent(self, zem, context, action) source code
 
maintenance(self, zem)
Run stored procedures that maintain the events database.
source code
 
deleteHistoricalEvents(self, deferred=False, force=False)
Once per day delete events from history table.
source code
 
heartbeatEvents(self)
Create events for failed heartbeats.
source code
 
runEventCommand(self, cmd, data, clear=None) source code
 
eventCommands(self, zem) source code
 
mainbody(self)
main loop to run actions.
source code
 
runCycle(self) source code
 
run(self) source code
 
sendEvent(self, evt)
Send event to the system.
source code
 
sendHeartbeat(self)
Send a heartbeat event for this monitor.
source code
 
stop(self) source code
 
format(self, action, data, clear) source code
 
stripTags(self, data)
A quick html => plaintext converter that retains and displays anchor hrefs
source code
 
sendPage(self, action, data, clear=None)
Send and event to a pager.
source code
 
sendEmail(self, action, data, clear=None)
Send an event to an email address.
source code
 
buildOptions(self) source code
 
sigTerm(self, signum=None, frame=None)
controlled shutdown of main loop on interrupt
source code
Class Variables [hide private]
  lastCommand = None
  addstate = "INSERT INTO alert_state " "VALUES ('%s', '%s', '%s...
  clearstate = "DELETE FROM alert_state " " WHERE evid='%s' " " ...
  newsel = "SELECT %s, evid FROM status WHERE " "%s AND evid NOT...
  clearsel = "SELECT %s, h.evid FROM history h, alert_state a " ...
  clearEventSelect = "SELECT %s " " FROM history clear, history...
Method Details [hide private]

deleteHistoricalEvents(self, deferred=False, force=False)

source code 
Once per day delete events from history table. If force then run the deletion statement regardless of when it was last run (the deletion will still not run if the historyMaxAgeDays setting in the event manager is not greater than zero.) If deferred then we are running in a twisted reactor. Run the deletion script in a non-blocking manner (if it is to be run) and return a deferred (if the deletion script is run.) In all cases return None if the deletion script is not run.

sendPage(self, action, data, clear=None)

source code 
Send and event to a pager. Return True if we think page was sent, False otherwise.

sendEmail(self, action, data, clear=None)

source code 
Send an event to an email address. Return True if we think the email was sent, False otherwise.

Class Variable Details [hide private]

addstate

Value:
"INSERT INTO alert_state " "VALUES ('%s', '%s', '%s', NULL) " "ON DUPL\
ICATE KEY UPDATE lastSent = now()"

clearstate

Value:
"DELETE FROM alert_state " " WHERE evid='%s' " "   AND userid='%s' " "\
   AND rule='%s'"

newsel

Value:
"SELECT %s, evid FROM status WHERE " "%s AND evid NOT IN " " (SELECT e\
vid FROM alert_state " "  WHERE userid='%s' AND rule='%s' %s)"

clearsel

Value:
"SELECT %s, h.evid FROM history h, alert_state a " " WHERE h.evid=a.ev\
id AND a.userid='%s' AND a.rule='%s'"

clearEventSelect

Value:
"SELECT %s " "  FROM history clear, history event " " WHERE clear.evid\
 = event.clearid " "   AND event.evid = '%s'"