summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorelie <elie>2012-08-30 20:50:42 +0000
committerelie <elie>2012-08-30 20:50:42 +0000
commitc6aa8dce75476de5cdea904d855c0fc78a1d61b6 (patch)
treeeefd82163c502495c0994d0f33cf71f862c5c796 /docs
parent283ac36ebd07a7ed87d36e0223bdbd2b6a69c810 (diff)
downloadpysnmp-c6aa8dce75476de5cdea904d855c0fc78a1d61b6.tar.gz
more updates
Diffstat (limited to 'docs')
-rw-r--r--docs/pysnmp-tutorial.html42
1 files changed, 24 insertions, 18 deletions
diff --git a/docs/pysnmp-tutorial.html b/docs/pysnmp-tutorial.html
index eb47d85..3e54df2 100644
--- a/docs/pysnmp-tutorial.html
+++ b/docs/pysnmp-tutorial.html
@@ -574,7 +574,7 @@ Create a SNMP Command Generator object.
<P>
Although instantiation of this class is cheap, in the course of its further
-use, SNMP engine configuration is built and maintained though methods infocation.
+use, SNMP engine configuration is built and maintained though methods invocation.
Therefore it is advised to keep and reuse CommandGenerator instance (or <STRONG>snmpEngine</STRONG>
instance if passed as an initializer) for as long as possible within user applicatin.
</P>
@@ -1021,7 +1021,7 @@ errorIndication, errorStatus, errorIndex, varBindTable = cmdGen.bulkCmd(
cmdgen.UsmUserData('usr-sha-aes128', 'authkey1', 'privkey1',
authProtocol=cmdgen.usmHMACSHAAuthProtocol,
privProtocol=cmdgen.usmAesCfb128Protocol),
- cmdgen.UdpTransportTarget(('localhost', 161)),
+ cmdgen.Udp6TransportTarget(('::1', 161)),
0, 20,
cmdgen.MibVariable('SNMPv2-MIB', 'system')
)
@@ -1114,26 +1114,32 @@ in <A HREF="#CommandGenerator.getCmd">getCmd</A> method.
</DL>
<P>
-The following code sends SNMP TRAP over SNMPv3:
+The following code sends SNMP TRAP message:
+<UL>
+<LI>using SNMP v2c
+<LI>with community name 'public'
+<LI>over IPv4/UDP
+<LI>send TRAP notification
+<LI>with TRAP ID 'coldStart' specified as a MIB symbol
+<LI>include managed object information specified as a MIB symbol
+</UL>
</P>
-
<TABLE BGCOLOR="lightgray" BORDER=0 WIDTH=90% ALIGN=CENTER><TR><TD>
<PRE>
->>> from pysnmp.entity.rfc3413.oneliner import cmdgen, ntforg
->>> from pysnmp.proto.api import v2c
->>>
->>> ntfOrg = ntforg.NotificationOriginator()
->>> errorIndication = ntfOrg.sendNotification(
-... cmdgen.UsmUserData('my-user', 'my-authkey', 'my-privkey'),
-... cmdgen.UdpTransportTarget(('localhost', 162)),
-... 'trap',
-... cmdgen.MibVariable('SNMPv2-MIB', 'coldStart'),
-... ('1.3.6.1.2.1.1.3.0', v2c.TimeTicks(44100))
+from pysnmp.entity.rfc3413.oneliner import ntforg
+
+ntfOrg = ntforg.NotificationOriginator()
+
+errorIndication = ntfOrg.sendNotification(
+ ntforg.CommunityData('public'),
+ ntforg.UdpTransportTarget(('localhost', 162)),
+ 'trap',
+ ntforg.MibVariable('SNMPv2-MIB', 'coldStart'),
+ (ntforg.MibVariable('SNMPv2-MIB', 'sysName', 0), 'new name')
)
->>> print(errorIndication)
-None
->>> print(errorStatus)
-0
+
+if errorIndication:
+ print('Notification not sent: %s' % errorIndication)
</PRE>
</TD></TR></TABLE>