When ansible pushes out the telegraf.conf file, it sets the appropriate global_tags like
[global_tags]
server_env = “dev” (or “qa” or “prod”)
I would like to key off this tag in the kapacitor tickscript to set thresholds depending on the environment var. Something like:
var info_threshold = 65
var warn_threshold = 75
var crit_threshold = 85
if ({{ index .Tags "server_env"}} == "dev")
then
info_threshold = 75
warn_threshold = 85
crit_threshold = 95
elsif ({{ index .Tags "server_env"}} == "pro")
then
info_threshold = 65
warn_threshold = 75
crit_threshold = 85
fi
It would be nice to do things by hostname too:
if ({{ index .Tags "host"}} == "that_one_annoying_server_that_always_alerts.com")
then
info_threshold = 90
warn_threshold = 95
crit_threshold = 98
fi
Is this possible in a tickscript? I been searching for an hour or so and have not found anything yet.
Thanks!