Kapacitor sideload with path names as keys?




I’m looking into the sideload feature of tickscript, may be someone has experience here?

I want to alert on disk usage with different thresholds per host/path.

The script looks like:

var data = stream
        .groupBy(['path', 'host'])
    |eval(lambda: "used_percent")

var trigger = data
        .field('disk_used_info', 70.0)
        .field('disk_used_warn', 85.0)
        .field('disk_used_crit', 95.0)
        .info(lambda: "value" > "disk_used_info")
        .warn(lambda: "value" > "disk_used_warn")
        .crit(lambda: "value" > "disk_used_crit")

Now the issue is, I can define thresholds per host, but I cannot figure out how to store thresholds per path.
It would be logical to have an include like


but as “path” contains slashes this won’t work.

It would also be nice to have nested structs inside the yml files like

  warn: 80
  crit: 90

but it looks like the files need to be flat.

Managing kapacitor alerts at scale

I’ve found a solution^whack:

.order('{{.host}}/disk_{{ urlquery .path }}.yml')

This will urlescape the path, hence something like “disk_%2F.yml” will match for “/”.


This is exactly what I’ve been trying to do. Could you share your entire tickscript? And an example of the content of one of the sideloaded files?