Thanks for the explanation Matt but the code the code in the link you provided 
does not work and is probably from older Zenoss versions or something.  The 
events in the database do not contain “ifIndex” nor “ifDescr” fields.  
Anyway ... I did get this working. 

Here's how :
Follow the procedure here to set up the active monitoring of interface states : 
http://www.zenoss.com/Members/cluther/polling-interface-status/ 
Only the Event Class Transform is different :

Code:
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
    if descr == '':
        descr = 'unknown'
#        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 incoming event is about an interface without a description the event 
will be dropped.  If you want to take a different action when such an event 
comes in just uncomment the appropriate line. Although, If there is a 
discription  the interface it will be included in the event summary.

For example if device "rtr-test" with interface "FastEthernet0/1" and  
description "switch01" goes down the event will be transformed 
from this :
device : rtr-test, component : FastEthernet0/1, eventClass : /Net/Link, summary 
: threshold of operational status exceeded : current value 2 ...
to this : 
device : rtr-test, component : FastEthernet0/1, eventClass : /Net/Link, summary 
: Interface FastEthernet0/1 (switch01), changed state to down ...




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

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

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



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

Reply via email to