For snmp linkUp and linkDown traps, the currently distributed EventClass
Mapping transform is only able to set the component correctly, and therefore
set its status on the device, if the ifDescr is included in the trap.
I have cooked up a solution for mapping ifIndex to component for gear that
doesn't provide an ifDescr (i.e. non-Cisco). This transform seems to work
well. If the attribute for ifDescr does not exist in the trap (or is somehow
the same as ifIndex), it will search the interfaces of the device for a
matching index. If that still isn't found, it'll revert to "the old way" and
mark the component with the index value.
Code:
index = getattr(evt, 'ifIndex', 0)
descr = getattr(evt ,'ifDescr', index)
if descr != index:
evt.component = descr
else:
if device == None:
evt.component = index
else:
found = 0
for obj in device.os.interfaces.objectItems():
if obj[1].ifindex == index:
evt.component = obj[1].id
found = 1
if found == 0:
evt.component = index
It's possible this will puke if the 'device' variable passed to
applyTransform() is something I have failed to account for, such as a list, or
some other evil I don't understand if a trap is received from an unknown IP. I
don't know, I haven't been able to test that extensively.
It'd be nice to have something like this (or even more efficient) included in
2.1.2 or other future update.
-------------------- m2f --------------------
Read this topic online here:
http://community.zenoss.com/forums/viewtopic.php?p=14184#14184
-------------------- m2f --------------------
_______________________________________________
zenoss-users mailing list
[email protected]
http://lists.zenoss.org/mailman/listinfo/zenoss-users