Skip to main content

SNMP Parser

This parser requires the Oracle JDK (see System requirements).

After configuring one or more remote hosts to collect and transmit system information as detailed in SNMP configuration, create a UDPReader and select this parser to use the data in an application.

SNMP Parser property

This parser's single property is alias (string), which can be used to specify a file containing human-readable aliases for SNMP OIDs. For example:

1.3.6.1.4.1.2021.10.1.5.2=laLoadInt.2
1.3.6.1.2.1.88.2.1.4=mteHotOID
1.3.6.1.4.1.2021.10.1.100.1=laErrorFlag.1
1.3.6.1.4.1.2021.10.1.100.2=laErrorFlag.2
1.3.6.1.2.1.1.5=sysName
1.3.6.1.2.1.88.2.1.1=mteHotTrigger
1.3.6.1.4.1.2021.10.1.100.3=laErrorFlag.3
1.3.6.1.4.1.2021.10.1.5.1=laLoadInt.1
1.3.6.1.4.1.2021.10.1.5.3=laLoadInt.3
1.3.6.1.4.1.311.1.13.1.9999.25.0=HOST
1.3.6.1.4.1.311.1.13.1.9999.12.0=MACHINENAME
1.3.6.1.4.1.311.1.13.1.9999.11.0=USERID
1.3.6.1.4.1.311.1.13.1.9999.5.0=EVENTCODE
1.3.6.1.4.1.311.1.13.1.9999.15.0=STATUS
1.3.6.1.4.1.311.1.13.1.9999.13.0=SUBSTATUS
1.3.6.1.2.1.88.2.1.2.0=mteHotTargetName.0
1.3.6.1.2.1.88.2.1.3.0=mteHotContextName.0
1.3.6.1.2.1.88.2.1.5.0=mteHotValue.0 
1.3.6.1.2.1.25.1.2=hrSystemDate
1.3.6.1.2.1.2.2.1.5=ifSpeed
1.3.6.1.2.1.31.1.1.1.15=ifHighSpeed
1.3.6.1.2.1.2.2.1.6=ifPhysAddress
1.3.6.1.2.1.2.2.1.10=ifInOctets 
1.3.6.1.2.1.2.2.1.11=ifInUcastPkts 
1.3.6.1.2.1.2.2.1.16=ifOutOctets
1.3.6.1.2.1.2.2.1.17=ifOutUcastPkts 
1.3.6.1.2.1.2.2.1.19=ifOutDiscards 
1.3.6.1.2.1.2.2.1.20=ifOutErrors 
1.3.6.1.2.1.2.2.1.8=ifOperStatus
1.3.6.1.2.1.2.2.1.6=ifPhysAddress
1.3.6.1.2.1.1.3=sysUpTime

SNMP example

This sample application listens for the data sent using the sample settings from SNMP configuration.

CREATE APPLICATION snmpnt;
CREATE SOURCE SNMPSource USING UDPReader (
  ipaddress:'0.0.0.0',
  PortNo:'15021'
)
PARSE USING SNMPParser (
  alias: 'Samples/snmpalias.txt'
)
OUTPUT TO SNMPStream;

CREATE TYPE networkType(
  mteHotTrigger String,
  mteHotValue Integer, 
  mteHotOID String,
  Sysname String,
  MacAddr String,
  Uptime Integer,
  ifSpeed2 Integer, 
  ifHighSpeed Integer,
  ifInOctets2 Integer, 
  ifInUcastPkts Integer, 
  ifOutOctets2 Integer, 
  ifOutUcastPkts2 Integer,
  ifOutDiscards2 Integer,
  ifOutOfErrors2 Integer,
  ifOperStatus2 Integer);
CREATE STREAM NetworkStream OF networkType;
CREATE CQ ntcq
INSERT INTO NetworkStream
SELECT
  TO_STRING(VALUE(x,'mteHotTrigger')),
  TO_INT(VALUE(x,'mteHotValue')),
  TO_STRING(VALUE(x,'mteHotOID')),
  TO_STRING(VALUE(x,'sysName')),
  TO_MACID(VALUE(x, 'ifPhysAddress'),'-'),
  TO_INT(VALUE(x, 'sysUpTime')),
  TO_INT(VALUE(x,'ifSpeed')), 
  TO_INT(VALUE(x,'ifHighSpeed')), 
  TO_INT(VALUE(x,'ifInOctets')), 
  TO_INT(VALUE(x,'ifInUcastPkts')), 
  TO_INT(VALUE(x,'ifOutOctets')),
  TO_INT(VALUE(x,'ifOutUcastPkts')), 
  TO_INT(VALUE(x,'ifOutDiscards')), 
  TO_INT(VALUE(x,'ifOutErrors')), 
  TO_INT(VALUE(x,'ifOperStatus'))
FROM SNMPStream x;

CREATE TARGET SnmpNetWorkInterface
USING SysOut(name:SNMPNT)
INPUT FROM NetworkStream;

END APPLICATION snmpnt;

The output looks like this:

SNMPNT: networkType_1_0{
  mteHotTrigger: "Interface Details"
  mteHotValue: null
  mteHotOID: "1.3.6.1.2.1.2.2.1.16.2"
  Sysname: "centos57"
  MacAddr: "08-00-27-AE-36-99"
  Uptime: 18006
  ifSpeed2: 1000000000
  ifHighSpeed: 1000
  ifInOctets2: 613514937
  ifInUcastPkts: 658628
  ifOutOctets2: 35572407
  ifOutUcastPkts2: 272710
  ifOutDiscards2: 0
  ifOutOfErrors2: 0
  ifOperStatus2: 1
};