Thank you for the explanation.


> On Sep 1, 2020, at 1:50 PM, Brian Candler <[email protected]> wrote:
> 
> On Tuesday, 1 September 2020 21:42:39 UTC+1, Zhang Zhao wrote:
> What I needed is to display the “hostname” in the summary so that I can 
> extract the hostname on ServiceNow side. Is that possible?
> 
> 
> The group_left(x,y,z) means that the result gains labels x,y,z from the RHS 
> expression.  So you can use $labels.nodename in the alert template.
> 
> - alert: HostOutOfMemory
>       annotations:
>         message: |
>           Node memory is filling up (< 10% left)
>             VALUE = {{ $value }}
>         summary: Host out of memory (instance {{ $labels.instance }} nodename 
> {{ $labels.nodename }})
>       expr: |
>         (node_memory_MemAvailable_bytes{job="node-exporter-vm"} / 
> node_memory_MemTotal_bytes{job="node-exporter-vm"} * 100 < 10)
>         * on(instance) group_left(nodename) node_uname_info
>       for: 5m
>       labels:
>         inc: servicenow
>         severity: warning
> 
> Another option is to set meaningful "instance" labels at scrape time, so that 
> $labels.instance can be used directly in the alert without having to do a 
> join.
> https://www.robustperception.io/controlling-the-instance-label
>  <https://www.robustperception.io/controlling-the-instance-label>
> 
> 
> -- 
> 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] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/prometheus-users/524b4c00-910e-4d88-a222-6486a27b1b50o%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/prometheus-users/524b4c00-910e-4d88-a222-6486a27b1b50o%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
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/54D68577-64E4-4AB4-AAE0-5D69C09B8764%40gmail.com.

Reply via email to