Is it possible to automatically configure Telegraf inputs?

Hello! Excuse the noob question but I’ve only recently started working with the TIG stack. My background is mostly in software development.

Right now, I’m working with a network admin because he asked me if I could make his life a bit easier.

The current situation is that he has hundreds of devices that he needs to monitor and from what I understand, tens or hundreds of data points per device using OIDs. Firstly, it’s a bit of a hustle trying to get all these OIDs. Secondly, configuring the Telegraf plugin to have every single OID that he needs manually also seems laborious.

I was wondering if it was possible to introduce some automation into the whole workflow to make things a bit more smooth.

Hi @v1rtu3,welcome to our community

what are the things you have in mind when you say automation ?

1 Like

Thank you @MarcV!

What I’m trying to do is, to get all the information that I need e.g Cpu usage, uplink state, bandwidth stats etc. from the networking devices and as I understand you need MIBs or OIDs to get these metrics? And once you’ve gotten the certain OIDs, they need to be configured into the Telegraf config file in order to be able to query them using Chronograf or Grafana.

The current issue I’m facing is that I need an efficient way of getting all those MIBs or OIDs inside the network. I was thinking a script could be written to help with that.

Also, the next step would be to get all these inputs configured inside Telegraf.

I guess my ultimate question is how do you guys usually setup something like that? How do the pros do it?

Again thanks, any info on the matter would be appreciated.

I think for the OID configuration you won’t want to discover them, there are just too many values and reading all of them will cause too much load on your devices and network. Your device documentation can help but you may also want to look into the standard MIBs. Some like to use a graphical tool to browse the OID tree. Start with a limited set of interesting tables, most popular is probably the interfaces, add in more specific tables that interest you later on:

[[inputs.snmp]]
  agents = ["127.0.0.1"]
  version = 2
  community = "public"

  [[inputs.snmp.field]]
    name = "source"
    oid = "RFC1213-MIB::sysName.0"
    is_tag = true

  [[inputs.snmp.table]]
    name = "interface"
    inherit_tags = [ "source" ]
    oid = "IF-MIB::ifTable"

    [[inputs.snmp.table.field]]
      name = "ifDescr"
      oid = "IF-MIB::ifDescr"
      is_tag = true

The second problem you likely have is finding all the devices that you want to monitor. Most of the large deployments I have seen write a custom program to discover devices and generate the snmp configuration using a templating language into the configuration directory (/etc/telegraf/telegraf.d).

Here are some ideas for doing discovery, but Telegraf doesn’t lend any help here currently: https://docs.sharpsnmp.com/tutorials/device-discovery.html

1 Like

By that is there a list somewhere or just what most admins want to look at?

Thanks for the helpful reply! I’ll look into those and might get back to the community for more help!

Check this list of IETF MIBs, these are the what I mean by standard MIBs. Also it might be worth looking through the external links on this page as well as a GUI SNMP browser.

That’s helpful, thanks.