How to enable telegraf plugin in certain time only?

I got an impression that plugins , once configured in telegraf, run always.

For example, if I attach a tail plugin or a logparser plugin, they will always run and populate my influxdb with data.

But if I only interested in short periods of invocation of such plugins?

That means “on demand”, “on command”.

How can I switch them on or switch them off when I want?

The obvious way is to run telegraf by command, supplying a config file with parameters of plugins.

But this means, I need exec/ssh permissions on a server, where I run telegraf agent and remote access.

This is not a good option for me, because my OPS people oppose that.

I can start telegraf agent only 1-ce to work FOREVER.

Once I started, all plugins run, I can not stop/start any of them.

And to use logparser plugin constantly is a big impact, we need enable it only for periods, when we want.

Ideally, if we can do that from Grafana - start/stop telegraf plugin on demand.

Is it to much to expect from telegraf?

In general, telegraf is a good agent, but when it comes to ways of plugins run-time control - it is somehow inaccessible.

Am I wrong? Do you have ideas?

Thanks a lot!

Most users of Telegraf leave it running as a service and this is the way I recommend running it in production. Logparser shouldn’t be a large resource drain when not processing data, so perhaps we should look into why this is the case.

There is an issue open discussing a mode that would run for a set period of time, so maybe you can add your use case to the issue? Stop after x Samples or x Time · Issue #862 · influxdata/telegraf · GitHub

Outside of this, you would need to run a wrapper script to manage Telegraf’s lifetime.

Daniel thanks.

“Logparser shouldn’t be a large resource drain when not processing data, so perhaps we should look into why this is the case.”

I imagine our tens of log files…Each under logparser’s care. It could be a problem…
Logparser is not so appropriate for us, because when you enable parser you need in advance to know what you are looking for, what regex/pattern. And if problem happens in production, you may need quickly set other pattern to watch, and this reconfiguring demands a service restart and only OPS can restart it and so, we - DEVS, have no access and so we need ask OPS to restart all that. In short - it is too rigid and inconvenient plugin for us.

In general, I lack a unconventional “backdoor” in telegraf. It collects metrics, all by the book, but I lack a place to add a custom piece of code , that not obligatory following the pattern. It is especially in demand , when processing logs. For example, we want download logs, or tail them when we want, without wrap telegraf. And this is not playing good with whole influx stuff, for example, influxdb is only having strings of 64 kbyte, so I can not save this downloaded log in influxdb. In whole it looks like metrics are processed fine, but logs left for other frameworks to care. And it is very pity. I see that in my company, They almost “bought” a solution based on influx, but logs left without care and our OPS became less attracted, we need create separate solution for logs, separate UI, separate ports in DMZ, all that becomes too complex…Very pity! :slight_smile: .