On 26/02/2021 14:18, David Leadbeater wrote:
See
https://www.robustperception.io/using-time-series-as-alert-thresholds

On Fri, 26 Feb 2021 at 14:16, Andrew Kulikov <[email protected] <mailto:[email protected]>> wrote:

    Hi,

    I have, for example, simple alert for low swap:

    name: Low swap
    expr: swap_used_percent > 80
    for: 10m
    labels:
        severity: warning
    annotations:
        description: Swap usage is {{ $value | printf "%.2f" }}% on {{
    $labels.host }}
        summary: Low swap

    For some hosts it's normal to use 50% of swap, for other hosts --
    90% of swap. And I would like to define different thresholds for
    different hosts. Can I define per-host threshold for swap usage
    write alert expression like this?

    expr: swap_used_percent > {{ $swap_threshold }}

Alternatively instead of comparing against a fixed threshold (which needs periodic checks & adjustment) you can use the predict_linear function (https://prometheus.io/docs/prometheus/latest/querying/functions/#predict_linear) to project how long until all swap is used based on recent usage increases.

--
Stuart Clark

--
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/d4e25a05-0820-5744-444d-4f930edcb59a%40Jahingo.com.

Reply via email to