Telegraf name multiple hosts in snmp plugin

telegraf

#1

Hi,
New to Telegraf, trying to move a large Collectd setup across. There are many config files, and I’m starting with this one.

I have a config file that has a handful of definitions for individual measurements (if_errors, if_octets, etc.), and then many host definitions. In each host definition, we specify the IP Address, the name, and which of the previously defined measurements to collect. it is very simple, and looks a lot like how the “snmp_legacy” plugin worked.

I’m having real trouble understanding how to translate this into a config for the new snmp plugin, however. For instance, I understand that I can have multiple agents defined in an [[inputs.snmp]] section, but I cannot see how I can name them individually. If they are not named, they will all be tagged by IP address, which will make setting up visualisations in Grafana a nightmare.

So. Is there a way that I can avoid having one [[inputs.snmp]] section per switch, with 95% of the information duplicated between them, where I can name each agent? I can’t rely on the snmp hostname being accurate.

Thanks


#2

There is an agent_host tag added with the address provided in the configuration, if you are connection with a hostname instead of IP address this should work.

Outside of this, and excluding using a snmp field, I think your current options are:

  • Add a plugin per snmp agent so you can use set static tags
  • Use the override processor to match snmp data on a tag, and add another tag

#3

Thanks @daniel I’ll look at that. I have just found a slightly more fundamental problem with the snmp configuration this morning, however. Will post again if need be.