Telegraf SNMP Input - Two Table Join - New Feature

Very recently the SNMP Plugin was updated with capability to join two tables with diferent index.
I’m trying do this implementation but withou sucess.
The Readme doc, mention the need of use “one table should have translation field that return index”. Probably i’m missing something but with all tests i’m doing i can’t get results from two diferent Index tables.

Some one already try and have some use cases that can share?
Many thanks

Can you show the (relevant part of the) config file, so we can see what you are trying. As you can see in the ticket, I’m also not completely understanding how exactly it works, but maybe together we can work it out.

1 Like

Many thanks your reply to my post.

I’ve try read everything about this (include your comments of course in Github), and i 'm not programmer but we are trying evaluate Telegraf as metric collector and we are facing this Index chalaging with diferent tables and i’m just trying understand if this is feasible, and that is the reason i’ve ask for some examples if possible.

If some expert can comment on this i appreciate just to try understand if we are in right or wrong direction.

Problem:
We have one situation of equipment (SAN), that use Two diferent Mibs and return diferent Index:
Exemple:
MIB/OID: FIBRE-CHANNEL-FE-MIB::fcFxPortC3InOctets (give port performance count In) and in our case have Index 1.1 - 1.8
other
MIB(OID: FCMGMT-MIB::connUnitPortName (give port interface name) and in our case have Index 16.0.0.3.248.32.18.32.0.0.0.0.0.0.0.0.1 - 8

Objective is map the two OID, somethng that:
Host Name - Port Name - Metric (in this case can be Port Performance)

Like i said i’m not sure this SNMP plugin with “two table merge with diferent index” solve this situation.
In Readme exemple they mention " one table should have translation field that return index", and i i think I don’t have that.
My interpetration is that i need table that must have OID that return value = Index value. Correct or i’m wrong?
If is the case i don’t have any OID that return Index value, i think.

Results:

linux3@linux3-virtual-machine:~/src/telegraf$ snmpbulkwalk -Ob -m FCMGMT-MIB -v2c -cpublic 192.168.1.11 connUnitPOrtName

FCMGMT-MIB::connUnitPortName.16.0.0.3.248.32.18.32.0.0.0.0.0.0.0.0.1 = STRING: “Port0”
FCMGMT-MIB::connUnitPortName.16.0.0.3.248.32.18.32.0.0.0.0.0.0.0.0.2 = STRING: “Port1”
FCMGMT-MIB::connUnitPortName.16.0.0.3.248.32.18.32.0.0.0.0.0.0.0.0.3 = STRING: “Port2”
FCMGMT-MIB::connUnitPortName.16.0.0.3.248.32.18.32.0.0.0.0.0.0.0.0.4 = STRING: “Port3”
FCMGMT-MIB::connUnitPortName.16.0.0.3.248.32.18.32.0.0.0.0.0.0.0.0.5 = STRING: “Port4”
FCMGMT-MIB::connUnitPortName.16.0.0.3.248.32.18.32.0.0.0.0.0.0.0.0.6 = STRING: “Port5”
FCMGMT-MIB::connUnitPortName.16.0.0.3.248.32.18.32.0.0.0.0.0.0.0.0.7 = STRING: “Port6”
FCMGMT-MIB::connUnitPortName.16.0.0.3.248.32.18.32.0.0.0.0.0.0.0.0.8 = STRING: “Port7”

linux3@linux3-virtual-machine:~/src/telegraf$ snmpbulkwalk -Ob -m FIBRE-CHANNEL-FE-MIB -v2c -cpublic 192.168.1.11 fcFxPortC3InOctets

FIBRE-CHANNEL-FE-MIB::fcFxPortC3InOctets.1.1 = Counter32: 782383144
FIBRE-CHANNEL-FE-MIB::fcFxPortC3InOctets.1.2 = Counter32: 2426667236
FIBRE-CHANNEL-FE-MIB::fcFxPortC3InOctets.1.3 = Counter32: 3408660756
FIBRE-CHANNEL-FE-MIB::fcFxPortC3InOctets.1.4 = Counter32: 0
FIBRE-CHANNEL-FE-MIB::fcFxPortC3InOctets.1.5 = Counter32: 0
FIBRE-CHANNEL-FE-MIB::fcFxPortC3InOctets.1.6 = Counter32: 0
FIBRE-CHANNEL-FE-MIB::fcFxPortC3InOctets.1.7 = Counter32: 0
FIBRE-CHANNEL-FE-MIB::fcFxPortC3InOctets.1.8 = Counter32: 0

Telegraf config:
[[inputs.snmp.table]]
name = “Doubletablev2”
index_as_tag = true

[[inputs.snmp.table.field]]
name = "fcFxPortC3InOctets"
oid = "FIBRE-CHANNEL-FE-MIB::fcFxPortC3InOctets"  

[[inputs.snmp.table.field]]
name = "fcFxPortOperMode"
oid = "FIBRE-CHANNEL-FE-MIB::fcFxPortOperMode" #I know this is not a Index translate field
secondary_index_table = true

[[inputs.snmp.table.field]]
name = "connUnitPortName"
oid = "FCMGMT-MIB::connUnitPortName" 
secondary_index_use = true
is_tag = true

Telegraf test:
linux3@linux3-virtual-machine:~/src/telegraf$ ./telegraf --config https://westeurope-1.azure.cloud2.influxdata.com/api/v2/telegrafs/08480b399e5d1000 --test

2021-10-12T09:25:38Z I! Starting Telegraf

Doubletablev2,agent_host=192.168.1.11,host=linux3-virtual-machine,index=1.1 fcFxPortC3InOctets=3646977766i,fcFxPortOperMode=1i 1634030739000000000
Doubletablev2,agent_host=192.168.1.11,host=linux3-virtual-machine,index=1.2 fcFxPortC3InOctets=2426668576i,fcFxPortOperMode=2i 1634030739000000000
Doubletablev2,agent_host=192.168.1.11,host=linux3-virtual-machine,index=1.3 fcFxPortC3InOctets=1059053732i,fcFxPortOperMode=1i 1634030739000000000
Doubletablev2,agent_host=192.168.1.11,host=linux3-virtual-machine,index=1.4 fcFxPortC3InOctets=0i,fcFxPortOperMode=1i 1634030739000000000
Doubletablev2,agent_host=192.168.1.11,host=linux3-virtual-machine,index=1.5 fcFxPortC3InOctets=0i,fcFxPortOperMode=1i 1634030739000000000
Doubletablev2,agent_host=192.168.1.11,host=linux3-virtual-machine,index=1.6 fcFxPortC3InOctets=0i,fcFxPortOperMode=1i 1634030739000000000
Doubletablev2,agent_host=192.168.1.11,host=linux3-virtual-machine,index=1.7 fcFxPortC3InOctets=0i,fcFxPortOperMode=1i 1634030739000000000
Doubletablev2,agent_host=192.168.1.11,host=linux3-virtual-machine,index=1.8 fcFxPortC3InOctets=0i,fcFxPortOperMode=1i 1634030739000000000
Doubletablev2,agent_host=192.168.1.12,host=linux3-virtual-machine,index=1.2 fcFxPortC3InOctets=2960988964i,fcFxPortOperMode=2i 1634030739000000000
Doubletablev2,agent_host=192.168.1.12,host=linux3-virtual-machine,index=1.3 fcFxPortC3InOctets=95317396i,fcFxPortOperMode=1i 1634030739000000000
Doubletablev2,agent_host=192.168.1.12,host=linux3-virtual-machine,index=1.4 fcFxPortC3InOctets=1879387052i,fcFxPortOperMode=1i 1634030739000000000
Doubletablev2,agent_host=192.168.1.12,host=linux3-virtual-machine,index=1.5 fcFxPortC3InOctets=0i,fcFxPortOperMode=1i 1634030739000000000
Doubletablev2,agent_host=192.168.1.12,host=linux3-virtual-machine,index=1.6 fcFxPortC3InOctets=0i,fcFxPortOperMode=1i 1634030739000000000
Doubletablev2,agent_host=192.168.1.12,host=linux3-virtual-machine,index=1.7 fcFxPortC3InOctets=0i,fcFxPortOperMode=1i 1634030739000000000
Doubletablev2,agent_host=192.168.1.12,host=linux3-virtual-machine,index=1.8 fcFxPortC3InOctets=0i,fcFxPortOperMode=1i 1634030739000000000
Doubletablev2,agent_host=192.168.1.12,host=linux3-virtual-machine,index=1.1 fcFxPortC3InOctets=0i,fcFxPortOperMode=1i 1634030739000000000
linux3@linux3-virtual-machine:~/src/telegraf$

It’s difficult in this case because the tables use 2 values as index: The unit/module ID and the port ID.

I don’t think this will be possible as is. The best result you can have would be to use fcFxPortC3AccountingFxPortIndex as field for secondary_index_table, but I don’t think it will work because of the combined index.

Thanks your reply.

So if i’m correct this confirms that is only possible “merge” two table with diferent Index if we have in one Table the Index returned in Field OID valu, correct?

We can use “Index” OID ? like your sugestion fcFxPortC3AccountingFxPortIndex?
I’ve try use that withousucess. And if i use snmpbulkwalk don’t return nothing.

Any exemples from anyone that use this? Or any ideas to solve this?
Many thanks

Yeah, I’m afraid it will not work with these tables. You might try to reach out @helotpl in some way.

Can you use telegraf processor to rewrite the index field to your liking ?

Yes, but then it already left the input plugin. So two table join will not be done after that.