telegraf icon indicating copy to clipboard operation
telegraf copied to clipboard

REST api support to manage telegraf configuration

Open pravindamodaran opened this issue 6 years ago • 3 comments

Feature Request

Proposal:

Expose api's using REST/RESTCONF/any other protocols to manage telegraf plugin configuration on the fly.

Current behavior:

Configuration can be reloaded by sending SIGHUP signal to telegraf process through CLI. This refreshes the whole configuration and restarts plugins, so there is chance of losing data within this period. Also, the telegraf docker images do not contain the linux library to use systemctl command, hence restricts refreshing config in docker-compose and k8s deployment. So this does not look like the way to update config in production.

Desired behavior:

Expose GET/PUT/POST/DELETE (or) any other methods to manage plugin configuration, without needing to refresh the whole config/restarting the plugins.

Use case:

External systems like NMS/SDN controller/other telemetry management services need to communicate with telegraf to automate start/stop of telemetry data collection from devices based on changes in network topology. Currently without any api exposed, it is not possible for external systems to achieve this. Would be nice to have this feature.

pravindamodaran avatar May 15 '20 11:05 pravindamodaran

Looks like influxdb-client has API's for telegraf configuration management. Still, telegraf needs to pull the config from influxdb and use them for reload using SIGHUP.

pravindamodaran avatar May 15 '20 17:05 pravindamodaran

Can we have a sysctl version of telegraf that uses the API? maybe inside telegraf config

Proposal:

Add params to view parsed config Add params to change config and write to disk Add params to verify config

Current behavior:

Telegraf can only generate example config

Desired behavior:

Telegraf can fully manage config Use case:

Ease of use during

troubleshooting
deployment

Instead of creating files, I can generate and validate my input and thus always having correct config. I could verify the config to make sure that everything checks out. This could be a ExecPreStart much like nginx.

Instead of poking through files I can print telegraf config and view what is set.

Adding or changing config for a plugin is simpler on a broad scale by just running one command to change a specific setting for a plugin.

Examples:

telegraf config set --drop-dir /etc/telegraf/conf.d outputs.influxdb.cert_key "/path/to/cert"

telegraf config get --drop-dir /etc/telegraf/conf.d outputs.influxdb.cert_key

telegraf config validate --drop-dir /etc/telegraf/conf.d

isodude avatar Jan 13 '22 09:01 isodude

A REST API for telegraf is something that has come up from time to time. Telegraf is a config driven agent. We are very happy to see improvements to how those configs are managed, whether it is local or remote configs, and land those types of changes.

The requested API is not something that is in plan and as such I am going to close this issue. We strive to get our list of issues and feature requests to things that we reasonably will do and not keep things open that in reality won't happen.

Thanks

powersj avatar Jan 23 '23 20:01 powersj