diff options
author | elie <elie> | 2015-09-14 05:20:24 +0000 |
---|---|---|
committer | elie <elie> | 2015-09-14 05:20:24 +0000 |
commit | ddc989155d58641cf32e6a1ef8a400f22f5d167c (patch) | |
tree | 9df696918f07781d60cca7a8cc3ff8a6378b638f /examples/v1arch/asyncore/agent | |
parent | 6596cb464810233b3b16973665f2a4fe27ddd1db (diff) | |
download | pysnmp-git-ddc989155d58641cf32e6a1ef8a400f22f5d167c.tar.gz |
* synchronous oneliner apps redesigned to offer Python generator-based
API along with a more comprehensive set of accepted parameters.
* massively documented (in Sphinx, NumPy style)
Diffstat (limited to 'examples/v1arch/asyncore/agent')
-rw-r--r-- | examples/v1arch/asyncore/agent/cmdrsp/implementing-scalar-mib-objects.py | 22 | ||||
-rw-r--r-- | examples/v1arch/asyncore/agent/ntforg/send-trap-over-ipv4-and-ipv6.py | 25 |
2 files changed, 45 insertions, 2 deletions
diff --git a/examples/v1arch/asyncore/agent/cmdrsp/implementing-scalar-mib-objects.py b/examples/v1arch/asyncore/agent/cmdrsp/implementing-scalar-mib-objects.py index 1007a475..5119a159 100644 --- a/examples/v1arch/asyncore/agent/cmdrsp/implementing-scalar-mib-objects.py +++ b/examples/v1arch/asyncore/agent/cmdrsp/implementing-scalar-mib-objects.py @@ -1,4 +1,24 @@ -# Command Responder Application (GET/GETNEXT) +""" +Implementing scalar MIB objects ++++++++++++++++++++++++++++++++ + +Listen and respond to SNMP GET/GETNEXT queries with the following options: + +* SNMPv1 or SNMPv2c +* with SNMP community "public" +* over IPv4/UDP, listening at 127.0.0.1:161 +* over IPv6/UDP, listening at [::1]:161 +* serving two Managed Objects Instances (sysDescr.0 and sysUptime.0) + +Either of the following Net-SNMP commands will walk this Agent: + +| $ snmpwalk -v2c -c public 127.0.0.1 .1.3.6 +| $ snmpwalk -v2c -c public udp6:[::1] .1.3.6 + +The Command Receiver below uses two distinct transports for communication +with Command Generators - UDP over IPv4 and UDP over IPv6. + +"""# from pysnmp.carrier.asyncore.dispatch import AsyncoreDispatcher from pysnmp.carrier.asyncore.dgram import udp, udp6, unix from pyasn1.codec.ber import encoder, decoder diff --git a/examples/v1arch/asyncore/agent/ntforg/send-trap-over-ipv4-and-ipv6.py b/examples/v1arch/asyncore/agent/ntforg/send-trap-over-ipv4-and-ipv6.py index 66c8a53f..e0be25a8 100644 --- a/examples/v1arch/asyncore/agent/ntforg/send-trap-over-ipv4-and-ipv6.py +++ b/examples/v1arch/asyncore/agent/ntforg/send-trap-over-ipv4-and-ipv6.py @@ -1,4 +1,27 @@ -# Notification Originator Application (TRAP) +""" +TRAP over multiple transports ++++++++++++++++++++++++++++++ + +The following script sends two SNMP TRAP notification using the +following options: + +* with SNMPv1 +* with community name 'public' +* over IPv4/UDP and IPv6/UDP +* send TRAP notification +* to a Manager at 127.0.0.1:162 and [::1] +* with TRAP ID 'coldStart' specified as an OID +* include managed objects information: +* with default Uptime value +* with default Agent Address with '127.0.0.1' +* overriding Enterprise OID with 1.3.6.1.4.1.20408.4.1.1.2 + +The following Net-SNMP commands will produce similar SNMP notification: + +| $ snmptrap -v1 -c public udp:127.0.0.1 1.3.6.1.4.1.20408.4.1.1.2 127.0.0.1 1 0 12345 +| $ snmptrap -v1 -c public udp6:[::1] 1.3.6.1.4.1.20408.4.1.1.2 127.0.0.1 1 0 12345 + +"""# from pysnmp.carrier.asyncore.dispatch import AsyncoreDispatcher from pysnmp.carrier.asyncore.dgram import udp, udp6, unix from pyasn1.codec.ber import encoder |