Package ZenEvents :: Module zentrap :: Class ZenTrap
[hide private]
[frames] | no frames]

Class ZenTrap

source code

Products.ZenHub.PBDaemon.PBDaemon --+    
                                    |    
              EventServer.EventServer --+
                                        |
                                       ZenTrap

Listen for SNMP traps and turn them into events Connects to the EventService service in zenhub.

Instance Methods [hide private]
 
__init__(self) source code
string
getEnterpriseString(self, pdu)
Get the enterprise string from the PDU or replayed packet
source code
dictionary
getResult(self, pdu)
Get the values from the PDU or replayed packet
source code
string
getCommunity(self, pdu)
Get the communitry string from the PDU or replayed packet
source code
Python FakePacket object
convertPacketToPython(self, addr, pdu)
Store the raw packet for later examination and troubleshooting.
source code
 
capturePacket(self, addr, pdu)
Store the raw packet for later examination and troubleshooting.
source code
 
replayAll(self)
Replay all captured packets using the files specified in the --replayFilePrefix option and then exit.
source code
 
replay(self, pdu)
Replay a captured packet
source code
 
replayStop(self)
Twisted method that we use to override the default stop() method for when we are replaying packets.
source code
Twisted deferred object
oid2name(self, oid, exactMatch=True, strip=False)
Get OID name from cache or ZenHub
source code
 
receiveTrap(self, pdu)
Accept a packet from the network and spin off a Twisted deferred to handle the packet.
source code
 
processPacket(self, addr, pdu, ts)
Wrapper around asyncHandleTrap to process the provided packet.
source code
Twisted deferred object
asyncHandleTrap(self, addr, pdu, ts)
Twisted callback to process a trap
source code
 
buildOptions(self)
Command-line options to be supported
source code

Inherited from EventServer.EventServer: configure, connected, heartbeat, model, report, reportCycle, sendEvent, useTcpFileDescriptor, useUdpFileDescriptor

Class Variables [hide private]
  name = 'zentrap'
Method Details [hide private]

__init__(self)
(Constructor)

source code 
Overrides: EventServer.EventServer.__init__

getEnterpriseString(self, pdu)

source code 
Get the enterprise string from the PDU or replayed packet
Parameters:
  • pdu (binary) - raw packet
Returns: string
enterprise string

getResult(self, pdu)

source code 
Get the values from the PDU or replayed packet
Parameters:
  • pdu (binary) - raw packet
Returns: dictionary
variables from the PDU or Fake packet

getCommunity(self, pdu)

source code 
Get the communitry string from the PDU or replayed packet
Parameters:
  • pdu (binary) - raw packet
Returns: string
SNMP community

convertPacketToPython(self, addr, pdu)

source code 
Store the raw packet for later examination and troubleshooting.
Parameters:
  • addr ((string, number)) - packet-sending host's IP address and port
  • pdu (binary) - raw packet
Returns: Python FakePacket object
Python FakePacket object

capturePacket(self, addr, pdu)

source code 
Store the raw packet for later examination and troubleshooting.
Parameters:
  • addr ((string, number)) - packet-sending host's IP address and port
  • pdu (binary) - raw packet

replayAll(self)

source code 

Replay all captured packets using the files specified in the --replayFilePrefix option and then exit.

Note that this calls the Twisted stop() method

replay(self, pdu)

source code 
Replay a captured packet
Parameters:
  • pdu (binary) - raw packet

replayStop(self)

source code 
Twisted method that we use to override the default stop() method for when we are replaying packets. This version waits to make sure that all of our deferreds have exited before pulling the plug.

oid2name(self, oid, exactMatch=True, strip=False)

source code 
Get OID name from cache or ZenHub
Parameters:
  • oid (string) - SNMP Object IDentifier
  • exactMatch (boolean) - find the full OID or don't match
  • strip (boolean) - show what matched, or matched + numeric OID remainder
Returns: Twisted deferred object
Twisted deferred object

receiveTrap(self, pdu)

source code 
Accept a packet from the network and spin off a Twisted deferred to handle the packet.
Parameters:
  • pdu (netsnmp_pdu object) - Net-SNMP object

processPacket(self, addr, pdu, ts)

source code 
Wrapper around asyncHandleTrap to process the provided packet.
Parameters:
  • addr (( host-ip, port)) - packet-sending host's IP address, port info
  • pdu (netsnmp_pdu object) - Net-SNMP object
  • ts (datetime) - time stamp

asyncHandleTrap(self, addr, pdu, ts)

source code 
Twisted callback to process a trap
Parameters:
  • addr (( host-ip, port)) - packet-sending host's IP address, port info
  • pdu (netsnmp_pdu object) - Net-SNMP object
  • ts (datetime) - time stamp
Returns: Twisted deferred object
Twisted deferred object

buildOptions(self)

source code 
Command-line options to be supported
Overrides: EventServer.EventServer.buildOptions