When passing a window to an selector function like max, only a single point 
is returned, aka the maximum value. So keeping the original "usage_idle" no 
longer makes sense. 

If you simply want all points in a window to match the alert criteria use 
`.all()` on the alert node.

For example

var stats = stream
    |from()
        .database('monitoring')
        .measurement('cpu')
        .where(lambda: "cpu" == 'cpu-total')
    |groupBy('project', 'roles', 'stage', 'host')
    |window()
        .period(4m)
        .every(1m)
       |alert()
      .crit("usage_idle" < 30)
      .all()



On Wednesday, July 27, 2016 at 7:11:25 AM UTC-6, Carlos Peñas wrote:
>
> I'm trying to "soften alerts" ensuring that all the points in a window are 
> above the warn/crit level:
>
> here's some of the code:
>
> var stats = stream
>     |from()
>         .database('monitoring')
>         .measurement('cpu')
>         .where(lambda: "cpu" == 'cpu-total')
>     |groupBy('project', 'roles', 'stage', 'host')
>     |window()
>         .period(4m)
>         .every(1m)
>     |max('usage_idle')
>         .as('max_usage_idle')
>
>
> Everything works fine (I think) but if I add a log() it seems that the 
> original "usage_idle" disappears
>
> [high_cpu:log5] 2016/07/27 10:28:00 E! WINDOW {cpu   host=foo,project=bar,
> roles=foo,bar=, [host project roles stage] map[host:foo project:bar roles:foo 
> stages:bar cpu:cpu-total] map[usage_softirq:0.008354916868605965 
> usage_system:0.06683933494884772 usage_user:0.22558275545293097 
> max_usage_idle:99.47364023737072 usage_nice:0 usage_iowait:
> 0.21722783858261527 usage_irq:0 usage_steal:0.008354916868605965 
> usage_guest:0 usage_guest_nice:0] 2016-07-27 10:28:00 +0000 UTC}
>
>
> This makes it a bit difficult to debug if actually all the previous points 
> meet certain criteria. 
>
> How do I keep current "usage_idle" ?  (I'm using kapacitor beta)
>
>
>

-- 
Remember to include the InfluxDB version number with all issue reports
--- 
You received this message because you are subscribed to the Google Groups 
"InfluxDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/influxdb.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/influxdb/03c2a9e3-0967-43ff-bf67-90f1811df3f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to