Telegraf agent: syntax, restart, status

1). It is possible to have for telegraf agent the “status” for internal metrics?

2). Also there could be a change for the configuration of telegraf.conf to take on the fly the changes in the config file with no restart: $ systemctl restart telegraf;systemctl status telegraf -l (is important to have the status and you could observe if something is not ok, but it will be possible to have a parameter inside telegraf.conf to set if someone wants to have the changes on the fly?).

3). The syntax of telegraf.conf is checked every time and there could be observed the issues in most of the cases after a restart or maybe a test but is another way to test the syntax of the config file?

  1. Sorry I don’t understand, can you explain in more detail what you mean?
  2. You can send Telegraf a SIGHUP to have it reload the configuration, systemd can do this for you with systemctl reload telegraf.
  3. There isn’t an option that only checks the configuration, but you can run telegraf --test to load the config and check the inputs. No data is sent to the outputs when using this option.
1 Like

1. To have a status metrics for [[inputs.internal]] like for [[inputs.elasticsearch]] to see when telegraf is Up/Down/etc.
In order to use a status panel to have the telegraf status in grafana if i don’t use kapacitor.

Ex: [[inputs.elasticsearch]]
Status mappings
When reporting health (green/yellow/red), additional field status_code is reported.
Field contains mapping from status:string to status_code:int with following rules:
green - 1
yellow - 2
red - 3
unknown - 0

2. OK thank you.
3. OK thank you,
I’ve already tested and know this aspect. I’ve thinked that there is another way or something related.

I prefer to keep the fields at a lower level: instead of checking if Telegraf is green/yellow/red it is better to check if Telegraf is writing metrics, gathering metrics, or dropping metrics. This prevents the situation where the “health” is green but nothing is working.

1 Like

Yes you are right, make sense, thank you.

My question was only to have a status for telegraf that is up and running and based on the status I’ll now that there is something wrong that I don’t have metrics (the telegraf.conf not properly configured let’s say).

Have a great day.