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

# Class ZenTrap

source code

                     object --+
                              |
       ZenUtils.CmdBase.CmdBase --+
                                  |
       ZenUtils.ZenDaemon.ZenDaemon --+
                                      |
    twisted.spread.pb.Referenceable --+
                                      |
               ZenHub.PBDaemon.PBDaemon --+
                                          |
                    EventServer.EventServer --+
                                              |
                                 object --+   |
                                          |   |
       ZenUtils.captureReplay.CaptureReplay --+
                                              |
                                             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
replay(self, pdu) Replay a captured packet | 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` Inherited from `ZenHub.PBDaemon.PBDaemon`: `connect`, `connectTimeout`, `eventService`, `getInitialServices`, `getService`, `getServiceNow`, `gotPerspective`, `pushEvents`, `pushEventsLoop`, `remote_getName`, `remote_setPropertyItems`, `remote_shutdown`, `remote_updateThresholdClasses`, `run`, `sendEvents`, `setExitCode`, `sigTerm`, `stop` Inherited from `ZenUtils.ZenDaemon.ZenDaemon`: `becomeDaemon`, `becomeWatchdog`, `changeUser`, `niceDoggie`, `openPrivilegedPort`, `setupLogging`, `sighandler_USR1`, `watchdogCycleTime`, `watchdogMaxRestartTime`, `watchdogStartTimeout`, `writePidFile` Inherited from `ZenUtils.CmdBase.CmdBase`: `buildParser`, `checkLogpath`, `generate_configs`, `generate_xml_configs`, `generate_xml_table`, `getConfigFileDefaults`, `parseOptions`, `pretty_print_config_comment` Inherited from `ZenUtils.captureReplay.CaptureReplay`: `buildCaptureReplayOptions`, `capturePacket`, `processCaptureReplayOptions`, `replayAll`, `replayStop` Inherited from `object`: `__delattr__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__str__`

Class Variables | [hide private]
| name = `'zentrap'`
Inherited from `ZenHub.PBDaemon.PBDaemon`: `heartbeatEvent`, `heartbeatTimeout`, `initialServices` Inherited from `ZenHub.PBDaemon.PBDaemon` (private): `_customexitcode`, `_sendingEvents` Inherited from `ZenUtils.ZenDaemon.ZenDaemon`: `pidfile` Inherited from `ZenUtils.CmdBase.CmdBase`: `doesLogging`

Properties | [hide private]
Inherited from `object`: `__class__`

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 Overrides: ZenUtils.captureReplay.CaptureReplay.convertPacketToPython

### replay(self, pdu) | source code
Replay a captured packet Parameters: `pdu` (binary) - raw packet Overrides: ZenUtils.captureReplay.CaptureReplay.replay

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