summaryrefslogtreecommitdiff
path: root/examples/v3arch/twisted/agent
diff options
context:
space:
mode:
Diffstat (limited to 'examples/v3arch/twisted/agent')
-rw-r--r--examples/v3arch/twisted/agent/cmdrsp/v1-read-and-write-communities.py36
-rw-r--r--examples/v3arch/twisted/agent/cmdrsp/v2c-custom-scalar-mib-objects.py36
-rw-r--r--examples/v3arch/twisted/agent/cmdrsp/v2c-multiple-interfaces.py36
-rw-r--r--examples/v3arch/twisted/agent/cmdrsp/v3-multiple-users.py43
-rw-r--r--examples/v3arch/twisted/agent/ntforg/inform-v2c.py38
-rw-r--r--examples/v3arch/twisted/agent/ntforg/inform-v3.py34
-rw-r--r--examples/v3arch/twisted/agent/ntforg/trap-v1.py42
-rw-r--r--examples/v3arch/twisted/agent/ntforg/trap-v2c-multiple-targets.py48
-rw-r--r--examples/v3arch/twisted/agent/ntforg/trap-v3.py34
9 files changed, 197 insertions, 150 deletions
diff --git a/examples/v3arch/twisted/agent/cmdrsp/v1-read-and-write-communities.py b/examples/v3arch/twisted/agent/cmdrsp/v1-read-and-write-communities.py
index d346244..da6cc5f 100644
--- a/examples/v3arch/twisted/agent/cmdrsp/v1-read-and-write-communities.py
+++ b/examples/v3arch/twisted/agent/cmdrsp/v1-read-and-write-communities.py
@@ -1,20 +1,22 @@
-#
-# Command Responder
-#
-# Listen and respond to SNMP GET/SET/GETNEXT queries with
-# the following options:
-#
-# * SNMPv1
-# * with SNMP community "public" (read access) or "private" (write access)
-# * allow access to SNMPv2-MIB objects (1.3.6.1.2.1)
-# * over IPv4/UDP, listening at 127.0.0.1:161
-# * using Twisted fraework for network transport
-#
-# The following Net-SNMP's commands will GET/SET a value at this Agent:
-#
-# $ snmpget -v1 -c public 127.0.0.1 SNMPv2-MIB::sysLocation.0
-# $ snmpset -v1 -c private 127.0.0.1 SNMPv2-MIB::sysLocation.0 s "far away"
-#
+"""
+Multiple SNMP communities
++++++++++++++++++++++++++
+
+Listen and respond to SNMP GET/SET/GETNEXT queries with
+the following options:
+
+* SNMPv1
+* with SNMP community "public" (read access) or "private" (write access)
+* allow access to SNMPv2-MIB objects (1.3.6.1.2.1)
+* over IPv4/UDP, listening at 127.0.0.1:161
+* using Twisted fraework for network transport
+
+The following Net-SNMP commands will GET/SET a value at this Agent:
+
+| $ snmpget -v1 -c public 127.0.0.1 SNMPv2-MIB::sysLocation.0
+| $ snmpset -v1 -c private 127.0.0.1 SNMPv2-MIB::sysLocation.0 s "far away"
+
+"""#
from twisted.internet import reactor
from pysnmp.entity import engine, config
from pysnmp.entity.rfc3413 import cmdrsp, context
diff --git a/examples/v3arch/twisted/agent/cmdrsp/v2c-custom-scalar-mib-objects.py b/examples/v3arch/twisted/agent/cmdrsp/v2c-custom-scalar-mib-objects.py
index 091bb75..565419d 100644
--- a/examples/v3arch/twisted/agent/cmdrsp/v2c-custom-scalar-mib-objects.py
+++ b/examples/v3arch/twisted/agent/cmdrsp/v2c-custom-scalar-mib-objects.py
@@ -1,20 +1,22 @@
-#
-# Command Responder
-#
-# Listen and respond to SNMP GET/SET/GETNEXT/GETBULK queries with
-# the following options:
-#
-# * SNMPv2c
-# * with SNMP community "public"
-# * serving custom Managed Object Instance defined within this script
-# * allow read access only to the subtree where the custom MIB object resides
-# * over IPv4/UDP, listening at 127.0.0.1:161
-# * using Twisted fraework for network transport
-#
-# Either of the following Net-SNMP's commands will walk this Agent:
-#
-# $ snmpwalk -v2c -c public 127.0.0.1 .1.3.6
-#
+"""
+Implementing scalar MIB objects
++++++++++++++++++++++++++++++++
+
+Listen and respond to SNMP GET/SET/GETNEXT/GETBULK queries with
+the following options:
+
+* SNMPv2c
+* with SNMP community "public"
+* serving custom Managed Object Instance defined within this script
+* allow read access only to the subtree where the custom MIB object resides
+* over IPv4/UDP, listening at 127.0.0.1:161
+* using Twisted fraework for network transport
+
+Either of the following Net-SNMP commands will walk this Agent:
+
+| $ snmpwalk -v2c -c public 127.0.0.1 .1.3.6
+
+"""#
import sys
from twisted.internet import reactor
from pysnmp.entity import engine, config
diff --git a/examples/v3arch/twisted/agent/cmdrsp/v2c-multiple-interfaces.py b/examples/v3arch/twisted/agent/cmdrsp/v2c-multiple-interfaces.py
index 4f8b29d..a9e3e00 100644
--- a/examples/v3arch/twisted/agent/cmdrsp/v2c-multiple-interfaces.py
+++ b/examples/v3arch/twisted/agent/cmdrsp/v2c-multiple-interfaces.py
@@ -1,20 +1,22 @@
-#
-# Command Responder
-#
-# Listen and respond to SNMP GET/SET/GETNEXT/GETBULK queries with
-# the following options:
-#
-# * SNMPv2c
-# * with SNMP community "public"
-# * allow access to SNMPv2-MIB objects (1.3.6.1.2.1)
-# * over IPv4/UDP, listening at 127.0.0.1:161 and 127.0.0.2:161 interfaces
-# * using Twisted framework for network transport
-#
-# Either of the following Net-SNMP's commands will walk this Agent:
-#
-# $ snmpwalk -v2c -c public 127.0.0.1 .1.3.6
-# $ snmpwalk -v2c -c public 127.0.0.2 .1.3.6
-#
+"""
+Listen on multiple network interfaces
++++++++++++++++++++++++++++++++++++++
+
+Listen and respond to SNMP GET/SET/GETNEXT/GETBULK queries with
+the following options:
+
+* SNMPv2c
+* with SNMP community "public"
+* allow access to SNMPv2-MIB objects (1.3.6.1.2.1)
+* over IPv4/UDP, listening at 127.0.0.1:161 and 127.0.0.2:161 interfaces
+* using Twisted framework for network transport
+
+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 127.0.0.2 .1.3.6
+
+"""#
from twisted.internet import reactor
from pysnmp.entity import engine, config
from pysnmp.entity.rfc3413 import cmdrsp, context
diff --git a/examples/v3arch/twisted/agent/cmdrsp/v3-multiple-users.py b/examples/v3arch/twisted/agent/cmdrsp/v3-multiple-users.py
index 36d9d36..91fd955 100644
--- a/examples/v3arch/twisted/agent/cmdrsp/v3-multiple-users.py
+++ b/examples/v3arch/twisted/agent/cmdrsp/v3-multiple-users.py
@@ -1,23 +1,26 @@
-#
-# Command Responder
-#
-# Listen and respond to SNMP GET/SET/GETNEXT/GETBULK queries with
-# the following options:
-#
-# * SNMPv3
-# * with USM user 'usr-md5-des', auth: MD5, priv DES or
-# with USM user 'usr-sha-none', auth: SHA, no privacy
-# with USM user 'usr-sha-aes128', auth: SHA, priv AES
-# * allow access to SNMPv2-MIB objects (1.3.6.1.2.1)
-# * over IPv4/UDP, listening at 127.0.0.1:161
-# * using Twisted framework for network transport
-#
-# Either of the following Net-SNMP's commands will walk this Agent:
-#
-# $ snmpwalk -v3 -u usr-md5-des -l authPriv -A authkey1 -X privkey1 localhost .1.3.6
-# $ snmpwalk -v3 -u usr-sha-none -l authNoPriv -a SHA -A authkey1 localhost .1.3.6
-# $ snmpwalk -v3 -u usr-sha-aes128 -l authPriv -a SHA -A authkey1 -x AES -X privkey1 localhost .1.3.6
-#
+"""
+Multiple SNMP USM users
++++++++++++++++++++++++
+
+Listen and respond to SNMP GET/SET/GETNEXT/GETBULK queries with
+the following options:
+
+* SNMPv3
+* with USM user:
+ * 'usr-md5-des', auth: MD5, priv DES or
+ * 'usr-sha-none', auth: SHA, no privacy
+ * 'usr-sha-aes128', auth: SHA, priv AES
+* allow access to SNMPv2-MIB objects (1.3.6.1.2.1)
+* over IPv4/UDP, listening at 127.0.0.1:161
+* using Twisted framework for network transport
+
+Either of the following Net-SNMP commands will walk this Agent:
+
+| $ snmpwalk -v3 -u usr-md5-des -l authPriv -A authkey1 -X privkey1 localhost .1.3.6
+| $ snmpwalk -v3 -u usr-sha-none -l authNoPriv -a SHA -A authkey1 localhost .1.3.6
+| $ snmpwalk -v3 -u usr-sha-aes128 -l authPriv -a SHA -A authkey1 -x AES -X privkey1 localhost .1.3.6
+
+"""#
from twisted.internet import reactor
from pysnmp.entity import engine, config
from pysnmp.entity.rfc3413 import cmdrsp, context
diff --git a/examples/v3arch/twisted/agent/ntforg/inform-v2c.py b/examples/v3arch/twisted/agent/ntforg/inform-v2c.py
index 95ba561..77245fe 100644
--- a/examples/v3arch/twisted/agent/ntforg/inform-v2c.py
+++ b/examples/v3arch/twisted/agent/ntforg/inform-v2c.py
@@ -1,19 +1,25 @@
-#
-# Notification Originator
-#
-# Send SNMP INFORM notification using the following options:
-#
-# * SNMPv2c
-# * with community name 'public'
-# * over IPv4/UDP
-# * using Twisted framework for network transport
-# * send INFORM notification
-# * to a Manager at 127.0.0.1:162
-# * with TRAP ID 'coldStart' specified as an OID
-# * include managed objects information:
-# 1.3.6.1.2.1.1.1.0 = 'Example Notificator'
-# 1.3.6.1.2.1.1.5.0 = 'Notificator Example'
-#
+"""
+SNMPv2c INFORM
+++++++++++++++
+
+Send SNMP INFORM notification using the following options:
+
+* SNMPv2c
+* with community name 'public'
+* over IPv4/UDP
+* using Twisted framework for network transport
+* send INFORM notification
+* to a Manager at 127.0.0.1:162
+* with TRAP ID 'coldStart' specified as an OID
+* include managed objects information:
+ * 1.3.6.1.2.1.1.1.0 = 'Example Notificator'
+ * 1.3.6.1.2.1.1.5.0 = 'Notificator Example'
+
+Functionally similar to:
+
+| $ snmpinform -v2c -c public 127.0.0.2 0 1.3.6.1.6.3.1.1.5.1 1.3.6.1.2.1.1.1.0 s 'Example notification' 1.3.6.1.2.1.1.5.0 s 'Notificator Example'
+
+"""#
from twisted.internet import reactor
from pysnmp.entity import engine, config
from pysnmp.carrier.twisted.dgram import udp
diff --git a/examples/v3arch/twisted/agent/ntforg/inform-v3.py b/examples/v3arch/twisted/agent/ntforg/inform-v3.py
index 376da6e..4473326 100644
--- a/examples/v3arch/twisted/agent/ntforg/inform-v3.py
+++ b/examples/v3arch/twisted/agent/ntforg/inform-v3.py
@@ -1,17 +1,23 @@
-#
-# Notification Originator
-#
-# Send SNMP INFORM notification using the following options:
-#
-# * SNMPv3
-# * with user 'usr-md5-none', auth: MD5, priv NONE
-# * over IPv4/UDP
-# * using Twisted framework for network transport
-# * to a Manager at 127.0.0.1:162
-# * send INFORM notification
-# * with TRAP ID 'warmStart' specified as an OID
-# * include managed object information 1.3.6.1.2.1.1.5.0 = 'system name'
-#
+"""
+SNMPv3 INFORM
++++++++++++++
+
+Send SNMP INFORM notification using the following options:
+
+* SNMPv3
+* with user 'usr-md5-none', auth: MD5, priv NONE
+* over IPv4/UDP
+* using Twisted framework for network transport
+* to a Manager at 127.0.0.1:162
+* send INFORM notification
+* with TRAP ID 'warmStart' specified as an OID
+* include managed object information 1.3.6.1.2.1.1.5.0 = 'system name'
+
+Functionally similar to:
+
+| $ snmpinform -v3 -l authPriv -u usr-md5-none -A authkey1 127.0.0.1 0 1.3.6.1.6.3.1.1.5.2 1.3.6.1.2.1.1.5.0 s 'system name'
+
+"""#
from twisted.internet import reactor
from pysnmp.entity import engine, config
from pysnmp.carrier.twisted.dgram import udp
diff --git a/examples/v3arch/twisted/agent/ntforg/trap-v1.py b/examples/v3arch/twisted/agent/ntforg/trap-v1.py
index 6863e0d..587314a 100644
--- a/examples/v3arch/twisted/agent/ntforg/trap-v1.py
+++ b/examples/v3arch/twisted/agent/ntforg/trap-v1.py
@@ -1,21 +1,27 @@
-#
-# Notification Originator
-#
-# Send SNMP notification using the following options:
-#
-# * SNMPv1
-# * with community name 'public'
-# * over IPv4/UDP
-# * using Twisted framework for network transport
-# * to a Manager at 127.0.0.1:162
-# * send TRAP notification
-# * with TRAP ID 'coldStart' specified as an OID
-# * include managed objects information:
-# * overriding Uptime value with 12345
-# * overriding Agent Address with '127.0.0.1'
-# * overriding Enterprise OID with 1.3.6.1.4.1.20408.4.1.1.2
-# * include managed object information '1.3.6.1.2.1.1.1.0' = 'my system'
-#
+"""
+SNMPv1 TRAP
++++++++++++
+
+Send SNMP notification using the following options:
+
+* SNMPv1
+* with community name 'public'
+* over IPv4/UDP
+* using Twisted framework for network transport
+* to a Manager at 127.0.0.1:162
+* send TRAP notification
+* with TRAP ID 'coldStart' specified as an OID
+* include managed objects information:
+* overriding Uptime value with 12345
+* overriding Agent Address with '127.0.0.1'
+* overriding Enterprise OID with 1.3.6.1.4.1.20408.4.1.1.2
+* include managed object information '1.3.6.1.2.1.1.1.0' = 'my system'
+
+Functionally similar to:
+
+| $ snmptrap -v1 -c public 127.0.0.1 1.3.6.1.4.1.20408.4.1.1.2 127.0.0.1 6 432 12345 1.3.6.1.2.1.1.1.0 s 'my system'
+
+"""#
from twisted.internet import reactor
from pysnmp.entity import engine, config
from pysnmp.carrier.twisted.dgram import udp
diff --git a/examples/v3arch/twisted/agent/ntforg/trap-v2c-multiple-targets.py b/examples/v3arch/twisted/agent/ntforg/trap-v2c-multiple-targets.py
index c63dc37..f1e95bf 100644
--- a/examples/v3arch/twisted/agent/ntforg/trap-v2c-multiple-targets.py
+++ b/examples/v3arch/twisted/agent/ntforg/trap-v2c-multiple-targets.py
@@ -1,20 +1,34 @@
-#
-# Notification Originator
-#
-# Send SNMP TRAP notifications to multiple Managers using the
-# following options:
-#
-# * SNMPv2c
-# * with community name 'public'
-# * over IPv4/UDP
-# * using Twisted framework for network transport
-# * send TRAP notification
-# * to multiple Managers at 127.0.0.1:162, 127.0.0.2:162
-# * with TRAP ID 'coldStart' specified as an OID
-# * include managed objects information:
-# 1.3.6.1.2.1.1.1.0 = 'Example Notificator'
-# 1.3.6.1.2.1.1.5.0 = 'Notificator Example'
-#
+"""
+Notification to multiple addresses
+++++++++++++++++++++++++++++++++++
+
+Send SNMP TRAP notifications to multiple Managers using the
+following options:
+
+* SNMPv2c
+* with community name 'public'
+* over IPv4/UDP
+* using Twisted framework for network transport
+* send TRAP notification
+* to multiple Managers at 127.0.0.1:162, 127.0.0.2:162 and 127.0.0.3:162
+* with TRAP ID 'coldStart' specified as an OID
+* include managed objects information:
+ * 1.3.6.1.2.1.1.1.0 = 'Example Notificator'
+ * 1.3.6.1.2.1.1.5.0 = 'Notificator Example'
+
+Functionally similar to:
+
+| $ snmptrap -v2c -c public 127.0.0.1 0 1.3.6.1.6.3.1.1.5.1 1.3.6.1.2.1.1.1.0 s 'Example notification' 1.3.6.1.2.1.1.5.0 s 'Notificator Example'
+
+and
+
+| $ snmptrap -v2c -c public 127.0.0.2 0 1.3.6.1.6.3.1.1.5.1 1.3.6.1.2.1.1.1.0 s 'Example notification' 1.3.6.1.2.1.1.5.0 s 'Notificator Example'
+
+and
+
+| $ snmptrap -v2c -c public 127.0.0.3 0 1.3.6.1.6.3.1.1.5.1 1.3.6.1.2.1.1.1.0 s 'Example notification' 1.3.6.1.2.1.1.5.0 s 'Notificator Example'
+
+"""#
from twisted.internet import reactor
from pysnmp.entity import engine, config
from pysnmp.carrier.twisted.dgram import udp
diff --git a/examples/v3arch/twisted/agent/ntforg/trap-v3.py b/examples/v3arch/twisted/agent/ntforg/trap-v3.py
index c38e474..133f723 100644
--- a/examples/v3arch/twisted/agent/ntforg/trap-v3.py
+++ b/examples/v3arch/twisted/agent/ntforg/trap-v3.py
@@ -1,17 +1,23 @@
-#
-# Notification Originator
-#
-# Send SNMP TRAP notification using the following options:
-#
-# * SNMPv3
-# * with user 'usr-md5-des', auth: MD5, priv DES
-# * over IPv4/UDP
-# * using Twisted framework for network transport
-# * send TRAP notification
-# * to a Manager at 127.0.0.1:162
-# * with TRAP ID 'warmStart' specified as an OID
-# * include managed object information 1.3.6.1.2.1.1.5.0 = 'system name'
-#
+"""
+SNMPv3 TRAP
++++++++++++
+
+Send SNMP TRAP notification using the following options:
+
+* SNMPv3
+* with user 'usr-md5-des', auth: MD5, priv DES
+* over IPv4/UDP
+* using Twisted framework for network transport
+* send TRAP notification
+* to a Manager at 127.0.0.1:162
+* with TRAP ID 'warmStart' specified as an OID
+* include managed object information 1.3.6.1.2.1.1.5.0 = 'system name'
+
+Functionally similar to:
+
+| $ snmptrap -v3 -l authPriv -u usr-md5-des -A authkey1 -X privkey1 -e 8000000001020304 0 1.3.6.1.6.3.1.1.5.1 1.3.6.1.2.1.1.5.0 s 'my system'
+
+"""#
from twisted.internet import reactor
from pysnmp.entity import engine, config
from pysnmp.carrier.twisted.dgram import udp