Justin Simmons
2013-01-09 14:13:39 UTC
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]
"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]