2

I have a number of network switches in my infrastructure and I have been using telegraf to collect data traffic information from switches with snmp. So far switch IP addresses were added to the config statically. I was wondering if it is possible to call IP list from a database so I don't need to add it every time statically into the config? Or maybe telegraf is just not the tool for that.

Usual config looks like this:

[[inputs.snmp]]
  agents = [ "192.168.252.15:161" ]
  version = 2
  community = "public"
  name = "snmp"

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

  [[inputs.snmp.table]]
    name = "snmp"
    inherit_tags = [ "hostname" ]
    oid = "IF-MIB::ifXTable"

    [[inputs.snmp.table.field]]
      name = "ifName"
      oid = "IF-MIB::ifName"
      is_tag = true
A. Smith
  • 75
  • 1
  • 1
  • 9

1 Answers1

0

I would just write a script that would modify the telegraf.conf file as you need. I do something similar for auto-scaled servers in AWS... So I have a bash script that cloud-init runs when instances are created from an image which has most of my telegraf config already in it, and then this script modifies it so the hostname is modified with the new IP address.

So ultimately, I think you just need a script that runs upon creation or whatever the scenario is for your needs. My two cents anyway...

biren
  • 13
  • 4