Kapacitor: Ability to read env variables in tick scripts

Created on 23 Jun 2017  路  2Comments  路  Source: influxdata/kapacitor

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

preview

Most helpful comment

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.

All 2 comments

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.

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

phemmer picture phemmer  路  5Comments

rconn01 picture rconn01  路  6Comments

cheribral picture cheribral  路  8Comments

mgresser picture mgresser  路  4Comments

nathanielc picture nathanielc  路  4Comments