diff options
Diffstat (limited to 'examples/v3arch/asyncio/manager')
6 files changed, 122 insertions, 106 deletions
diff --git a/examples/v3arch/asyncio/manager/cmdgen/get-v2c-custom-timeout.py b/examples/v3arch/asyncio/manager/cmdgen/get-v2c-custom-timeout.py index c2ef8b5..93efaba 100644 --- a/examples/v3arch/asyncio/manager/cmdgen/get-v2c-custom-timeout.py +++ b/examples/v3arch/asyncio/manager/cmdgen/get-v2c-custom-timeout.py @@ -1,20 +1,23 @@ -# -# GET Command Generator -# -# Send a SNMP GET request -# with SNMPv2c, community 'public' -# using Asyncio framework for network transport -# over IPv4/UDP -# to an Agent at 195.218.195.228:161 -# wait 3 seconds for response, retry 5 times (plus one initial attempt) -# for an OID in string form -# -# This script performs similar to the following Net-SNMP command: -# -# $ snmpget -v2c -c public -ObentU -r 5 -t 1 195.218.195.228 1.3.6.1.2.1.1.1.0 -# -# Requires Python 3.4 and later! -# +""" +Fetch scalar value +++++++++++++++++++ + +Send SNMP GET request with the following options: + +* with SNMPv2c, community 'public' +* using Asyncio framework for network transport +* over IPv4/UDP +* to an Agent at 195.218.195.228:161 +* wait 3 seconds for response, retry 5 times (plus one initial attempt) +* for an OID in string form + +This script performs similar to the following Net-SNMP command: + +| $ snmpget -v2c -c public -ObentU -r 5 -t 1 195.218.195.228 1.3.6.1.2.1.1.1.0 + +Requires Python 3.4 and later! + +"""# from pysnmp.carrier.asyncio.dgram import udp from pysnmp.entity.rfc3413.asyncio import cmdgen from pysnmp.entity import engine, config diff --git a/examples/v3arch/asyncio/manager/cmdgen/get-v2c-over-ipv6.py b/examples/v3arch/asyncio/manager/cmdgen/get-v2c-over-ipv6.py index e1b3171..da3a0d0 100644 --- a/examples/v3arch/asyncio/manager/cmdgen/get-v2c-over-ipv6.py +++ b/examples/v3arch/asyncio/manager/cmdgen/get-v2c-over-ipv6.py @@ -1,19 +1,22 @@ -# -# GET Command Generator -# -# Send a SNMP GET request -# with SNMPv2c, community 'public' -# using Asyncio framework for network transport -# over IPv6/UDP -# to an Agent at [::]:161 -# for an OID in string form -# -# This script performs similar to the following Net-SNMP command: -# -# $ snmpget -v2c -c public -ObentU udp6:[::1]:161 1.3.6.1.2.1.1.1.0 -# -# Requires Python 3.4 and later! -# +""" +Fetch scalar value over IPv6 +++++++++++++++++++++++++++++ + +Send SNMP GET request with the following options: + +* with SNMPv2c, community 'public' +* using Asyncio framework for network transport +* over IPv6/UDP +* to an Agent at [::]:161 +* for an OID in string form + +This script performs similar to the following Net-SNMP command: + +| $ snmpget -v2c -c public -ObentU udp6:[::1]:161 1.3.6.1.2.1.1.1.0 + +Requires Python 3.4 and later! + +"""# from pysnmp.carrier.asyncio.dgram import udp6 from pysnmp.entity.rfc3413.asyncio import cmdgen from pysnmp.entity import engine, config diff --git a/examples/v3arch/asyncio/manager/cmdgen/getbulk-v2c.py b/examples/v3arch/asyncio/manager/cmdgen/getbulk-v2c.py index 5cbe619..939c846 100644 --- a/examples/v3arch/asyncio/manager/cmdgen/getbulk-v2c.py +++ b/examples/v3arch/asyncio/manager/cmdgen/getbulk-v2c.py @@ -1,21 +1,24 @@ -# -# GETBULK Command Generator -# -# Send a series of SNMP GETBULK requests -# with SNMPv2c, community 'public' -# using Asyncio framework for network transport -# over IPv4/UDP -# to an Agent at 195.218.195.228:161 -# with values non-repeaters = 0, max-repetitions = 25 -# for two OIDs in string form -# stop on end-of-mib condition for both OIDs -# -# This script performs similar to the following Net-SNMP command: -# -# $ snmpbulkwalk -v2c -c public -C n0 -C r25 -ObentU 195.218.195.228 1.3.6.1.2.1.1 1.3.6.1.4.1.1 -# -# Requires Python 3.4 and later! -# +""" +Bulk walk MIB ++++++++++++++ + +Send a series of SNMP GETBULK requests with the following options: + +* with SNMPv2c, community 'public' +* using Asyncio framework for network transport +* over IPv4/UDP +* to an Agent at 195.218.195.228:161 +* with values non-repeaters = 0, max-repetitions = 25 +* for two OIDs in string form +* stop on end-of-mib condition for both OIDs + +This script performs similar to the following Net-SNMP command: + +| $ snmpbulkwalk -v2c -c public -C n0 -C r25 -ObentU 195.218.195.228 1.3.6.1.2.1.1 1.3.6.1.4.1.1 + +Requires Python 3.4 and later! + +"""# from pysnmp.entity import engine, config from pysnmp.proto import rfc1905 from pysnmp.entity.rfc3413.asyncio import cmdgen diff --git a/examples/v3arch/asyncio/manager/cmdgen/getnext-v2c-from-specific-address.py b/examples/v3arch/asyncio/manager/cmdgen/getnext-v2c-from-specific-address.py index e50eac8..10a97eb 100644 --- a/examples/v3arch/asyncio/manager/cmdgen/getnext-v2c-from-specific-address.py +++ b/examples/v3arch/asyncio/manager/cmdgen/getnext-v2c-from-specific-address.py @@ -1,21 +1,24 @@ -# -# GETNEXT Command Generator -# -# Send a series of SNMP GETNEXT requests -# with SNMPv2c, community 'public' -# using Asyncio framework for network transport -# over IPv4/UDP -# to an Agent at 195.218.195.228:161 -# sending packets from any local interface (0.0.0.0), local port 61024 -# for two OIDs in string form -# stop on end-of-mib condition for both OIDs -# -# This script performs similar to the following Net-SNMP command: -# -# $ snmpwalk -v2c -c public -ObentU 195.218.195.228 1.3.6.1.2.1.1 1.3.6.1.4.1.1 -# -# Requires Python 3.4 and later! -# +""" +Send packets from specific local interface +++++++++++++++++++++++++++++++++++++++++++ + +Send a series of SNMP GETNEXT requests with the following options: + +* with SNMPv2c, community 'public' +* using Asyncio framework for network transport +* over IPv4/UDP +* to an Agent at 195.218.195.228:161 +* sending packets from any local interface (0.0.0.0), local port 61024 +* for two OIDs in string form +* stop on end-of-mib condition for both OIDs + +This script performs similar to the following Net-SNMP command: + +| $ snmpwalk -v2c -c public -ObentU 195.218.195.228 1.3.6.1.2.1.1 1.3.6.1.4.1.1 + +Requires Python 3.4 and later! + +"""# from pysnmp.entity import engine, config from pysnmp.proto import rfc1905 from pysnmp.entity.rfc3413.asyncio import cmdgen diff --git a/examples/v3arch/asyncio/manager/cmdgen/set-v2c.py b/examples/v3arch/asyncio/manager/cmdgen/set-v2c.py index 1e512f2..381f11a 100644 --- a/examples/v3arch/asyncio/manager/cmdgen/set-v2c.py +++ b/examples/v3arch/asyncio/manager/cmdgen/set-v2c.py @@ -1,20 +1,22 @@ -# -# Command Generator -# -# Send SNMP SET request using the following options: -# -# * with SNMPv1, community 'public' -# * using Asyncio framework for network transport -# * over IPv4/UDP -# * to an Agent at 195.218.195.228:161 -# * for OIDs in tuple form and an integer and string-typed values -# -# This script performs similar to the following Net-SNMP command: -# -# $ snmpset -v1 -c private -ObentU 195.218.195.228:161 1.3.6.1.2.1.1.9.1.3.1 s 'my value' 1.3.6.1.2.1.1.9.1.4.1 t 123 -# -# Requires Python 3.4 and later! -# +""" +SET string and integer scalars +++++++++++++++++++++++++++++++ + +Send SNMP SET request using the following options: + +* with SNMPv1, community 'public' +* using Asyncio framework for network transport +* over IPv4/UDP +* to an Agent at 195.218.195.228:161 +* for OIDs in tuple form and an integer and string-typed values + +This script performs similar to the following Net-SNMP command: + +| $ snmpset -v1 -c private -ObentU 195.218.195.228:161 1.3.6.1.2.1.1.9.1.3.1 s 'my value' 1.3.6.1.2.1.1.9.1.4.1 t 123 + +Requires Python 3.4 and later! + +"""# from pysnmp.carrier.asyncio.dgram import udp from pysnmp.entity.rfc3413.asyncio import cmdgen from pysnmp.entity import engine, config diff --git a/examples/v3arch/asyncio/manager/ntfrcv/v2c-multiple-interfaces.py b/examples/v3arch/asyncio/manager/ntfrcv/v2c-multiple-interfaces.py index a5fa241..30dc511 100644 --- a/examples/v3arch/asyncio/manager/ntfrcv/v2c-multiple-interfaces.py +++ b/examples/v3arch/asyncio/manager/ntfrcv/v2c-multiple-interfaces.py @@ -1,23 +1,25 @@ -# -# Notification Receiver -# -# Receive SNMP TRAP/INFORM messages with the following options: -# -# * SNMPv1/SNMPv2c -# * with SNMP community "public" -# * over IPv4/UDP, listening at 127.0.0.1:162 -# over IPv4/UDP, listening at 127.0.0.1:2162 -# * using Asyncio framework for network transport -# * print received data on stdout -# -# Either of the following Net-SNMP's commands will send notifications to this -# receiver: -# -# $ snmptrap -v2c -c public 127.0.0.1:162 123 1.3.6.1.6.3.1.1.5.1 1.3.6.1.2.1.1.5.0 s test -# $ snmpinform -v2c -c public 127.0.0.1:2162 123 1.3.6.1.6.3.1.1.5.1 -# -# Requires Python 3.4 and later! -# +""" +Serving multiple network interfaces ++++++++++++++++++++++++++++++++++++ + +Receive SNMP TRAP/INFORM messages with the following options: + +* SNMPv1/SNMPv2c +* with SNMP community "public" +* over IPv4/UDP, listening at 127.0.0.1:162 + over IPv4/UDP, listening at 127.0.0.1:2162 +* using Asyncio framework for network transport +* print received data on stdout + +Either of the following Net-SNMP commands will send notifications to this +receiver: + +| $ snmptrap -v2c -c public 127.0.0.1:162 123 1.3.6.1.6.3.1.1.5.1 1.3.6.1.2.1.1.5.0 s test +| $ snmpinform -v2c -c public 127.0.0.1:2162 123 1.3.6.1.6.3.1.1.5.1 + +Requires Python 3.4 and later! + +"""# from pysnmp.entity import engine, config from pysnmp.carrier.asyncio.dgram import udp from pysnmp.entity.rfc3413 import ntfrcv |