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

Class BaseZenActions

source code

object --+
         |
        BaseZenActions
Known Subclasses:

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

Instance Methods [hide private]
 
loadActionRules(self)
Load the ActionRules into the system.
source code
 
_getCursor(self, stmt, callback)
Get a cursor for the ZenEventManager connection.
source code
 
execute(self, stmt)
Execute stmt against ZenEventManager connection and return the number of rows that were affected.
source code
 
query(self, stmt)
Execute stmt against ZenEventManager connection and fetch all results.
source code
 
_describe(self, stmt)
Execute stmt against ZenEventManager connection and return the cursor description.
source code
 
_columnNames(self, table)
Returns the column names for the table using a ZenEventManager connection.
source code
 
getBaseUrl(self, device=None) source code
 
getEventUrl(self, evid, device=None) source code
 
getEventsUrl(self, device=None) source code
 
getAckUrl(self, evid, device=None) source code
 
getDeleteUrl(self, evid, device=None) source code
 
getUndeleteUrl(self, evid, device=None) source code
 
processRules(self, zem)
Run through all rules matching them against events.
source code
 
checkVersion(self, zem) source code
 
filterDeviceName(self, zem, whereClause)
This is somewhat janky but we only store the device id in the mysql database but allow people to search based on the device "title".
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
 
fetchMonitorHostname(self, monitor='localhost') 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]

_getCursor(self, stmt, callback)

source code 

Get a cursor for the ZenEventManager connection. Execute statement and call the callback with the cursor and number of row affected.

filterDeviceName(self, zem, whereClause)

source code 

This is somewhat janky but we only store the device id in the mysql database but allow people to search based on the device "title". This method resolves the disparity by searching the catalog first and using those results.

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'"