Telegraf SNMP plugin: Gathering tags from multiple SNMP tables

I’m trying to collect CPU busy percentage measurements from a Cisco IOS XR network device via SNMP. In order to achieve this, data needs to be merged from two SNMP tables.
The measurent values are located in cpmCPUTotalTable which is part of CISCO-PROCESS-MIB. The table itself does not contain any useful information about the CPU entity to which the value belongs. However, the column cpmCPUTotalPhysicalIndex references the corresponding index from entPhysicalTable which would be needed to retrieve additional tags.
Is there any way how I could fetch data from both SNMP tables for a single measurement using the SNMP plugin?


Telegraf version: 1.2.1

You can get values from multiple tables and report them in a single measurement as either fields or tags. The first telegraf config example in the SNMP documenation shows a single table, but you can specify as many as you like.

I’m aware of the fact that generally multiple tables can be used. However, when using multiple tables, a measurement will be created for each row in the table.
In the concrete example, it would be needed to aggregate data from two tables for a single data point.

It would be helpful if you could post a simplified version of both what you are getting and what you want to have.

I got the same Problem. For future refeference: there is a feature request for this:

Hi,
There is no simple way to join two snmp tables that have translation table and different index in telegraf/influx/kapacitor/flux combo. Kapacitor usually leaks memory because of lack of limiting time for samples to wait for missing values from second table. Flux is not designed for this, especially when you want to add just tags from second table. So today I started working for a real workaround for this problem that is present for more than a year now.

Problematic examples, that I encountered:
BGP4-V2-MIB-JUNIPER::JnxBgpM2PeerEntry that has different index from BGP4-V2-MIB-JUNIPER::jnxBgpM2PrefixCountersTable joinable by field BGP4-V2-MIB-JUNIPER::jnxBgpM2PeerIndex

similar: ADVA-FSPR7-PM-MIB::facilityPhysInstValueTable with ADVA-FSPR7-MIB::entityFacilityTable they are joinable by field entityFacilityOneIndex from first table.

Cisco also have many tables for example ifTable vs entPhysicalEntry (different indexes, but same 1:1 data).

As a solution I propose adding two options to snmp table field:
SecondaryIndexTable bool: that specifies a field to be index translation table
UseSecondaryIndex bool: that specifies field to be using different index than main table, and that index can be resolved by SecondaryIndexTable

I have a working solution here:

Is this actually possible? Specifying multiple tables results in multiple measurements being returned, one set for each table, and a delay between each, as the SNMP table is walked which means the measurements of each table are at different times.