Discussion:
BGP Transform in Zenoss 4.2
Justin Simmons
2013-01-09 14:13:39 UTC
Permalink
Justin Simmons [http://community.zenoss.org/people/jmsimmons] created the discussion

"BGP Transform in Zenoss 4.2"

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

--------------------------------------------------------------
I'm trying to setup a BGP transform in Zenoss 4.2 for the "cbgpBackwardTransition" and "bgpBackwardTransition" snmp traps. In 3.2, I was using the following trap which I found on http://community.zenoss.org/docs/DOC-5325: http://community.zenoss.org/docs/DOC-5325:

#Required for reverse DNS lookup
from socket import gethostbyaddr

#Translate BGP Peer state to readable format
X = evt.bgpPeerState
if X == 1 :
   evt.TranslatedState = "idle"
elif X == 2 :
   evt.TranslatedState = "connect"
elif X == 3 :
   evt.TranslatedState = "active"
elif X == 4 :
   evt.TranslatedState = "opensent"
elif X == 5 :
   evt.TranslatedState = "openconfirm"
elif X == 6 :
   evt.TranslatedState = "established"
else:
  evt.TranslatedState = evt.bgpPeerState

#Pull out bgp peer IP and attempt a DNS reverse lookup for a name
#Then set message and summary using DNS name if possible, IP if not
for attr in dir(evt):
         if attr.startswith('bgpPeerState.'):
             evt.bgpPeerIp = attr.replace('bgpPeerState.', '')
             try:
                 evt.bgpPeerName = gethostbyaddr(evt.bgpPeerIp)[0]
                 evt.summary = "BGP neighbor change " + evt.bgpPeerName + " (" + evt.bgpPeerIp + ")" + " is: " + evt.TranslatedState
             except Exception, ex:
                 evt.exceptionString = str(ex)
                 evt.summary = "BGP neighbor change " + evt.bgpPeerIp + " is: " + evt.TranslatedState

evt.component = evt.bgpPeerIp

#Auto-clear when state is established
if evt.TranslatedState == "established" :
   evt.severity = 0

Now I receive a Transforming error, saying "Attribute Error:  bgpPeerIp".

I would appreciate hearing from any 4.2 users who have a transform in place for this trap.
--------------------------------------------------------------

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

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Justin Simmons
2013-01-10 14:59:55 UTC
Permalink
Justin Simmons [http://community.zenoss.org/people/jmsimmons] created the discussion

"Re: BGP Transform in Zenoss 4.2"

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

--------------------------------------------------------------
Anyone have a solution or a BGP transform that works in 4.2?
--------------------------------------------------------------

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

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Denis Prusov
2013-09-16 10:54:58 UTC
Permalink
Denis Prusov [http://community.zenoss.org/people/stranger] created the discussion

"Re: BGP Transform in Zenoss 4.2"

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

--------------------------------------------------------------
The solution is:

#Pull out bgp peer IP and attempt a DNS reverse lookup for a name
#Then set message and summary using DNS name if possible, IP if not
for attr in evt.details._map.keys():
    if attr.startswith('bgpPeerState.'):
         evt.bgpPeerIp = attr.replace('bgpPeerState.', '')



Enjoy!
--------------------------------------------------------------

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

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...