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"
stream
|from()
.measurement('df_value')
.groupBy('service', 'host')
|where(lambda: ("type_instance"=='used') AND ("type"=='percent_bytes') )
|window()
.period(10s)
.every(60s)
|alert()
.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" }}')
.stateChangesOnly()
.log('/tmp/kaplogs.log')
from the kaplogs I’m trying to figure out the schema:
"data":{"series":
[{"name":"df_value",
"tags":{"host":"jtest","service":""},
"columns":["time","instance","type","type_instance","value"],
"values":
[["2018-04-25T09:47:55.16516217Z","md2","percent_bytes","used",10.605381965637207],
["2018-04-25 T09:47:55.165168297Z","md1","percent_bytes","used",53.528602600097656],
["2018-04-25T09:47:55.1651733Z","loop0","percent_bytes","used",12.638008117675781],
["2018-04-25T09:47:55.165177132Z","loop1","percent_bytes","used",12.638008117675781],
["2018-04-25T09:47:55.165180713Z","loop2","percent_bytes","used",12.6380081 17675781],
["2018-04-25T09:48:05.165102085Z","md2","percent_bytes","used",10.605381965637207],
["2018-04-25T09:48:05.165106154Z","md1","percent_bytes","used",5