VMware Cloud Community
brothertertle
Contributor
Contributor
Jump to solution

Parsing SNMP Trap

I have this SNMP Trap I am trying to parse

I can't seem to parse this one OID

Element 11:

=============

oid: 1.3.6.1.4.1.6876.4.5.1.2.9.0

type: String

snmp type: Octet String

value: symptomSet: ced42ef0-c2d2-4f3f-b5a5-c7d05e0b8f16

relation: self

totalObjects: 1

violatingObjects: 1

symptom: Guest file system overall disk space usage reaching immediate limit

active: true

obj.1.name: ACFILES01

obj.1.id: e52951cb-711d-4e8f-8c0c-6bd9e76604b7

obj.1.metric: guestfilesystem|percentage_total

obj.1.info: HT above 90.26897926688159 > 90

symptomSet: 3382b79b-a001-4a1f-af28-7bf1550f1ce8

relation: self

totalObjects: 1

violatingObjects: 1

symptom: Guest file system disk space usage

active: true

obj.1.name: ACFILES01

obj.1.id: e52951cb-711d-4e8f-8c0c-6bd9e76604b7

obj.1.metric: guestfilesystem:G:\|percentage

obj.1.info: HT above 58.29062177498754 > 0

symptom: Guest file system space usage at immediate level

active: true

obj.1.name: ACFILES01

obj.1.id: e52951cb-711d-4e8f-8c0c-6bd9e76604b7

obj.1.metric: guestfilesystem:F:\|percentage

obj.1.info: HT above 90.01059717339952 > 90

symptom: Virtual machine disk space time remaining low

active: true

obj.1.name: ACFILES01

obj.1.id: e52951cb-711d-4e8f-8c0c-6bd9e76604b7

obj.1.metric: diskspace|timeRemaining

obj.1.info: HT below 21 < 60

symptom: Guest file system space usage at critical level

active: true

obj.1.name: ACFILES01

obj.1.id: e52951cb-711d-4e8f-8c0c-6bd9e76604b7

obj.1.metric: guestfilesystem:C:\|percentage

obj.1.info: HT above 95.04038577323296 > 95

symptom: SymptomDefinition-VMWARE-GuestSpaceUsageDTAbove

active: false

obj.1.name: ACFILES01

obj.1.id: e52951cb-711d-4e8f-8c0c-6bd9e76604b7

I have tried this

var snmpResult = SnmpService.retrieveTriggerData(trigger);

var trapData = System.getModule("com.vmware.library.snmp").processSnmpResult(snmpResult);

//trapData = data;

//System.log("Enterprise: " + snmpResult.enterprise);

System.getModule("com.vmware.library.snmp").logResult(trapData);

var MessageOID = "1.3.6.1.4.1.6876.4.5.1.2.9.0";

var wfId = "ee5f566a-8177-4e00-bf4a-edff97a6f313";

// We extract the VM name out of the SNMP TrapData

var SNMPTrap;

for (var x = 0; x < trapData.length; x++) {

var prop = trapData[x];

if (prop.get("oid") == MessageOID) {

SNMPTrap = prop.get("obj.1.metric");

break;

}

}

System.log(SNMPTrap)

ALL I Get is Null but it works on other OIDs

0 Kudos
1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi,

Take a look at scripting code of action com.vmware.library.snmp.processSnmpResult(). It returns Array/Properties, and each element of this array is a Properties object containing 4 elements with keys "oid", "type", "snmpType", and "value".

So when you call prop.get("obj.1.metric"), it will always return null as there is no element with key "obj.1.metric".

View solution in original post

0 Kudos
2 Replies
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi,

Take a look at scripting code of action com.vmware.library.snmp.processSnmpResult(). It returns Array/Properties, and each element of this array is a Properties object containing 4 elements with keys "oid", "type", "snmpType", and "value".

So when you call prop.get("obj.1.metric"), it will always return null as there is no element with key "obj.1.metric".

0 Kudos
brothertertle
Contributor
Contributor
Jump to solution

thanks your awesome

0 Kudos