Telegraf SNMP complex table query

Hi, I’m using Telegraf 1.16.1 to poll SNMP mib of Raritan Power Delivery Unit. It supports PDU2-MIB and I’m interested to poll following table:

PDU2-MIB::pdu2.configuration.outlets.outletConfigurationTable

I know how telegraf SNMP plugin is defined to poll normal tables. However, in this case Telegraf doesn’t regognize this as a table because it has two indexes. One for PDU (I only have one PDU) and one for outlet.

$ snmpwalk -v 2c -c public pdu.lab.something
1.3.6.1.4.1.13742.6.3.5.3
Bad operator (INTEGER): At line 73 in /usr/share/snmp/mibs/ietf/SNMPv2-PDU
PDU2-MIB::outletLabel.1.1 = STRING: 1
PDU2-MIB::outletLabel.1.2 = STRING: 2
PDU2-MIB::outletLabel.1.3 = STRING: 3
--clip--
PDU2-MIB::outletName.1.1 = STRING:
PDU2-MIB::outletName.1.2 = STRING: sdwan3
PDU2-MIB::outletName.1.3 = STRING:
---

I get following error:
Was that a table? SNMPv2-SMI::enterprises.13742.6.3.5.3: exit status 1

However, snmptable command regognizes table normally and prints headers and content.

ubuntu-user@grafana-vm:~$ snmptable -v 2c -c public pdu.lab.something 1.3.6.1.4.1.13742.6.3.5.3
Bad operator (INTEGER): At line 73 in /usr/share/snmp/mibs/ietf/SNMPv2-PDU
SNMP table: PDU2-MIB::outletConfigurationTable

 outletLabel   outletName    outletReceptacle outletPoleCount outletRatedVoltage outletRatedCurrent outletRatedVA outletDeviceCapabilities  outletPoleCapabilities outletPowerCyclingPowerOffPeriod       outletStateOnStartup outletUseGlobalPowerCyclingPowerOffPeriod outletSwitchable outletReceptacleDescriptor outletNonCritical outletSequenceDelay        outletPowerSource
       1              receptacleIEC320C13               2           200-240V                10A                "9F 04 02 00 00 00 00 " "00 00 00 00 00 00 00 "                               10 globalOutletStateOnStartup                                      true             true              IEC 60320 C13             false                   0 PDU2-MIB::inletLabel.1.1
       2       sdwan3 receptacleIEC320C13               2           200-240V                10A                "9F 04 02 00 00 00 00 " "00 00 00 00 00 00 00 "                               10 globalOutletStateOnStartup                                      true             true              IEC 60320 C13             false                   0 PDU2-MIB::inletLabel.1.1
       3              receptacleIEC320C13               2           200-240V                10A                "9F 04 02 00 00 00 00 " "00 00 00 00 00 00 00 "                               10 globalOutletStateOnStartup                                      true             true              IEC 60320 C13             false                   0 PDU2-MIB::inletLabel.1.1
       4              receptacleIEC320C13               2           200-240V                10A                "9F 04 02 00 00 00 00 " "00 00 00 00 00 00 00 "                               10 globalOutletStateOnStartup                                      true             true              IEC 60320 C13             false                   0 PDU2-MIB::inletLabel.1.1
       5              receptacleIEC320C13               2           200-240V                10A                "9F 04 02 00 00 00 00 " "00 00 00 00 00 00 00 "                               10 globalOutletStateOnStartup                                      true             true              IEC 60320 C13             false                   0 PDU2-MIB::inletLabel.1.1
       6              receptacleIEC320C13               2           200-240V                10A                "9F 04 02 00 00 00 00 " "00 00 00 00 00 00 00 "                               10 globalOutletStateOnStartup                                      true             true              IEC 60320 C13             false                   0 PDU2-MIB::inletLabel.1.1
       7              receptacleIEC320C19               2           200-240V                16A                "9F 04 02 00 00 00 00 " "00 00 00 00 00 00 00 "                               10 globalOutletStateOnStartup                                      true             true              IEC 60320 C19             false                   0 PDU2-MIB::inletLabel.1.1
       8              receptacleIEC320C13               2           200-240V                10A                "9F 04 02 00 00 00 00 " "00 00 00 00 00 00 00 "                               10 globalOutletStateOnStartup                                      true             true              IEC 60320 C13             false                   0 PDU2-MIB::inletLabel.1.1
       9              receptacleIEC320C13               2           200-240V                10A                "9F 04 02 00 00 00 00 " "00 00 00 00 00 00 00 "                               10 globalOutletStateOnStartup                                      true             true              IEC 60320 C13             false                   0 PDU2-MIB::inletLabel.1.1
      10              receptacleIEC320C13               2           200-240V                10A                "9F 04 02 00 00 00 00 " "00 00 00 00 00 00 00 "                               10 globalOutletStateOnStartup                                      true             true              IEC 60320 C13             false                   0 PDU2-MIB::inletLabel.1.1
      11              receptacleIEC320C13               2           200-240V                10A                "9F 04 02 00 00 00 00 " "00 00 00 00 00 00 00 "                               10 globalOutletStateOnStartup                                      true             true              IEC 60320 C13             false                   0 PDU2-MIB::inletLabel.1.1
      12              receptacleIEC320C13               2           200-240V                10A                "9F 04 02 00 00 00 00 " "00 00 00 00 00 00 00 "                               10 globalOutletStateOnStartup                                      true             true              IEC 60320 C13             false                   0 PDU2-MIB::inletLabel.1.1
      13              receptacleIEC320C19               2           200-240V                16A                "9F 04 02 00 00 00 00 " "00 00 00 00 00 00 00 "                               10 globalOutletStateOnStartup                                      true             true              IEC 60320 C19             false                   0 PDU2-MIB::inletLabel.1.1
      14              receptacleIEC320C13               2           200-240V                10A                "9F 04 02 00 00 00 00 " "00 00 00 00 00 00 00 "                               10 globalOutletStateOnStartup                                      true             true              IEC 60320 C13             false                   0 PDU2-MIB::inletLabel.1.1
      15              receptacleIEC320C13               2           200-240V                10A                "9F 04 02 00 00 00 00 " "00 00 00 00 00 00 00 "                               10 globalOutletStateOnStartup                                      true             true              IEC 60320 C13             false                   0 PDU2-MIB::inletLabel.1.1
      16              receptacleIEC320C13               2           200-240V                10A                "9F 04 02 00 00 00 00 " "00 00 00 00 00 00 00 "                               10 globalOutletStateOnStartup                                      true             true              IEC 60320 C13             false                   0 PDU2-MIB::inletLabel.1.1
      17       sdwan5 receptacleIEC320C13               2           200-240V                10A                "9F 04 02 00 00 00 00 " "00 00 00 00 00 00 00 "                               10 globalOutletStateOnStartup                                      true             true              IEC 60320 C13             false                   0 PDU2-MIB::inletLabel.1.1
      18       sdwan4 receptacleIEC320C13               2           200-240V                10A                "9F 04 02 00 00 00 00 " "00 00 00 00 00 00 00 "                               10 globalOutletStateOnStartup                                      true             true              IEC 60320 C13             false                   0 PDU2-MIB::inletLabel.1.1
      19              receptacleIEC320C19               2           200-240V                16A                "9F 04 02 00 00 00 00 " "00 00 00 00 00 00 00 "                               10 globalOutletStateOnStartup                                      true             true              IEC 60320 C19             false                   0 PDU2-MIB::inletLabel.1.1
      20              receptacleIEC320C13               2           200-240V                10A                "9F 04 02 00 00 00 00 " "00 00 00 00 00 00 00 "                               10 globalOutletStateOnStartup                                      true             true              IEC 60320 C13             false                   0 PDU2-MIB::inletLabel.1.1
      21       sdwan1 receptacleIEC320C13               2           200-240V                10A                "9F 04 02 00 00 00 00 " "00 00 00 00 00 00 00 "                               10 globalOutletStateOnStartup                                      true             true              IEC 60320 C13             false                   0 PDU2-MIB::inletLabel.1.1
      22              receptacleIEC320C13               2           200-240V                10A                "9F 04 02 00 00 00 00 " "00 00 00 00 00 00 00 "                               10 globalOutletStateOnStartup                                      true             true              IEC 60320 C13             false                   0 PDU2-MIB::inletLabel.1.1
      23              receptacleIEC320C13               2           200-240V                10A                "9F 04 02 00 00 00 00 " "00 00 00 00 00 00 00 "                               10 globalOutletStateOnStartup                                      true             true              IEC 60320 C13             false                   0 PDU2-MIB::inletLabel.1.1
      24              receptacleIEC320C13               2           200-240V                10A                "9F 04 02 00 00 00 00 " "00 00 00 00 00 00 00 "                               10 globalOutletStateOnStartup                                      true             true              IEC 60320 C13             false                   0 PDU2-MIB::inletLabel.1.1

Does telegraf support tables with two index numbers?

Here is my telegraf config:

[[inputs.snmp.table]]
  name = "outlet"
  inherit_tags = [ "hostname" ]
  oid = "1.3.6.1.4.1.13742.6.3.5.3"
  #oid = "PDU2-MIB::pdu2.configuration.outlets.outletConfigurationTable"

  [[inputs.snmp.table.field]]
    name = "outletLabel"
    oid = "1.3.6.1.4.1.13742.6.3.5.3.1.2"
    is_tag = true

I’m aware that I’m coming 2 years late, anyway perhaps it will help to some other happy owners of Raritan PDUs trying to monitor them using Telegraf.

One possible way how to parse Raritan PDU outlet data is using oid_index_suffix to match the indices.

Not extremely nice, but working.

[[inputs.snmp.table]]
  name = "pduOutlet"

[[inputs.snmp.table.field]]
  oid = 'PDU2-MIB::outletLabel'
  name = 'outletLabel'
  is_tag = true

[[inputs.snmp.table.field]]
  oid = 'PDU2-MIB::outletName'
  name = 'outletName'
  is_tag = true

[[inputs.snmp.table.field]]
  oid = 'PDU2-MIB::measurementsOutletSensorValue'
  name = 'rmsCurrent'
  oid_index_suffix = ".1"

[[inputs.snmp.table.field]]
  oid = 'PDU2-MIB::measurementsOutletSensorValue'
  name = 'rmsVoltage'
  oid_index_suffix = ".4"

[[inputs.snmp.table.field]]
  oid = 'PDU2-MIB::measurementsOutletSensorValue'
  name = 'activePower'
  oid_index_suffix = ".5"

[[inputs.snmp.table.field]]
  oid = 'PDU2-MIB::measurementsOutletSensorValue'
  name = 'apparentPower'
  oid_index_suffix = ".6"

[[inputs.snmp.table.field]]
  oid = 'PDU2-MIB::measurementsOutletSensorValue'
  name = 'powerFactor'
  oid_index_suffix = ".7"

[[inputs.snmp.table.field]]
  oid = 'PDU2-MIB::measurementsOutletSensorValue'
  name = 'activeEnergy'
  oid_index_suffix = ".8"

[[inputs.snmp.table.field]]
  oid = 'PDU2-MIB::measurementsOutletSensorValue'
  name = 'onOff'
  oid_index_suffix = ".7"

[[inputs.snmp.table.field]]
  oid = 'PDU2-MIB::measurementsOutletSensorValue'
  name = 'onOff'
  oid_index_suffix = ".14"

output:

> pduOutlet,outletLabel=5 activeEnergy=127i,activePower=0i,apparentPower=0i,onOff=0i,powerFactor=100i,rmsCurrent=0i,rmsVoltage=230i 1663610442000000000
> pduOutlet,outletLabel=6,outletName=st1_PS1_verified activeEnergy=206781i,activePower=76i,apparentPower=88i,onOff=0i,powerFactor=87i,rmsCurrent=383i,rmsVoltage=230i 1663610442000000000
> pduOutlet,outletLabel=7,outletName=gpu2_psu6 activeEnergy=1543784i,activePower=16i,apparentPower=56i,onOff=0i,powerFactor=29i,rmsCurrent=242i,rmsVoltage=230i 1663610442000000000
> pduOutlet,outletLabel=8,outletName=cpu5 activeEnergy=682629i,activePower=336i,apparentPower=344i,onOff=0i,powerFactor=98i,rmsCurrent=1496i,rmsVoltage=230i 1663610442000000000
> pduOutlet,outletLabel=1,outletName=RAID_PSU0 activeEnergy=466604i,activePower=168i,apparentPower=191i,onOff=0i,powerFactor=88i,rmsCurrent=829i,rmsVoltage=230i 1663610442000000000
> pduOutlet,outletLabel=2 activeEnergy=0i,activePower=0i,apparentPower=0i,onOff=0i,powerFactor=100i,rmsCurrent=0i,rmsVoltage=230i 1663610442000000000
> pduOutlet,outletLabel=3,outletName=gpu2_psu1 activeEnergy=1527085i,activePower=16i,apparentPower=55i,onOff=0i,powerFactor=30i,rmsCurrent=237i,rmsVoltage=230i 1663610442000000000
> pduOutlet,outletLabel=4,outletName=gpu2_psu3 activeEnergy=1409068i,activePower=73i,apparentPower=101i,onOff=0i,powerFactor=72i,rmsCurrent=440i,rmsVoltage=230i 1663610442000000000