How does telegraf handling two separate conf

Good morning.

For testing purposes, i am polling SNMP from two different devices and under the same config.d/ folder. I want to achieve this in a way that each devices has their own conf file. i.e. device1.conf device2.conf

all input are same except, name and device ip and both ‘output’ setups are like below:

urls = [“xxxxxxx”]
username = “xxxxx”
password = “xxxxx”
insecure_skip_verify = true
index_name = “device_x-%Y.%m.%d”
manage_template = true
template_name = “device_x”
overwrite_template = false

#x represent device no, i.e device_1 or device_2.

Everything works fine especially on the polling side, i can see the data for both devices, each outputs create their own indices and index template based on the respective config.

However, in the discovery elasticsearch, it seems like index device_1 has data on index device_2, and vice versa and might as well i just create 1 conf file that has two devices inside.

From my observation, this seems to be how elasticsearch handle the data from telegraf, am I right? Is this expected behavior?

Telegraf combines all configurations into one large config when it starts. The ability to use multiple configuration files is for the user to make sorting things a bit easier, but it has zero effect on how telegraf operates since the configs are all read into one large config.

1 Like