Must SNMP table filtering be so verbose?

35 views
Skip to first unread message

Elliott Balsley

unread,
Apr 15, 2025, 9:09:16 PMApr 15
to Prometheus Users
I've spent over 2 hours reading the documentation and examples about how to use static and dynamic filters in the SNMP Exporter.  I find this concept very confusing, and I think I think I finally understand it.  It would have been more clear to include this statement in the readme:
Filters cannot be used when walking an entire table or subtree.  In order to use filters, you must specify table columns in the walk section, and also specify those same columns as filter targets.  

Is that true?

To make a very simple example, suppose I want to get all columns of the second row of the ifTable.  The below generator config is extremely verbose but it's the only way I could get this to work.

In this example, it would have been easier to drop using prometheus relabel configs.  But I have more complex SNMP devices where certain tables return hundreds of bogus rows, which makes the scrape very slow, so that's where I would like to specify the indices.


if_test:
walk:
- ifIndex
- ifDescr
- ifType
- ifMtu
- ifSpeed
- ifPhysAddress
- ifAdminStatus
- ifOperStatus
- ifLastChange
- ifInOctets
- ifInUcastPkts
- ifInNUcastPkts
- ifInDiscards
- ifInErrors
- ifInUnknownProtos
- ifOutOctets
- ifOutUcastPkts
- ifOutNUcastPkts
- ifOutDiscards
- ifOutErrors
- ifOutQLen
- ifSpecific
filters:
static:
- targets:
- ifIndex
- ifDescr
- ifType
- ifMtu
- ifSpeed
- ifPhysAddress
- ifAdminStatus
- ifOperStatus
- ifLastChange
- ifInOctets
- ifInUcastPkts
- ifInNUcastPkts
- ifInDiscards
- ifInErrors
- ifInUnknownProtos
- ifOutOctets
- ifOutUcastPkts
- ifOutNUcastPkts
- ifOutDiscards
- ifOutErrors
- ifOutQLen
- ifSpecific
indices: ["2"]
Reply all
Reply to author
Forward
0 new messages