For those who need to match only certain descriptions can use this code :

Code:
import re

if evt.summary.startswith('threshold of operational status'):
    fs_id = device.prepId(evt.component)
    for iface in device.os.interfaces():
        if iface.id == fs_id:
           descr = iface.description
    match = re.search('(^switch|^ups|^tcm|^bc|server)', descr, re.I)
    if not match:
#        evt.severity = 2          # set the event severity to Info
#        evt.eventState = 2      # suppress the event
#        evt._action = 'history'  # send the event to history
        evt._action = 'drop'     # drop the event
    if evt.severity > 0:
        evt.summary = 'Interface %s' % (evt.component) + ' (%s' % (descr) + '), 
changed state to down'
    else:
        evt.summary = 'Interface %s' % (evt.component) + ' (%s' % (descr) + '), 
changed state to up'



If the interface description does not meet one of the criteria 
(^switch|^ups|^tcm|^bc|server) it will be dropped. The "re.I" flag makes the 
search case insensitive.  In this example the description needs to start with 
switch, ups, tcm or bc, or contain the word server.




-------------------- m2f --------------------

Read this topic online here:
http://forums.zenoss.com/viewtopic.php?p=33450#33450

-------------------- m2f --------------------



_______________________________________________
zenoss-users mailing list
[email protected]
http://lists.zenoss.org/mailman/listinfo/zenoss-users

Reply via email to