traphandler and SNMPv2c notifications

Mikael Göransson <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
Hey,

I've stumbled upon a problem with traphandler and SNMPv2c notifications. 
The community string is not included when sending traps to a traphandler.

I'm using net-snmp-5.1.2 (from debian sarge stable). I've created a 
simple traphandle that dumps everything in a logfile and i've been 
generating test traps with snmptrap (both version 1 and 2c)

version 1:
--
generating the trap:
snmptrap -v 1 -c public1 172.16.0.1 enterprises.22696 172.16.0.1 3 0 '' 
ifIndex.1 i 1

from the traphandler:
172.16.0.1
172.16.0.1
.1.3.6.1.2.1.1.3.0 2:0:27:44.66
.1.3.6.1.6.3.1.1.4.1.0 .1.3.6.1.6.3.1.1.5.4
.1.3.6.1.2.1.2.2.1.1.1 1
.1.3.6.1.6.3.18.1.3.0 172.16.0.1
.1.3.6.1.6.3.18.1.4.0 "public1"
.1.3.6.1.6.3.1.1.4.3.0 .1.3.6.1.4.1.22696

from syslog:
Oct 27 13:50:35 localhost snmptrapd[20826]:  Received 63 bytes from 
172.16.0.1
Oct 27 13:50:35 localhost snmptrapd[20826]: 0000: 30 3D 02 01  00 04 07 
70  75 62 6C 69  63 31 A4 2F    0=.....public1./
Oct 27 13:50:35 localhost snmptrapd[20826]: 0016: 06 08 2B 06  01 04 01 
81  B1 28 40 04  0A FE 06 0A    ..+......(@.....
Oct 27 13:50:35 localhost snmptrapd[20826]: 0032: 02 01 03 02  01 00 43 
04  01 07 FF 56  30 11 30 0F    ......C....V0.0.
Oct 27 13:50:35 localhost snmptrapd[20826]: 0048: 06 0A 2B 06  01 02 01 
02  02 01 01 01  02 01 01       ..+............
Oct 27 13:50:35 localhost snmptrapd[20826]:
Oct 27 13:50:35 localhost snmptrapd[20826]: 2006-10-27 13:50:35 
172.16.0.1(via 172.16.0.1) TRAP, SNMP v1, community public1     
.1.3.6.1.4.1.22696 Link Up Trap (0) Uptime: 2 days, 0:03:33.34    
.1.3.6.1.2.1.2.2.1.1.1 = INTEGER: 1
--

version 2c:
--
generating the trap.
snmptrap -v2c -cpublic1 172.16.0.1 "" enterprises.22696 ifIndex.1 i 1

from the traphandler:
172.16.0.1
172.16.0.1
.1.3.6.1.2.1.1.3.0 2:0:27:16.65
.1.3.6.1.6.3.1.1.4.1.0 .1.3.6.1.4.1.22696
.1.3.6.1.2.1.2.2.1.1.1 1

from syslog:
Oct 27 15:28:58 localhost snmptrapd[1830]:  Received 89 bytes from 
172.16.0.1
Oct 27 15:28:58 localhost snmptrapd[1830]: 0000: 30 57 02 01  01 04 07 
70  75 62 6C 69  63 31 A7 49    0W.....public1.I
Oct 27 15:28:58 localhost snmptrapd[1830]: 0016: 02 04 53 70  E3 0E 02 
01  00 02 01 00  30 3B 30 10    ..Sp........0;0.
Oct 27 15:28:58 localhost snmptrapd[1830]: 0032: 06 08 2B 06  01 02 01 
01  03 00 43 04  01 11 01 3F    ..+.......C....?
Oct 27 15:28:58 localhost snmptrapd[1830]: 0048: 30 16 06 0A  2B 06 01 
06  03 01 01 04  01 00 06 08    0...+...........
Oct 27 15:28:58 localhost snmptrapd[1830]: 0064: 2B 06 01 04  01 81 B1 
28  30 0F 06 0A  2B 06 01 02    +......(0...+...
Oct 27 15:28:58 localhost snmptrapd[1830]: 0080: 01 02 02 01  01 01 02 
01  01                          .........
Oct 27 15:28:58 localhost snmptrapd[1830]:
Oct 27 15:28:58 localhost snmptrapd[1830]: 2006-10-27 15:28:58 
10.254.6.10 [10.254.6.10]: .1.3.6.1.2.1.1.3.0 = Timeticks: (17891647) 2 
days, 1:41:56.47   .1.3.6.1.6.3.1.1.4.1.0 = OID: .1.3.6.1.4.1.22696  
.1.3.6.1.2.1.2.2.1.1.1 = INTEGER: 1
--

I found the 'format2' configuration option for snmptrapd.conf:
format2 %P %v

it changed the output in syslog:
Oct 27 14:14:18 localhost snmptrapd[22953]:  Received 89 bytes from 
172.16.0.1
Oct 27 14:14:18 localhost snmptrapd[22953]: 0000: 30 57 02 01  01 04 07 
70  75 62 6C 69  63 31 A7 49    0W.....public1.I
Oct 27 14:14:18 localhost snmptrapd[22953]: 0016: 02 04 0C 4C  BB 84 02 
01  00 02 01 00  30 3B 30 10    ...L........0;0.
Oct 27 14:14:18 localhost snmptrapd[22953]: 0032: 06 08 2B 06  01 02 01 
01  03 00 43 04  01 0A 2B 51    ..+.......C...+Q
Oct 27 14:14:18 localhost snmptrapd[22953]: 0048: 30 16 06 0A  2B 06 01 
06  03 01 01 04  01 00 06 08    0...+...........
Oct 27 14:14:18 localhost snmptrapd[22953]: 0064: 2B 06 01 04  01 81 B1 
28  30 0F 06 0A  2B 06 01 02    +......(0...+...
Oct 27 14:14:18 localhost snmptrapd[22953]: 0080: 01 02 02 01  01 01 02 
01  01                          .........
Oct 27 14:14:18 localhost snmptrapd[22953]:
Oct 27 14:14:18 localhost snmptrapd[22953]: TRAP2, SNMP v2c, community 
public1 .1.3.6.1.2.1.1.3.0 = Timeticks: (17443665) 2 days, 
0:27:16.65      .1.3.6.1.6.3.1.1.4.1.0 = OID: .1.3.6.1.4.1.22696  
.1.3.6.1.2.1.2.2.1.1.1 = INTEGER: 1

...but not the input to the traphandler.

i've found other people with similar problems:
http://sourceforge.net/mailarchive/forum.php?thread_id=3610505&forum_id=7152
http://groups.google.se/group/mailing.unix.net-snmp-users/browse_thread/thread/9fad8710a2d5b11d/eae68adcfa59f440?lnk=st&q=net-snmp+snmptrapd+2c+community&rnum=10&hl=sv#eae68adcfa59f440

but no solution to the problem.

any help is appreciated.

cheers.

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
mikael.goransson.vcf (text/x-vcard, 208 B)
begin:vcard
fn;quoted-printable:Mikael G=C3=B6ransson
n;quoted-printable:G=C3=B6ransson;Mikael
email;internet:[email protected]
tel;work:+46 13 20 00 48
x-mozilla-html:FALSE
version:2.1
end:vcard
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.