Telegraf - How to pull only partial table

hi everybody,

im using telegraf 1.18.1 to collect SNMP and API time-series metrics from various vendor’s network gear.
usually, i collect both ifTable and ifXTable from my switches.
lately, I’ve encountered an issue with cisco CBS switches, when pulling iftables the switches CPU spikes up to 100%, further investigating I’ve discovered that this issue is because for some reason these switches OS add all L2 configured VLANs to if tables (around 600 VLANs) which make the tables very large.

so now I’m looking for a way to pull only part of the table, let’s say for interfaces 1-52, but i can’t find a scalable way to do so.

  1. I understand that I can pull specific fields (error, hcOctats,
    discard,ifstate etc.) and do so for specific interfaces but this will
    make the configuration log and complex.

  2. using input filters won’t help either, this way will only filter the data
    collected by telegraf and still load
    the switches.

is there a way that:

  1. I could pull the tables but only for specific interfaces?
  2. or just configure the specific table fields for interfaces index range
    like [1-52]?

ill appreciate any tips or ideas.


any ideas?


I don’t think there’s a way to do what you’re looking for. Looking at the Telegraf code that does the snmp walk I don’t see anything that exits early if an index range is complete. I also don’t see a way to start the walk in the middle of the table, for instance if you wanted to fetch [53-104].

Have you used other snmp tools that allow you to walk only a section of the table? If this is possible with snmp, we might be able to add it to telegraf but it would require a code change.

thank you for responding.
no, i don’t know of a tool that is capable of this.
what about pulling a specific OIDand using regEx just at the interface index part?

in OID IF-MIB::ifName.1 the".1" is the index.
could I configure a snmp.filed using regEx?
the below example didn’t work

name = “inttest”
oid = “IF-MIB::ifName./*/”

any ideas on how to use regex in OID filed in telegraf config file?