kapacitor icon indicating copy to clipboard operation
kapacitor copied to clipboard

Ability to read env variables in tick scripts

Open rconn01 opened this issue 7 years ago • 2 comments

This may be available already but I couldn't find it documented anywhere on how to do it.

It would be great if there was a way for tick scripts to read env variables. The immediate use case here is for providing a link to a dashboard in an alert message. I would like to be able to pull the dashboard host from a env variable. This way we can deploy the same kapacitor alerts across all our envs

rconn01 avatar Jun 23 '17 18:06 rconn01

same here, unbelievable if it is not supported as I think this is the basic requirement for any alerting system, zabbix, cacti, nagios can read environment variable very easily.

var message = ' nginx active connections is in {{.Level}}, value is {{ index .Fields "value" }} from $HOST'

I want to send alert with $HOST so that we know where is the alert coming from,

Thanks.

robertchen avatar Jan 16 '18 20:01 robertchen

agree this would be useful. @robertchen, as a workaround for your message issue, you should be able to say something like {{ index .Tags "host" }} in the message for most measurements. See https://docs.influxdata.com/kapacitor/v1.4/tick/syntax/#string-templates

russorat avatar Apr 03 '18 22:04 russorat