What I needed is to display the “hostname” in the summary so that I can extract 
the hostname on ServiceNow side. Is that possible?


- alert: HostOutOfMemory
      annotations:
        message: |
          Node memory is filling up (< 10% left)
            VALUE = {{ $value }}
        summary: Host out of memory (instance {{ $labels.instance }} 
group_left(nodename) node_uname_info{job="node-exporter-vm”})
      expr: node_memory_MemAvailable_bytes {job="node-exporter-vm"} / 
node_memory_MemTotal_bytes{job="node-exporter-vm"}
        * 100 < 10
      for: 5m
      labels:
        inc: servicenow
        severity: warning

> On Sep 1, 2020, at 1:30 PM, Brian Candler <[email protected]> wrote:
> 
> On Tuesday, 1 September 2020 21:02:26 UTC+1, Zhang Zhao wrote:
> I added the group_left below as highlighted. However, it didn’t work as 
> expected in the output. Any advice where was wrong?
> summary: Host out of memory (instance {{ $labels.instance }} 
> group_left(nodename) node_uname_info{job="node-exporter-vm”})
> 
> 
> I don't know what you did, but the entire PromQL expression (including 
> group_left) goes in the "expr:" part of your alerting rule, not in the 
> template.
> 
> You need to use a binary operator and join on a common label, usually 
> "instance".  Something like:
> 
> groups:
> - name: UpDown
>   rules:
>   - alert: UpDown
>     expr: (up == 0) * on (instance) group_left(domainname,nodename,sysname) 
> node_uname_info
> 
> 
> -- 
> 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/643284d8-1be6-441f-86d2-88f390fcf753o%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/prometheus-users/643284d8-1be6-441f-86d2-88f390fcf753o%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/04E95EC4-0E5B-4874-B940-365AD94D72D2%40gmail.com.

Reply via email to