-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Telegraf Configuration - Recommended approach for multiple .conf files? #6334
Comments
The way to think about it is that all of the files: So there are a variety of way to do this, but here is what I recommend as a starting point:
The You will just have a single Feel free to group or split plugins in the Let me know if you have more questions. |
Thanks for the info, I've now aligned the config accordingly... |
hi @danielnelson, I've got the above working on an Ubuntu host but when using the official Telegraf Docker image on a Synology NAS, there doesn't seem to be a way through the Synology Docker GUI to change the telegraf command to include the --config-directory switch (i.e. to be "telegraf --config-directory /etc/telegraf/telegraf.d)... As such the Telegraf container only seems to monitor the /etc/telegraf/telegraf.conf file and no others (no extra conf files are picked up under /etc/telegraf or /etc/telegraf/telegraf.d).... Is there a way to specify the --config-directory switch through either the container environment variables (which can be amended via the Synology Docker GUI) OR in the initial /etc/telegraf/telegraf.conf file itself to get Telegraf to also look in /etc/telegraf/telegraf.d/ ? Thanks! |
I figured this out - Although there is no option to edit the telegraf container command on an existing Synology Telegraf container, the option is there to change the execution command when creating a new container. Thanks! |
Glad you have it going, #5656 is still on the plan to simply this a bit and perhaps we can improve the documentation on docker hub. |
Thanks! May I do this to put a pair of input and output into one config under
can telegraf to send inputs.abc data to influxdb.abc and inputs.XYZ to influxdb.XYZ respectively? Thanks! |
@a13519 If I understand @danielnelson correctly this is not possible. I am looking for the same thing as you:
If you put them into the So what worked for me was to copy
Then: |
@danielnelson Just want to double check. Thanks. |
Hi,
This is not expected and if you find otherwise, please feel free to file a new issue with your configs and how you run telegraf. With recent versions of Telegraf it will show what files are loaded, including the counts of plugins. |
Hi There,
I run Telegraf docker (v1.11.5- Awesome utility by the way!) and originally had one big /etc/telegraf/telegraf.conf file with a single (InfluxDB) output and a few different input plugins (each sometimes with multiple agents) - Something like this structure of /etc/telegraf/telegraf.conf:
/etc/telegraf/telegraf.conf:
Now, since I understand that the above single config file causes Telegraf to run the file in series, I was seeing an issue where if Agent IPx was down this could cause the SNMP Input Plugin to timeout before it was able to contact/return results from Agent IPy. So I decided to break the config up into multiple .conf files as follows, all under
/etc/telegraf/telegraf.d/
and this time with no main/etc/telegraf/telegraf.conf
file:/etc/telegraf/telegraf.d/telegraf-input-metrics.conf:
/etc/telegraf/telegraf.d/telegraf-snmp-AgentIP1.conf:
...
/etc/telegraf/telegraf.d/telegraf-snmp-AgentIPX.conf:
/etc/telegraf/telegraf.d/telegraf-docker-AgentIP1.conf:
/etc/telegraf/telegraf.d/telegraf-docker-AgentIP2.conf:
In doing this, I have a few questions:
(1) With Telegraf command configured to run as
telegraf --config-directory /etc/telegraf/telegraf.d
in the container, and with main/etc/telegraf/telegraf.conf
file (all split conf files under /etc/telegraf/telegraf.d/): I got the following error on starting the container - I assume this means that there must be a/etc/telegraf/telegraf.conf
file, even if the--config-directory /etc/telegraf/telegraf.d
switch is passed to the telegraf command in the container?(2) To work around the above, I moved one of the config files (/etc/telegraf/telegraf.d/telegraf-input-metrics.conf) to /etc/telegraf/telegraf.conf and was then able to start the application with the following output to the log:
I assume that the many "influxdb" outputs that are shown (last line above) are because each of my config files has the [Output Plugin - Influx DB] header therefore, is the recommended approach to:
Configure /etc/telegraf/telegraf.conf as just the main [Output Plugin - InfluxDB] and configure all the .conf files under /etc/telegraf/telegraf.d/ to just be [Input Plugin - X]?
If so, I assume this means that all the .conf files under /etc/telegraf/telegraf.d inherit the [Output Plugin - InfluxDB] from the main /etc/telegraf/telegraf.conf file so they know where to write the output to?
OR do I really still need to declare the [Output Plugin - InfluxDB] header at the top of each config file under /etc/telegraf/telegraf.d/?
The text was updated successfully, but these errors were encountered: