2010-03-12

Two useful Zendmd commands on Event Management

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)

1 comment:

Manoj Sharma said...

Creating a new event with eventsbot is simple. Just enter your event's name, start date time and select your time zone.
Click "Go to Next Step" button to create your event and edit your event's layout using Event Editor.
Thanks
online event registration