I have a variable env and I want to get it in telegraf. I use [[inputs.exec]]
My code:
[[inputs.exec]]
commands = ["echo $val_env"]
data_format = "value"
data_type = "string"
name_override = "value_A"
But I can't get this value $val_env. I also test another way such as [echo "${val_env}"]
or ["$val_env"]
, ... but as same.
How I can get value variable env in commands [[input.exec]]
telegraf.
The variable
val_env
has to be exported to the environment that is runningtelegraf
.Here's an example, with most of the noise removed for brevity, and I've added to my config exactly what you described: