Discussion:
Problem with getting Interface Number from Trap after upgrade to 4.2.3
glenpcarter
2013-10-07 15:07:04 UTC
Permalink
glenpcarter [http://community.zenoss.org/people/glenpcarter] created the discussion

"Problem with getting Interface Number from Trap after upgrade to 4.2.3"

To view the discussion, visit: http://community.zenoss.org/message/74861#74861

--------------------------------------------------------------
Hi All

I am having some issues getting my SNMP Traps to give me the Interface number of the switch that is alerting. In Core3 we had this working beautifully using a simple Transform which I have included below.

  0 index = getattr(evt, 'ifIndex', 0)
  1 descr = getattr(evt ,'ifDescr', index)
  2 if descr != index:
  3     evt.component = descr
  4 else:
  5     if device == None:
  6         evt.component = index
  7     else:
  8         found = 0
  9         for obj in device.os.interfaces.objectItems():
10             if obj[1].ifindex == index:
11                 evt.component = obj[1].id
12                 found = 1
13         if found == 0:
14             evt.component = index
15 if evt.component.startswith('Gigabit'):
16     evt.severity = 3
17 if evt.component.startswith('Ethernet'):
18         evt.severity = 3
19 if evt.component.startswith('Cascade'):
20         evt.severity = 4

Now since the upgrade to Core 4 this transform has stopped working and now all I et is the ifIndex value instead of the actual port number. What I do get is the following errors

2013-08-09 15:48:11,864 INFO zen.Events: Transform error <type 'int'> has type <type 'int'>, but expected one of: str, unicode; aborting transaction
2013-08-09 15:48:11,933 WARNING zen.Events: Error processing transform/mapping on Event Class /Net/Link/instances/snmp_linkDown
Problem on line 82: TypeError: <type 'int'> has type <type 'int'>, but expected one of: str, unicode

I'm not really a Python expert and was hoping that someone maybe able to shed some light on this to help me work out where this transform is failing.

Thanks
Glen
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/74861#74861]

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
jcurry
2013-10-09 16:23:42 UTC
Permalink
jcurry [http://community.zenoss.org/people/jcurry] created the discussion

"Re: Problem with getting Interface Number from Trap after upgrade to 4.2.3"

To view the discussion, visit: http://community.zenoss.org/message/74893#74893

--------------------------------------------------------------
I suspect this has stopped working because ALL event fields are now of type string whereas with 3.x and before some were numeric so I suspect the problem is withyour ifIndex.

Try looking at the product-supplied transform for /Net/Link/snmp_linkDown for an example to help fix it.

Cheers,
Jane
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/74893#74893]

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Loading...