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

Detect changes to config and reload telegraf (copy of pr #8529) #9485

Merged
merged 4 commits into from
Jul 15, 2021

Conversation

sspaink
Copy link
Contributor

@sspaink sspaink commented Jul 8, 2021

resolves #7187

This feature was thought to be already supported, but has now made clear that it isn't and is required for another project effort. To help get this pull request ready quicker I've taken it over to resolve merge conflicts and use the latest influxdata/tail now that the fix has been merged. This pr still needs to be tested and reviewed to make sure this is the best approach. I also didn't copy over the windows specific changes because it wasn't obvious why they were necessary, see the original pull request #8529 for more details.

Lots of kudos to @vlastahajek for the original pr and the fix to the tail repo.

@telegraf-tiger telegraf-tiger bot added the fix pr to fix corresponding bug label Jul 8, 2021
@sspaink sspaink requested a review from ssoroka July 8, 2021 18:23
@sspaink
Copy link
Contributor Author

sspaink commented Jul 8, 2021

@wojciechka, @ssoroka Are you able to take the artifacts posted by the Telegraf Tiger and see if this works for you? I am not entirely sure what the best way to test it would be. If you can provide some steps on how to test it, I'd be happy to do it as well.

@wojciechka
Copy link

@wojciechka, @ssoroka Are you able to take the artifacts posted by the Telegraf Tiger and see if this works for you? I am not entirely sure what the best way to test it would be. If you can provide some steps on how to test it, I'd be happy to do it as well.

Unfortunately this does not work inside Kubernetes pods that have their configurations mounted as secrets.

This is because the secrets are handled as symlinks to symlinks and this logic may not be detecting all of the underlying changes.

I can confirm that just using --watch-config poll or --watch-config inotify works in the simple case of this being a file, but not when this is a Kubernetes secret.

I have tried to reproduce it outside of Kubernetes, but could not reproduce the case where it does not work, it may be that the mounts are handled by Kubernetes.

Would it be possible to implement it by periodically reading the config file and comparing its contents and/or checksum? This could be something like --compare-config 1m to indicate the check should be made every minute.

@wojciechka
Copy link

After spending more time and testing both modes, I have verified that --watch-config inotify is working well with telegraf-operator - where telegraf is run inside Kubernetes and has its config mounted as a Kubernetes secret.

I have verified this in kind and a GKE cluster, so I am optimistic that it will run in any Kubernetes cluster.

@sspaink sspaink marked this pull request as ready for review July 9, 2021 15:22
@sspaink sspaink added feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. and removed fix pr to fix corresponding bug labels Jul 10, 2021
@pszlazak
Copy link

pszlazak commented Dec 7, 2021

Is there any plan to support remote config (over http)? If I try this option I get:

2021-12-07T14:40:53Z W! Cannot watch config http://xx.xx.xx.xx:8086/api/v2/telegrafs/aaaaaaaa: stat http://xx.xx.xx.xx:8086/api/v2/telegrafs/aaaaaaaa: no such file or directory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Telegraf watch and restart with new configuration file
4 participants