sum = str(evt.summary)
if getattr(evt, 'severity', 0) > 0 \
and getattr(evt, 'eventClass', '/Unknown') != '/Status/Ping' \
and device and device.getPingStatus() > 0:
evt._action = "drop"
if (sum.find("Command timed out")>=0) \
or (sum.find("Socket timeout")>=0) \
or (sum.find("Unable to read")>=0) \
or (sum.find("Process not running")>=0) \
or (sum.find("SNMP agent down")>=0) \
or (sum.find("No response from")>=0):
if device.getPingStatus() <= 0:
time.sleep(8)
if device.getPingStatus() > 0:
evt._action = "drop"
else:
evt._action = "drop"
if getattr(evt, 'prodState', 99)<400:
evt._action = "drop"
Wednesday, 11 August 2010
[zenoss] employ ping down dependency to suppress other events
Labels:
monitoring,
python,
zendmd,
zenoss
Subscribe to:
Post Comments (Atom)
Great post. Using Zenoss 3.2, how do I use this? Where do I put it?
ReplyDeleteMatt, you put that code in the transform for all events at /Events
ReplyDeleteWhere specifically should i place this code? Create New Event Class Mapping?
ReplyDeleteYour else statement is indented incorrectly. With the way you have it, if it sees the device up initially it's always going to drop it. The else should be part of the first if, not the second if. That way, if it immediately sees it down, it drops it, but if it sees it up it waits the 8 seconds, then if it sees it down it drops it otherwise it doesn't. Move the else statement out by 1 level.
ReplyDeleteYou are very right Ryan, that's how i actually set it up, but I guess this was a formatting error when I published this blog entry. I hope people who used it had noticed that. I have since corrected the entry.
Deletemany thanks
Last comment was by me.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteFor 3.x Zenoss, click on Events, Event Classes and then the BOTTOM LEFT there is a little gear. Click that and Transform.
ReplyDeleteThanks for the code. I have an MPLS network with about 5 routers, any way to get suppress the events from the devices behind them when they go down?
I just tried this on the new Zenoss 4.2 and it no longer works. :( Errors out.
ReplyDeleteProblem with line 19: if getattr(evt, 'prodState', 99)<400:
Thank yoou for being you
ReplyDelete