On Mar 12, 2008, at 11:49 PM, snarkout wrote:
I have been banging my head against this for over two days, and I assume there *must* be an easy way to do this. I simply want to have notifications include the ifAlias from a cisco device's interface along with it's ifDescr. In other words, I have hundreds of ports on dozens of routers and switches, and "Big_Router Serial2/0/1:0 snmp_LinkDown" isn't anywhere as useful as "Big_Router Serial2/0/1:0 Eddy's Fast Cars is down." While this is mostly an issue because cisco decided that including useful info in their traps wasn't worthwhile, it's also an issue because I cannot find an easy way to do this with Zenoss.

I've looked at scripting this as well as using event transforms and have yet to get what I need. Zenoss obviously already understands that there is an ifAlias tied to each interface - this is the default behavior when modeling - so how can I use getattr or similar to learn this info?

Worst case scenario, is there a way to assign a variable the value of an snmpget via transforms or rules in the even classes? I've tried braindead things like evt.component = `snmpget -vxxx -cxxx ipAddress.ifIndex` and needless to say that didn't work either.

Try using the following (or something like it) in the transform for the linkUp and linkDown event mapping transforms. Zenoss should already know the description of your interfaces. So we'll just look it up.

index = getattr(evt, 'ifIndex', 0)
descr = getattr(evt, 'ifDescr', 'Unknown Interface')

evt.component = descr

if device:
   description = ''
   for iface in device.os.interfaces():
       if index and iface.ifindex == index:
           descr = iface.description
       elif descr and iface.name == descr:
           descr = iface.description

evt.summary = 'Link down on %s' % (descr)

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

Reply via email to