summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorIlya Etingof <etingof@gmail.com>2016-04-12 08:30:52 +0200
committerIlya Etingof <etingof@gmail.com>2016-04-12 08:30:52 +0200
commit1341c91ccc8e346064bdffc4a90eec9e952a3f4a (patch)
treea15c095c3939351603d660d1a7c99ea3632a9704 /README.md
parent5581816b426b308efe5d8b9e7c1d03d923acd05f (diff)
downloadpysnmp-git-1341c91ccc8e346064bdffc4a90eec9e952a3f4a.tar.gz
TRAP example added
Diffstat (limited to 'README.md')
-rw-r--r--README.md22
1 files changed, 22 insertions, 0 deletions
diff --git a/README.md b/README.md
index accf1c68..17bb56fb 100644
--- a/README.md
+++ b/README.md
@@ -101,6 +101,28 @@ else:
print(' = '.join([x.prettyPrint() for x in varBind]))
```
+or, to send SNMP TRAP:
+
+```python
+from pysnmp.hlapi import *
+
+errorIndication, errorStatus, errorIndex, varBinds = next(
+ sendNotification(
+ SnmpEngine(OctetString(hexValue='8000000001020304')),
+ UsmUserData('usr-sha-aes128', 'authkey1', 'privkey1',
+ authProtocol=usmHMACSHAAuthProtocol,
+ privProtocol=usmAesCfb128Protocol),
+ UdpTransportTarget(('demo.snmplabs.com', 162)),
+ ContextData(),
+ 'trap',
+ NotificationType(ObjectIdentity('SNMPv2-MIB', 'authenticationFailure'))
+ )
+)
+
+if errorIndication:
+ print(errorIndication)
+```
+
We maintain publicly available SNMP Agent and TRAP sink at
[demo.snmplabs.com](http://snmpsim.sourceforge.net/public-snmp-simulator.html). You are
welcome to play with it while experimenting with your PySNMP scripts.