1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. http://creativecommons.org/licenses/by/4.0
7 **SNMPTRAP** supports the Simple Network Management Protocol (SNMP)
8 standard. It is a well documented and pervasive protocol,
9 used in all networks worldwide.
11 As an API offering, the only way to interact with **SNMPTRAP** is
12 to send traps that conform to the industry standard specification
13 (RFC1215 - available at https://tools.ietf.org/html/rfc1215 ) to a
14 running instance. To accomplish this, you may:
16 1. Configure SNMP agents to send native traps to a SNMPTRAP instance.
17 In SNMP agent configurations, this is usually accomplished by
18 setting the "trap target" or "snmp manager" to the IP address
19 of the running VM/container hosting SNMPTRAP.
21 2. Mimic a SNMP trap using various freely available utilities. Two
22 examples are provided below, be sure to change the target
23 ("localhost") and port ("162") to applicable values in your
31 snmptrap -d -v 1 -c public ${to_ip_address}:${to_portt} .1.3.6.1.4.1.99999 localhost 6 1 '55' .1.11.12.13.14.15 s "test trap"
35 This will display some "read_config_store open failure" errors;
36 they can be ignored, the trap has successfully been sent to the
37 specified destination.
42 .. code-block:: python
44 from pysnmp.hlapi import *
45 from pysnmp import debug
47 # debug.setLogger(debug.Debug('msgproc'))
49 errorIndication, errorStatus, errorIndex, varbinds = next(sendNotification(SnmpEngine(),
50 CommunityData('not_public'),
51 UdpTransportTarget(('localhost', 162)),
54 [ObjectType(ObjectIdentity('.1.3.6.1.4.1.999.1'), OctetString('test trap - ignore')),
55 ObjectType(ObjectIdentity('.1.3.6.1.4.1.999.2'), OctetString('ONAP pytest trap'))])
59 print(errorIndication)
61 print("successfully sent first trap example, number %d" % i)