Telegraf SNMP complex table query

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