prometheus / snmp_exporter

SNMP Exporter for Prometheus
Apache License 2.0
1.71k stars 631 forks source link

Lookups with different destination index names from source_indexes names? (ifIndex values, but under different name) #1050

Open frittentheke opened 12 months ago

frittentheke commented 12 months ago

I used the search function some, but could not find an answer to a problem I ran into:

Apparently some MIBs reuse the values of e.g. the popular ifIndex (IF-MIB), but under a different name. Exhibit A(rista):

In their ARISTA-IP-MIB (https://www.arista.com/assets/data/docs/MIBS/ARISTA-IP-MIB.txt) the index aristaIpIfStatsIfIndex is defined with:

[...] aristaIpIfStatsIfIndex OBJECT-TYPE SYNTAX InterfaceIndex MAX-ACCESS not-accessible STATUS current DESCRIPTION "The index value that uniquely identifies the interface to which this entry is applicable. The interface identified by a particular value of this index is the same interface as identified by the same value of the IF-MIB's ifIndex." ::= { aristaIpIfStatsEntry 2 } [...]

So the snmp_exporter produces metrics like:

[...]
# HELP aristaIpIfStatsOutUcastPkts The number of IP unicast packets transmitted - 1.3.6.1.4.1.30065.3.27.1.1.1.9                                                                                                   
# TYPE aristaIpIfStatsOutUcastPkts counter                                                                                                                                                                         
aristaIpIfStatsOutUcastPkts{aristaIpIfStatsIPVersion="1",aristaIpIfStatsIfIndex="1000001"} 0                                                                                                                       
aristaIpIfStatsOutUcastPkts{aristaIpIfStatsIPVersion="1",aristaIpIfStatsIfIndex="1000002"} 0                                                                                                                       
aristaIpIfStatsOutUcastPkts{aristaIpIfStatsIPVersion="1",aristaIpIfStatsIfIndex="10001"} 0                                                                                                                         
aristaIpIfStatsOutUcastPkts{aristaIpIfStatsIPVersion="1",aristaIpIfStatsIfIndex="1000501"} 0     
[...]

Just like it's common for IF-MIB tables, I would like to lookup and add the ifName or ifAlias labels here. But as far as I understand the config of the generator's lookups (https://github.com/prometheus/snmp_exporter/blob/323d1b08578527d9ba0cdea7846c61942bb85e42/generator/generator.yml#L12C1-L12C1) functionality, the index defined by source_indexes has to exist under the same name in the table which fields are "joined"?

So my question are:

SuperQ commented 12 months ago

I don't remember a way to do this currently, but I think this would be useful feature.