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

# Class ZenActions

source code

                  object --+
                           |
    ZenUtils.CmdBase.CmdBase --+
                               |
    ZenUtils.ZenDaemon.ZenDaemon --+
                                   |
          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
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
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) basic options setup sub classes can add more options here | source code
sigTerm(self, signum=None, frame=None) controlled shutdown of main loop on interrupt | source code
Inherited from `ZenUtils.ZCmdBase.ZCmdBase`: `closeAll`, `closedb`, `findDevice`, `getConnection`, `getContext`, `getDataRoot`, `getDmdObj`, `login`, `logout`, `opendb`, `syncdb`, `zeoConnect` Inherited from `ZenUtils.ZenDaemon.ZenDaemon`: `becomeDaemon`, `becomeWatchdog`, `changeUser`, `niceDoggie`, `openPrivilegedPort`, `setupLogging`, `sighandler_USR1`, `watchdogCycleTime`, `watchdogMaxRestartTime`, `watchdogStartTimeout`, `writePidFile` Inherited from `ZenUtils.CmdBase.CmdBase`: `buildParser`, `checkLogpath`, `generate_configs`, `generate_xml_configs`, `generate_xml_table`, `getConfigFileDefaults`, `parseOptions`, `pretty_print_config_comment` Inherited from `object`: `__delattr__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__str__`

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`...``
Inherited from `ZenUtils.ZenDaemon.ZenDaemon`: `pidfile` Inherited from `ZenUtils.CmdBase.CmdBase`: `doesLogging`

Properties | [hide private]
Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self) (Constructor) | source code
Overrides: ZenUtils.ZCmdBase.ZCmdBase.__init__

### 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.

### buildOptions(self) | source code
basic options setup sub classes can add more options here Overrides: ZenUtils.ZCmdBase.ZCmdBase.buildOptions (inherited documentation)

### sigTerm(self, signum=None, frame=None) | source code
controlled shutdown of main loop on interrupt Overrides: ZenUtils.ZCmdBase.ZCmdBase.sigTerm

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