Skip to content
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

Disable [[outputs.influxdb]] in default telegraf.conf #5887

Closed
beiermi opened this issue May 21, 2019 · 9 comments · Fixed by #12158
Closed

Disable [[outputs.influxdb]] in default telegraf.conf #5887

beiermi opened this issue May 21, 2019 · 9 comments · Fixed by #12158
Assignees
Labels
area/configuration discussion Topics for discussion feature request Requests for new plugin and for new features to existing plugins help wanted Request for community participation, code, contribution size/m 2-4 day effort

Comments

@beiermi
Copy link

beiermi commented May 21, 2019

I'd expect telegraf to be completely configurable without modifying /etc/telegraf/telegraf.conf provided by vendor / rpm package and only adding custom configuration files in /etc/telegraf/telegraf.d.
But the /etc/telegraf/telegraf.conf defines an influxdb output without setting any further options. This results in telegraf trying to contact http://localhost:8086/write?db=telegraf every 10s.
Adding a custom configuration file in /etc/telegraf/telegraf.d, which defines an own influxdb output url, does not change this behaviour.
To change this behaviour and prevent telegraf from useless http requests to localhost:8086, I'd propose disabling/commenting the following line in telegraf.conf:
[[outputs.influxdb]]

@danielnelson
Copy link
Contributor

Thanks for opening the issue. I don't necessarily agree with your expectation that it should be possible to configure Telegraf without modifying the default configuration file, this is not generally how config file plus directory works. For example compare with /etc/apt/sources.list vs /etc/apt/sources.list.d on a Debian system.

That said, I think it would be reasonable to move the default plugin configuration into the telegraf.d directory to ease merging on updates #4966. This would make it easier to remove the default configuration. If that seems reasonable to you then I will close this issue and we can follow #4966.

@danielnelson danielnelson added the discussion Topics for discussion label May 22, 2019
@beiermi
Copy link
Author

beiermi commented May 23, 2019

I agree, that your sources.list example is similar - but though there are some differences.
Telegraf tries to contact http://localhost:8086/write?db=telegraf every 10s, what is producing unnecessary errors telegraf.log. Only very few users will run influxdb on localhost, most of them have to change the configuration. Another aspect of this issue is, that the default configuration of telegraf is not working for most users and even produces a huge amount of error logs. Moving the [[outputs.influxdb]] into a separate configuration file in /etc/telegraf/telegraf.d will only move this issue, but not fix it.
A default configuration should make sense and not lead to errors.

@danielnelson
Copy link
Contributor

For many users getting started, it is nice to start everything with apt-get install telegraf influxdb, this is the main reason behind the current configuration. In the future this will probably not work with InfluxDB v2, as it requires configuration, so that does open us up to make changes.

I don't think the logs are a big deal, if my math is correct it only comes out to about 2MB a day, and most systems rotate and compress the logs after that. They also nudge the user in the right direction of what needs done.

It's also not currently possible to start Telegraf without an output defined, something that I think is generally a good thing since running without an output is almost always an error. I have seen some packages, shorewall comes to mind, that refuse to start until configured.

This isn't something I would consider changing until 2.0, but do you think we should refuse to start until an output is configured?

@dukz
Copy link

dukz commented Jul 1, 2019

I do agree in removing the default influxdb output configuration.

Every time I upgrade the telegraf package, it ends up having a config overwrite with the package manager, and I have to do it by hand to disable that all over again.

I've made it a practice to just put everything under the telegraf.d folder, so configs are consistent even after the telegraf package is updated.

@danielnelson danielnelson added the feature request Requests for new plugin and for new features to existing plugins label Sep 17, 2019
@sjwang90 sjwang90 added this to the 2.0.0 milestone Aug 3, 2021
@arvenil
Copy link

arvenil commented Aug 6, 2021

Everyone who want's to follow .d folder pattern will fall into this issue. I can't really use telegraf.d folder as I need to overwrite telegraf.conf anyway. I don't understand why [[outputs.influxdb]] is not commented out. Put it into telegraf.d as localhost.conf and comment it out. Point users to the file and ask to uncomment the line if they want localhost.

Horrible workaround for now:

%post
sed -i '/^[[outputs.influxdb]]$/s/^/#/' /etc/telegraf/telegraf.conf

@sseypt
Copy link

sseypt commented Dec 10, 2021

@beiermi Thanks you for opening this issue 👍

Don't know how long it would have taken me to realize that these authorization errors in the influx log came from a missing # 🙈

In my opinion there shouldn't be a default output which can't be disabled throug /etc/telegraf/telegraf.d/

Since there is [[outputs.influxdb_v2]] already, i'd also like this issue to be fixed.

@Luis-3M
Copy link

Luis-3M commented Apr 25, 2022

@arvenil
Thanks 👍
Your sed command didn't work on my side (Amazon Linux 2) - had to change it slightly:

sed -i '/^\[\[outputs.influxdb\]\]/ s/./# &/' /etc/telegraf/telegraf.conf

@toastbrotch
Copy link

we're suffering from the same problem, as it breaks our automation on packet-upgrades as it often comes with a changed /etc/telegraf/telegraf.conf

we have our custom /etc/telegraf/telegraf.d/foo.conf with everything we need, and it seems our config and the default create 2 different agents or at least targets to send logs to, as our target gets the metrics. so what i don't understand is why our config does simply not overwrite that default. so we need to comment out that line in the /etc/telegraf/telegraf.conf to get rid of this second agent/target. .... i don't understand why we have that /etc/telegraf/telegraf.d when overwriting the default does not work. so something is rather broken here...

regards,ivo

@toastbrotch
Copy link

@danielnelson this is not a feature request, this is a rather annoying bug! thanx for changing tags and correctly priorizing

@sspaink sspaink added help wanted Request for community participation, code, contribution breaking change Improvement to Telegraf that requires changes to the plugin or agent; for minor/major releases size/m 2-4 day effort labels Oct 26, 2022
@sspaink sspaink self-assigned this Nov 3, 2022
@sspaink sspaink removed the breaking change Improvement to Telegraf that requires changes to the plugin or agent; for minor/major releases label Nov 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/configuration discussion Topics for discussion feature request Requests for new plugin and for new features to existing plugins help wanted Request for community participation, code, contribution size/m 2-4 day effort
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants