Kapacitor TICKScript "Map" type


#1

Does TICKScript have anything like a “map” or “dict” type from other languages? My use-case is that we have several background job queues (“high”, “default”, “low” and a few others), and I’d like to have different alert thresholds for each. As far as I can tell, right now I have to create separate scripts for each queue name, or a template with a yml that enumerates every queue.

Right now, from the chronograf builder, I have a script that looks like:

crit = 150
// ...
var trigger = data
    |alert()
        .crit(lambda: "value" > crit)

What I’d ideally like to do is:

thresholds = {
  low: 1000,
  high: 50
}
// ...
var trigger = data
    |alert()
        .crit(lambda: "value" > thresholds[queue_name] || 150)

I’m using influxcloud with the included kapacitor, so I’m not even sure I have access to the API needed to use templates or even write a script to create all those TICKscripts.


#2

I also wanna know this, it would be a great feature :slight_smile: