Is it possible to achieve something like the following?
Currently i have a web console that will let me define alerts in Kapacitor (it not chronograf, its custom) I’m using templates and setting some template variables.
We’ve built our console in a way so that when we select the hosts a new alert is defined for each host. When we define an alert we apply it to a group of hosts. An example being I have 3 SQL servers. I monitor these for memory consumption. I group these 3 servers together and apply my alert template. so we would end up with
What happens now is an alert is generated for EVERY server that is sending in memory usage statistics whether it was selected or not - not so good when i only need those 3 hosts to use the script.
What I’d like to know is how i can include the “host” variable as part of my whereFilter ? i know i can include the variables and values using string concatination but I’m not sure how to use them in the whereFilter.
Normally we would manually add the host names to the whereFilter however we’re trying to build a dynamic way to define and manage our alerts so would like to avoid having to type in the host names into each alert.
I’d want something like this
var host_variable lambda
var whereFilter = lambda: (“vmname” == host_variable)
Is it possible to include variables in this way?