Thursday, October 27, 2016

SNMP Trap configuration on Ubuntu 12.04 LTS



SNMP Configuration on Ubuntu 12.04 LTS

Requires the NET SNMP packages installed

Configuring a trap receiver and sending an example v1 trap.

=== SNMP Trap Daemon ===
disable access control in /etc/snmp/snmptrapd.conf

disableAuthorization yes

=== SNMP Daemon ===

etc/snmp/snmpd.conf changes

agentAddress udp:161,udp6:[::1]:161

For v3 uncomment the create user lines


 === SNMP v1 Trap test ===

with debug output enabled

 snmptrap -d -v 1 -c public localhost   NET-SNMP-EXAMPLES-MIB::netSnmpExampleNotification "" 6 17 "" netSnmpExampleInteger i 123457

shows packet sent


Sending 66 bytes to UDP: [127.0.0.1]:162->[0.0.0.0]
0000: 30 40 02 01  00 04 06 70  75 62 6C 69  63 A4 33 06    0@.....public.3.
0016: 0A 2B 06 01  04 01 BF 08  02 03 01 40  04 0A A9 68    .+.........@...h
0032: C2 02 01 06  02 01 11 43  04 00 93 B6  94 30 13 30    .......C.....0.0
0048: 11 06 0A 2B  06 01 04 01  BF 08 02 01  01 02 03 01    ...+............
0064: E2 41

=== Trap in syslog ====

# tail -f /var/log/syslog

Oct 27 12:26:18 kspring-HP-Z210-Workstation snmptrapd[5096]: 2016-10-27 12:26:17 kspring-HP-Z210-Workstation.local [10.169.104.194] (via UDP: [127.0.0.1]:57412->[127.0.0.1]) TRAP, SNMP v1, community public#012#011iso.3.6.1.4.1.8072.2.3.1 Enterprise Specific Trap (17) Uptime: 1 day, 2:53:25.32#012#011iso.3.6.1.4.1.8072.2.1.1 = INTEGER: 123457