First off thanks for reposting the question here.

Saying you want to trigger an alert when `used_percent` is above 95% for 
more than 5 minutes is the same as saying that the minimum value for the 
last 5 min is greater than 95%.

stream
        |from()
                .measurement('mem')
                .groupBy('host')
        |window()
             // keep the most recent 5m of data
            .period(5m)
             // Every minute emit the last 5 minutes of data to check if the 
min is greater than 95
             // this could be any value, depending on how often you want to 
recheck the window.
            .every(1m)
        |min('used_percent')
            .as('used_percent')
        |alert()
                .id('{{index .Tags "host" }} memory utilization')
                .message('{{ .ID }} is {{ .Level }} value:{{ index .Fields 
"used_percent" }}')
                .crit(lambda: "used_percent" > 95)
                .stateChangesOnly()
                .log('/tmp/alerts.log')



Hope that helps.

On Monday, August 1, 2016 at 11:53:50 AM UTC-6, [email protected] wrote:
>
> What should I add to this definition so that the critical alert gets 
> triggered when the 'used_percent' is above 95 % *for more than 5 minutes*?
>
> Thanks!
>
> stream
>         |from()
>                 .measurement('mem')
>                 .groupBy('host')
>         |alert()
>                 .id('{{index .Tags "host" }} memory utilization')
>                 .message('{{ .ID }} is {{ .Level }} value:{{ index .Fields 
> "used_percent" }}')
>                 .crit(lambda: "used_percent" > 95)
>                 .stateChangesOnly()
>                 .log('/tmp/alerts.log')
>
>

-- 
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/ad5d86d3-21e3-450b-b92c-1fe8b7f5430d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to