Newline in Alert description

38 views
Skip to first unread message

Guna Kambalimath

unread,
Nov 25, 2020, 11:04:43 PM11/25/20
to Prometheus Users
Hello,

I have my alert configuration written like the following:

- name: pod-status
    groups:
      - name: pod not in expected state
        rules:
          - alert: microservice_status_alert
            expr: kube_pod_container_status_running == 0
            for: 2m
            labels:
              severity: critical
            annotations:
              description: "microservice {{ $labels.container }} is not running.\nPod: {{ $labels.pod }}.\nInstance: {{ $labels.instance }}

Alert that I received on email looks like this:

Labels
alertname = microservice_restart_alert
cbacid = cbac1
Annotations
description = some microservice has restarted 3 times. Pod-name: some-5cb95695c-cpgvk. Instance: x.x.x.1:<port>

Question:
The new line "\n" given is not getting interpreted in mail received. I want description look like this:

description = some microservice has restarted 3 times 
Pod-name: some-5cb95695c-cpgvk.  
Instance: x.x.x.1:<port>

The above looks more neat. 

Please help with the same.

Thanks,
Guna



b.ca...@pobox.com

unread,
Nov 26, 2020, 3:28:44 AM11/26/20
to Prometheus Users
Is it a HTML mail?  Have you tried inspecting the HTML?  A newline in HTML doesn't render as a line break, except with certain CSS styles.
Reply all
Reply to author
Forward
0 new messages