bug in output passed to scripts via snmptrapd?

Chris Bartram <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
I have a script receiving output from snmptrapd; it does a simple read <STDIN> and breaks each line into an oid/value pair. To aid in debugging I'm logging all the oid/value pairs the script gets to a log file.

It appears that for some VMWare SNMP traps - one (STRING) field of which happens to be full of "token:" type strings - the parser is breaking this single field down into multiple input lines - apparently getting confused by the embedded tokens: in the line? It obviously wreaks havoc on the script. Below is a sample of one of the traps. Running:

RHEL: Linux hostname 2.6.18-194.17.1.el5 #1 SMP Mon Sep 20 07:12:06 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux

NET-SNMP Version:  5.3.2.2

First the data as logged by /var/log/messages:

Aug 10 13:00:23 snmp-server snmptrapd[11148]: 2011-08-10 13:00:23 nwg-vmmgmt-001.ad.xyz.org [192.1.1.13] (via UDP: [192.1.1.13]:62242) TRAP, SNMP v1, community public        VMWARE-PRODUCTS-MIB::vmwVC Enterprise Specific Trap (VMWARE-VC-EVENT-MIB::vpxdAlarmInfo) Uptime: 15 days, 14:12:14.73  
VMWARE-VC-EVENT-MIB::vmwVpxdTargetObjType.0 = INTEGER: other(4)
VMWARE-VC-EVENT-MIB::vmwVpxdOldStatus.0 = STRING: Gray 
VMWARE-VC-EVENT-MIB::vmwVpxdNewStatus.0 = STRING: Red  
VMWARE-VC-EVENT-MIB::vmwVpxdObjValue.0 = STRING: [Custom] Cluster - HA Alarms - Event: HA host isolated (47037960) Summary: Host hpblade41-3.devl.xyz.org has been isolated from cluster HP7KDEV in DATACENTER1 Date: 8/10/2011 4:58:53 PM Resource pool: HP7KDEV Data center: DATACENTER1 Arguments:     isolatedHost.name = hpblade41-3.devl.xyz.org  OR Event: HA host isolated (47037960) Summary: Host hpblade41-3.devl.xyz.org has been isolated from cluster HP7KDEV in DATACENTER1 Date: 8/10/2011 4:58:53 PM Resource pool: HP7KDEV Data cent


Now what my scripts is passed. The leading numbers on each lines are counters of the input lines the script reads:

1: oid:DISMAN-EVENT-MIB::sysUpTimeInstance
1: value:15:14:12:14.73
2: oid:SNMPv2-MIB::snmpTrapOID.0
2: value:VMWARE-VC-EVENT-MIB::vpxdAlarmInfo
3: oid:VMWARE-VC-EVENT-MIB::vmwVpxdTargetObjType.0
3: value:other
4: oid:VMWARE-VC-EVENT-MIB::vmwVpxdOldStatus.0
4: value:Gray
5: oid:VMWARE-VC-EVENT-MIB::vmwVpxdNewStatus.0
5: value:Red
6: oid:VMWARE-VC-EVENT-MIB::vmwVpxdObjValue.0
6: value:[Custom] Cluster - HA Alarms - Event: HA host isolated (47037960)
7: oid:Summary:
7: value:Host hpblade41-3.devl.xyz.org has been isolated from cluster HP7KDEV in DATACENTER1
8: oid:Date:
8: value:8/10/2011 4:58:53 PM
9: oid:Resource
9: value:pool: HP7KDEV
10: oid:Data
10: value:center: DATACENTER1
11: oid:Arguments:
11: value:
12: oid:isolatedHost.name
12: value:= hpblade41-3.devl.xyz.org
13: oid:OR
13: value:Event: HA host isolated (47037960)
14: oid:Summary:
14: value:Host hpblade41-3.devl.xyz.org has been isolated from cluster HP7KDEV in DATACENTER1
15: oid:Date:
15: value:8/10/2011 4:58:53 PM
16: oid:Resource
16: value:pool: HP7KDEV
17: oid:Data
17: value:center: DATACENTER1
18: oid:Arguments:
18: value:
19: oid:isolatedHost.name
19: value:= hpblade41-3.devl.xyz.org
20: oid:OR
20: value:Event: HA host isolated (47037960)
21: oid:Summary:
21: value:Host hpblade41-3.devl.xyz.org has been isolated from cluster HP7KDEV in DATACENTER1
22: oid:Date:
22: value:8/10/2011 4:58:53 PM
23: oid:Resource
23: value:pool: HP7KDEV
24: oid:Data
24: value:center: DATACENTER1
25: oid:Arguments:
25: value:
26: oid:isolatedHost.name
26: value:= hpblade41-3.devl.xyz.org
27: oid:
27: value:
28: oid:VMWARE-VC-EVENT-MIB::vmwVpxdTargetObj.0
28: value:HP7KDEV
29: oid:SNMP-COMMUNITY-MIB::snmpTrapAddress.0
29: value:192.1.1.13
30: oid:SNMP-COMMUNITY-MIB::snmpTrapCommunity.0
30: value:public
31: oid:SNMPv2-MIB::snmpTrapEnterprise.0
31: value:VMWARE-PRODUCTS-MIB::vmwVC

Is it a known issue? 


Thanks in advance;
 -Chris Bartram

 

"The purpose of life is not to be happy. It is to be useful, to be honorable, to be compassionate, to have it make some difference that you have lived and lived well". (Ralph Waldo Emerson)

------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. 
http://p.sf.net/sfu/wandisco-dev2dev

_______________________________________________
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
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.