How to group by column returned from collectd via influx in Kapacitor?

My collectd is sending data to influx. I’m trying to use Kapacitor for alerting.

I’m having a hard time with tick scripts and information dimensions. It seems that right now kapacitor is lumping together different drives which are above and below a threshold so I get constant notifications back and forth.

I assume I want to group by the instance in the column but I can’t figure out how to do it.

Aside from this specific problem I would really appreciate some Kapacitor examples form collectd data.

Thanks a lot!

This is my tick script:

// simple drive space
dbrp "collectd"."six_weeks"

      .groupBy('service', 'host')
	|where(lambda: ("type_instance"=='used') AND ("type"=='percent_bytes') )

       .info(lambda: "value" > 50)
       .warn(lambda: "value" > 70)
       .crit(lambda: "value" > 80)
       .id('{{ index .Tags "service" }}/{{ index .Tags "host" }}')
       .message('{{ .Level}} - Drive space % free {{ .Name }} on {{ .ID }} is value:  {{ index .Fields "value" }}')

from the kaplogs I’m trying to figure out the schema:


["2018-04-25 T09:47:55.165168297Z","md1","percent_bytes","used",53.528602600097656],

["2018-04-25T09:47:55.165180713Z","loop2","percent_bytes","used",12.6380081 17675781],