summaryrefslogtreecommitdiff
path: root/examples/v1arch
diff options
context:
space:
mode:
authorelie <elie>2015-12-14 07:11:03 +0000
committerelie <elie>2015-12-14 07:11:03 +0000
commitfef6965a411d94256f6995fcc126d8b25ee853dd (patch)
treedf1096570766f60133cd9e4252fb808b0dd3f804 /examples/v1arch
parent1090a68028c88f05bd02b567c5d45e9bd753d9ee (diff)
downloadpysnmp-git-fef6965a411d94256f6995fcc126d8b25ee853dd.tar.gz
more fixes to trap destination
Diffstat (limited to 'examples/v1arch')
-rw-r--r--examples/v1arch/asyncore/agent/ntforg/send-inform-over-ipv4-and-ipv6.py8
-rw-r--r--examples/v1arch/asyncore/agent/ntforg/send-trap-over-ipv4-and-ipv6.py10
2 files changed, 10 insertions, 8 deletions
diff --git a/examples/v1arch/asyncore/agent/ntforg/send-inform-over-ipv4-and-ipv6.py b/examples/v1arch/asyncore/agent/ntforg/send-inform-over-ipv4-and-ipv6.py
index eba3779d..fb1ff489 100644
--- a/examples/v1arch/asyncore/agent/ntforg/send-inform-over-ipv4-and-ipv6.py
+++ b/examples/v1arch/asyncore/agent/ntforg/send-inform-over-ipv4-and-ipv6.py
@@ -8,12 +8,12 @@ The following script sends SNMP INFORM notification using the following options:
* with community name 'public'
* over IPv4/UDP and IPv6/UDP
* send INFORM notification
-* to a Manager at 127.0.0.1:162 and [::1]:162
+* to a Manager at 195.218.195.228:162 and [::1]:162
* with TRAP ID 'coldStart' specified as an OID
The following Net-SNMP command will produce similar SNMP notification:
-| $ snmpinform -v2c -c public udp:127.0.0.1 0 1.3.6.1.6.3.1.1.5.1
+| $ snmpinform -v2c -c public udp:195.218.195.228 0 1.3.6.1.6.3.1.1.5.1
| $ snmpinform -v2c -c public udp6:[::1] 0 1.3.6.1.6.3.1.1.5.1
"""#
@@ -67,8 +67,9 @@ transportDispatcher.registerTransport(
udp.domainName, udp.UdpSocketTransport().openClientMode()
)
transportDispatcher.sendMessage(
- encoder.encode(trapMsg), udp.domainName, ('localhost', 162)
+ encoder.encode(trapMsg), udp.domainName, ('195.218.195.228', 162)
)
+transportDispatcher.jobStarted(1)
# UDP/IPv6
transportDispatcher.registerTransport(
@@ -77,6 +78,7 @@ transportDispatcher.registerTransport(
transportDispatcher.sendMessage(
encoder.encode(trapMsg), udp6.domainName, ('::1', 162)
)
+transportDispatcher.jobStarted(1)
# Dispatcher will finish as all scheduled messages are sent
transportDispatcher.runDispatcher()
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 e0be25a8..a821f86b 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
@@ -9,7 +9,7 @@ following options:
* with community name 'public'
* over IPv4/UDP and IPv6/UDP
* send TRAP notification
-* to a Manager at 127.0.0.1:162 and [::1]
+* to a Manager at 195.218.195.228:162 and [::1]
* with TRAP ID 'coldStart' specified as an OID
* include managed objects information:
* with default Uptime value
@@ -18,7 +18,7 @@ following options:
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 udp:195.218.195.228 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
"""#
@@ -51,10 +51,10 @@ transportDispatcher = AsyncoreDispatcher()
# UDP/IPv4
transportDispatcher.registerTransport(
udp.domainName, udp.UdpSocketTransport().openClientMode()
- )
+)
transportDispatcher.sendMessage(
- encoder.encode(trapMsg), udp.domainName, ('localhost', 162)
- )
+ encoder.encode(trapMsg), udp.domainName, ('195.218.195.228', 162)
+)
# UDP/IPv6
transportDispatcher.registerTransport(