kapacitor icon indicating copy to clipboard operation
kapacitor copied to clipboard

can kapacitor tickscript read bash environment variable?

Open robertchen opened this issue 7 years ago • 4 comments

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, I think this is the basic requirement for any alerting system, zabbix, cacti, nagios can read environment variable very easily.

Thanks.

robertchen avatar Jan 16 '18 19:01 robertchen

hey @robertchen,

what you're doing there would most likely just send the host where kapacitor is running on, which i assume is not what you want? if you want to send the host that is actually having that alert, you could have the hostname as a tag in your influx. we use this {{ index .Tags "host" }}. or if you actually want the hostname of that kapacitor-node, i'm assuming you have a bunch and you are probably using configuration management to deploy all that. using that you could already create the static entry for this .tick-file.

andreasnuesslein avatar Jan 22 '18 09:01 andreasnuesslein

Any solution for this? We have alerts coming into Slack from Kapacitor instances and would like to identify which one sent it. The host is not part of the data scheme and is only relevant during alerting.

hraftery avatar Sep 10 '18 22:09 hraftery

Hey @hraftery, Did you get any solution for this?

mustaqeem avatar Jul 01 '21 14:07 mustaqeem

@mustaqeem from what I can see, no, we just gave up. Best I came up with was to change the tick script by hand on each server, but it doesn't look like I ended up bothering.

hraftery avatar Jul 01 '21 22:07 hraftery