Telegraf SNMP plugin index values into individual tags

Hi,

I’m trying to get QoS metrics out of Cisco devices. Unfortunately, I’m not able to get index data into appropriate tags to process them later.

There is a special vendor MIB module called “CISCO-SWITCH-QOS-MIB” for gathering queueing statistics via “csqIfStatsTable” object (OID 1.3.6.1.4.1.9.9.580.1.5.1.1). This table is made from a sequnce of it’s child objects called “csqIfStatsEntry”. Cisco MIB specifies table entry index as following:

  • ifIndex
  • csqIfStatsDirection
  • csqIfStatsQueueNumber
  • csqIfStatsThresholdNumber

There is another sequence within this entry definition that specifies field values and their format, too:

  • csqIfStatsDirection (IfDirection),
  • csqIfStatsQueueNumber (QosQueueNumber),
  • csqIfStatsThresholdNumber (QosThresholdNumber),
  • csqIfStatsDropPkts (Counter64)

If I fetch some values from the table, I get this result:

  • 1.3.6.1.4.1.9.9.580.1.5.1.1.4.14.2.1.1 csqIfStatsDropPkts COUNTER64 5651

Following the object definitions above I can easily convert this into:

Object ifIndex csqIfStatsDirection csqIfStatsQueueNumber csqIfStatsThresholdNumber Type Value
csqIfStatsDropPkts 14 outbound(2) 1 1 COUNTER64 5651

Or even more simplified version:
ifIndex csqIfStatsDirection csqIfStatsQueueNumber csqIfStatsThresholdNumber csqIfStatsDropPkts
14 outbound(2) 1 1 5651

By using this data I would like to create Influx tags (key:value pairs) from ifIndex, csqIfStatsDirection etc. Similarly I wish to store stats into fields (key:value) from csqIfStatsDropPkts. Unfortunatelly, this is not possible because of index handling in Telegraf SNMP plugin.

All the above mentioned values in my table (except the csqIfStatsDropPkts) are based on OID conversion. I do understand that SNMP protocol is trying to avoid duplicate data (and this is probably why this MIB specifies index objects as NOT-ACCESSIBLE). All csqIfStatsDropPkts entries have index values already encoded within the OID address. No problem here. But it is the protocol. Not me. I need something different: to process this response using those index values as well (like in the table above). So Telegraf should be able to make this tabular index OID conversion for me.

What I can get from Telegraf today is an auto-generated tag called “index”. I just put index_as_tag = true into [[inputs.snmp.table]]. Then I will get this value (following the above example):

  • 14_2_1_1

But there is no way how to access those values separately. [[inputs.snmp.table.field]] doesn’t work, because it is an index (not a leaf). It is a pity. I can image to pair my ifIndex values with data from different tables easily (like ifName, for instance). Now look into Influx DB (or Graphite - whatever) that stores the “index” key only. Suppose I need to draw a graph with stats from all queues with number 1 (independent on the interface id or threshold nuber). This is almost impossible due to the index key (maybe some regex combined with inheriting of variables…ugh).

This is probably due to a misunderstanding of the NOT-ACCESSIBLE “flag” withing MIBs. It does not mean I shold not work with those values at all. It means that the value of this field is already there (in the OID address) - just parse it.

Can you please modify the SNMP plugin so that all index values are easily accessible (one by one) within the [[inputs.snmp.table.field]]? Individual index objects can be referenced by thier OID within MIBs: for instance the 1.3.6.1.4.1.9.9.580.1.5.1.1.1 references csqIfStatsDirection index etc.

Thanks. Petr

Can you open a feature request?

Feature request is opened. Thanks.

I also got this problem. For future reference here is the feature request: Telegraf SNMP plugin index values into individual tags · Issue #3256 · influxdata/telegraf · GitHub