Objective: collect multiple specific snmp OIDs that have the same name, but with different tags.
For example, get the interface description and then the in and out octets for an interface. In the configuration below, only one of these outputs to influxdb (I suspect because they’re overwriting each other).
How is it possible to poll multiple values which have the same name, but with different tags?
[[inputs.snmp.field]]
name = "hostname"
oid = "RFC1213-MIB::sysName.0"
is_tag = true
[[inputs.snmp.field]]
name = "ifDescr"
oid = "IF-MIB::ifDescr.683"
is_tag = true
[[inputs.snmp.field]]
name = "ifHCInOctets"
oid = "IF-MIB::ifHCInOctets.683"
[[inputs.snmp.field]]
name = "ifHCOutOctets"
oid = "IF-MIB::ifHCOutOctets.683"
[[inputs.snmp.field]]
name = "ifDescr"
oid = "IF-MIB::ifDescr.635"
is_tag = true
[[inputs.snmp.field]]
name = "ifHCInOctets"
oid = "IF-MIB::ifHCInOctets.635"
[[inputs.snmp.field]]
name = "ifHCOutOctets"
oid = "IF-MIB::ifHCOutOctets.635"
What I think you want to do here is use the table functionality, for each item in the table a metric will be created tagged by the index. You can use table fields to modify the names and tag status of specific entries. All fields in the table are always collected, but if you don’t want a specific entry you can use fielddrop (or tagdrop for excluding certain interfaces):
[[inputs.snmp]]
fielddrop = ["ifPhysAddress"]
[[inputs.snmp.field]]
name = "hostname"
oid = "RFC1213-MIB::sysName.0"
is_tag = true
[[inputs.snmp.table]]
name = "interface"
oid = "IF-MIB::ifTable"
inherit_tags = ["hostname"]
[[inputs.snmp.table.field]]
oid = "IF-MIB::ifDescr"
is_tag = true
If you have lots of interfaces and only want a very small number of OIDs collected, then @MarcV’s suggestion might work better.
I did consider the multiple [[inputs.snmp]], but I believe this would also require duplicating all the values in that section, eg. my base [[inputs.snmp]] looks like this:
Unless I’m misunderstanding, each of these would need to be defined in each of the [[inputs.snmp]], is that correct? (nb. these are unique to the polling I’m trying to configure, they’re not global)
For the table functionality, I believe this will walk the tables in full (both ifTable and ifDescr) and store all except those configred by fielddrop/tagdrop? The problem here, and what I was trying to avoid, is excessive polling. Some devices (hey, looking at you Juniper) really don’t like this, and it causes excessive RE load.