Telegraf service with multiple configs generated by influx web ui

Is there a recommended or typical work flow for getting systemd to automatically start telegraf for each/all of the telegraf configs available via influx api?

Or is there some other common way to automatically deploy all configured telegrafs? Perhaps in containers.

What operating system are you running on?

Some options:

  1. Update the service command to point at the URLs by specifying specific --config and URLs + adding the InfluxDB token as an environment variable. This would generally be easier on Linux than Windows. Something like these steps for systemd.
  2. If you want to use Docker, then you would do something similar by setting the token as an environment variable + update the command arguments.

I am using debian. I understand how to deploy a single instance via systemd or docker manually. I’m curious if there are any typical ways of automating deployment of multiple telegrafs - one for each telegraf config present on influx and available through the api.

I won’t say that is a typical thing to do, so no.

My personal suggestion is if you can use docker is deploy a different docker for each remote config, versus trying to create and maintain different telegraf services via systemd.

Thanks for the response! I’m surprised it isn’t a typical use case.

It feels like there is a large gap between the ease with which you can create telegraf configs via the guided web interface and the ability to deploy those telegraf configs. There doesn’t seem to be much benefit to having the ability to easily create multiple configs for different data ingress tasks if there isn’t also an easy, and ideally automatic, way to deploy them. In my use case I support a number of other folks working on and modifying pipelines and data collection from edge devices. It would be really nice if each of them could create (and deploy) a new telegraf from the web ui whenever they want.

If there isn’t such a thing already, I will try to create a way to automate it by accessing the telegrafs endpoint of the API. I think a separate docker for each config will be rather more resource intensive than I would like. Maybe I can modify the telegraf service to be an instantiated service and then create a separate controller service that monitors the API to add or prune instances.

Do you know if the --watch-config poll option will update with changes to a config file specified as an http endpoint? Would be great if it does, but if not then my controller service will have to monitor for changes as well.

No it currently does not. You have good timing though, as literally just landed a PR today that defines the behavior and possible new options for remote URL watching: docs: Add URL config behavior spec by powersj · Pull Request #15321 · influxdata/telegraf · GitHub I’m going to start working on the implementation in the next couple days.

1 Like