-
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
Support Telegraf being run manually just once and then exit (e.g. in a cron job or over ssh). #2546
Comments
I opened a bug for the 0s crash. The |
It will be very useful to use another monitoring tools like Nagios or Consul to execute telegraf at once. |
I would also love the flexibility of being able to run a single metrics-gathering operation without having to have telegraf long-running. In my use case, I would like to run telegraf inside of a docker container, but don't necessarily want it to be a long-running container. |
Hello, Thanks, |
Also looking forward for this Best Regards, |
Looking forward for this feature. |
It seems to be implement since few month 🎉 #7474 |
Feature Request
Allow Telegraf to run once and exit. Like the
-test
option but have it write to output plugins vs just stdout. Maybe a-once
command line option or settingagent.interval
to "0" or "0s". Currently setting it to "0s" causes a crash:Proposal:
Current behavior:
Telegraf only supports "run once" with the
-test
argument, but that doesn't write to output plugins (e.g. InfluxDB), just stdout. Omiting the[agent]
section in the config oragent.interval
option (or setting it to "0" or "0s") either results in the default agent interval or a crash.Desired behavior:
Ability to run once Telegraf manually on demand and have it exit as soon as it's done writing to the database.
Use case:
The main driver for me creating this feature request is running Telegraf on my Raspberry Pi over SSH. I'm using this Pi at a remote location and am SSHing into it using Tor so I don't have to open ports on the network's gateway. Currently I have to run Telegraf as a service on this remote system and maintain an SSH reverse tunnel so Telegraf can write data to my local InfluxDB instance.
It would be nice instead to open have the SSH tunnel open as I run Telegraf over SSH (e.g.
ssh -R 8086:influxdb:8086 host.onion telegraf
) so the tunnel is only available when Telegraf runs, and closes after Telegraf exits. This way my tunnel is only open for a few seconds every minute or 10 minutes or whatever the interval.Another use case would be running Telegraf as a subprocess from another application (e.g. python service or cronjob).
The text was updated successfully, but these errors were encountered: