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

Feature request: stream stdout of long-running command #918

Closed
coussej opened this issue Mar 23, 2016 · 4 comments
Closed

Feature request: stream stdout of long-running command #918

coussej opened this issue Mar 23, 2016 · 4 comments
Labels
help wanted Request for community participation, code, contribution

Comments

@coussej
Copy link

coussej commented Mar 23, 2016

I would like to log data that is read from multiple devices using OPCUA. I have a nodejs application that logs this data and outputs this data in the influxdb line protocol to STDOUT, every x seconds.

Is there a way to configure telegraf to execute the command only once and then log whatever it writes to stdout, instead of running a script every x seconds? And maybe even restarts it when it stops?

Sorry if this is written down somewhere, but I couldn't find it.

@mark-rushakoff
Copy link
Contributor

I just looked through the exec input code and it doesn't look like it can stream the output of the command currently.

@mark-rushakoff mark-rushakoff changed the title EXEC: nodejs script that runs infinitly. Feature request: stream stdout of long-running command Mar 24, 2016
@mark-rushakoff
Copy link
Contributor

If we can read stdout of exec'ed code, it would be really cool to be able to have telegraf just read from stdin as well, perhaps something like my_long_running_command | telegraf -input-filter stdin

@sparrc sparrc added the help wanted Request for community participation, code, contribution label Mar 24, 2016
@vaizki
Copy link

vaizki commented Apr 27, 2017

We are migrating from collectd to Telegraf and all our old custom scripts were long running. How collectd does it it sets COLLECTD_INTERVAL and COLLECTD_HOSTNAME in the environment where the script is run. The script then basically outputs metrics and sleeps for COLLECTD_INTERVAL. When collectd shuts down it SIGTERMS all the scripts still running. If the script terminates, it's started again at the next collection time.

It works very well for anything requiring DB connections or other heavy (and logging intensive) operations. Maybe I will implement a small proxy which keeps them running and a HTTP interface for Telegraf to query all the results when it needs them. Unfortunately I'm not a GO developer so not much chance of the proxy appearing in this project...

@danielnelson
Copy link
Contributor

I'm going to close this issue as I think it is same request as #2087 and that issue has a slightly better problem formulation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Request for community participation, code, contribution
Projects
None yet
Development

No branches or pull requests

5 participants