Archived community.zenoss.org | full text search
Skip navigation
Currently Being Moderated

Two useful zendmd commands on Events Management

VERSION 2  Click to view document history
Created on: Mar 12, 2010 12:53 PM by rhuang - Last Modified:  Mar 12, 2010 1:24 PM by rhuang

1. dmd.ZenEventManager.getEventList()

This command can get a full list of active events objects

 

2.dmd.Events.manage_ackEvents()

This command can acknoledge a event, with the evid provided.

 

An example to utilize these two commands,

++++++++++++++++++++++++++++++++++++++

events = dmd.ZenEventManager.getEventList()

for e in events:

    if e.eventClass == "/Perf/CPU":

        dmd.Events.manage_ackEvents(e.evid)

++++++++++++++++++++++++++++++++++++++

 

This script will search all the active events, if the events is from Class "/Perf/CPU", script will acknowledge the event. If you want to delete them, dmd.Events.manage_deleteEvents() will do the job.

 

3. For a Event object, below properties can be very useful when you want to find cerntain type of events to work with.

 

e.eventClass: the event classs, such as "/Perf/CPU", "/Status/Ping"

                    Code Example:  if e.eventClass == "/Perf/CPU":

 

e.eventState: the event state in number, 0 is active non acknoledged; 1 is acknoledged.

                    Code Example: if e.eventState == 1:

 

e.summary: the description about the events, such as “disk space usage 100%". It is a string type of variable, so you can  apply all the string operation on it. str.split, str.replace.

 

e.device: the device name associate with this event.

             Code Example: if e.device == "wwwsrv1":

 

e.evid: the event evid, whichi s a uniq identifier for a event. Many event operations require the evid as the parameter.

             Code Example: dmd.Events.manage_ackEvents(e.evid)

Comments (1)

More Like This

  • Retrieving data ...