failed to realize reduce context from fields

I have the following tick

stream
|from()
.measurement(‘load_avg_five’)
.groupBy(‘host’)
|window()
.period(5m)
.every(1m)
|mean(‘load_avg_five’)
|alert()
.message(’{{ .Level}}: {{ .Name }}/{{ index .Tags “host” }} has high cpu load: {{ index .Fields “value” }}’)
.warn(lambda: “mean” > 2)
.crit(lambda: “mean” > 3)
.log(’/tmp/kap.log’)

when trying to get it to alarm ( i generate a bunch of load on the system the alarm never triggers. I do get the following error in the log

ts=2018-02-15T18:09:07.666Z lvl=error msg=“failed to realize reduce context from fields” service=kapacitor task_master=main task=test node=mean3 err=“field “load_avg_five” missing from point”

my data is being logged every 10 seconds and indeed i do not have a data point there

select * from statsd.shortterm.load_avg_five where “host” = ‘xx-xx-xx-xx-00’

2018-02-15T18:08:58Z xx-xx-xx-xx-00 load-metrics 5.98
2018-02-15T18:09:09Z xx-xx-xx-xx-00 load-metrics 5.98

I am seeing data for the task

digraph test {
graph [throughput=“0.00 points/s”];

stream0 [avg_exec_time_ns=“0s” errors=“0” working_cardinality=“0” ];
stream0 -> from1 [processed=“469”];

from1 [avg_exec_time_ns=“4.801µs” errors=“0” working_cardinality=“0” ];
from1 -> window2 [processed=“469”];

window2 [avg_exec_time_ns=“2.394µs” errors=“0” working_cardinality=“7” ];
window2 -> mean3 [processed=“75”];

mean3 [avg_exec_time_ns=“10.688µs” errors=“1830” working_cardinality=“7” ];
mean3 -> alert4 [processed=“0”];

alert4 [alerts_triggered=“0” avg_exec_time_ns=“0s” crits_triggered=“0” errors=“0” infos_triggered=“0” oks_triggered=“0” warns_triggered=“0” working_cardinality=“0” ];
}

  1. why does it expect that data to be there
  2. why does this not alert ?

cheers
rob

If i watch the task i get the following error
ts=2018-02-19T15:52:44.261Z lvl=error msg=“error evaluating expression for level” service=kapacitor task_master=main task=test node=alert3 err=“left reference value “load_avg_five” is missing value” level=CRITICAL

but it certainly has the value:
time host metric value
---- ---- ------ -----
1518481825000000000 tf-p-ubu-stasd-00 load-metrics 0.01

Hi,

I would try to add the .as after the mean extraction, as:
mean(‘load_avg_size’)
.as(‘mean’)

I Guess os not taking the field you want…

Hope this helps!