From 2f24177c361ba4d9deba2d7378f84aa96111db80 Mon Sep 17 00:00:00 2001 From: elie Date: Mon, 14 Sep 2015 05:20:24 +0000 Subject: * 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) --- examples/v3arch/asyncio/agent/ntforg/trap-v1.py | 46 ++++++++++++++----------- 1 file changed, 26 insertions(+), 20 deletions(-) (limited to 'examples/v3arch/asyncio/agent/ntforg/trap-v1.py') diff --git a/examples/v3arch/asyncio/agent/ntforg/trap-v1.py b/examples/v3arch/asyncio/agent/ntforg/trap-v1.py index 5104f90..28f8ba5 100644 --- a/examples/v3arch/asyncio/agent/ntforg/trap-v1.py +++ b/examples/v3arch/asyncio/agent/ntforg/trap-v1.py @@ -1,23 +1,29 @@ -# -# Notification Originator -# -# Send SNMP notification using the following options: -# -# * SNMPv1 -# * with community name 'public' -# * over IPv4/UDP -# * using asyncio network transport (available from Python 3.4) -# * 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' -# -# Requires Python 3.4 and later! -# +""" +SNMP TRAP notification +++++++++++++++++++++++ + +Send SNMP notification using the following options: + +* SNMPv1 +* with community name 'public' +* over IPv4/UDP +* using asyncio network transport (available from Python 3.4) +* 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 demo.snmplabs.com 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' + +Requires Python 3.4 and later! + +"""# from pysnmp.entity import engine, config from pysnmp.entity.rfc3413 import context from pysnmp.entity.rfc3413.asyncio import ntforg -- cgit v1.2.1