Customize Grafana alert emails

Поделиться
HTML-код
  • Опубликовано: 4 ноя 2024

Комментарии • 22

  • @johnsimpledimple
    @johnsimpledimple 14 дней назад +1

    Thanks for making these--there is not great documentation on this tool and its a great tool.

  • @saiteja-td1zk
    @saiteja-td1zk 5 месяцев назад +1

    Hey, thank you so much for creating this video, it was very helpful 😊
    I have few questions though,
    1.If we use docker or kubernetes how can we customize the html file
    2. Is there anyway to create notification template and directly use that in contact point instead of pasting the content in message field of contact point

    • @learningsoftwareskills
      @learningsoftwareskills  5 месяцев назад

      Hi, thanks for the feedback.
      1. Grafana does not officially want you to change the ng_alert_notification.html in grafana\public\emails\ folder location. So, using a Dockerfile you can build an image on top of grafana-oss docker image and replace the ng_alert_notification.html file at the required folder location, since the docker image is just an alpine Linux instance with a file system under the hood.
      2. I understand that you do not want to automate the contact point message field. There might be a way to do that using some official Grafana APIs, but I suggest using the approach mentioned in point 1, which can make automation way much easy.
      Write back when u solve this issue.
      Hope this helps, cheers 👍

  • @multiplewaya-qk7uq
    @multiplewaya-qk7uq 2 месяца назад +1

    one of the best video on this topic

  • @lokeshvenkatesan
    @lokeshvenkatesan Месяц назад +1

    Guess what, I have been searching for this kind of explainer for almost an year now.

  • @koushik4531
    @koushik4531 5 месяцев назад +1

    Hey Thanks for this awsome video.
    I had scenario where we need to customize an email subject. So that if an eler had triggered it should display FIRED:. If elert got resolved then in email it should display RESOLVED:
    I was trying since long time but no luck I was getting output like after certain time during triggering It was giving complete set like "RESOLVED: test-rule2 FIRED: test-rule2 RESOLVED: test-rule2 RESOLVED: test-rule2 FIRED: test-rule2 FIRED: test-rule2 "

    • @learningsoftwareskills
      @learningsoftwareskills  4 месяца назад

      Hi, you can customize the subject as
      {{ .Status | toUpper}} : {{ (index .Alerts 0).Labels.alertname}}
      Here I am using only the first alert assuming one alert is fired every time.
      Hope this helps, cheers 👍
      Links:
      grafana.com/docs/grafana/latest/alerting/configure-notifications/template-notifications/create-notification-templates/#template-the-subject-of-an-email

  • @PurimetlaAkhil
    @PurimetlaAkhil Месяц назад

    Hi @learningsoftware
    Can you please share the customise email template file which you have removed logo and buttons it would really helpful for me. I checked in your blog haven’t found it. Please can you share the template. Thanks in advance

  • @shyam8999
    @shyam8999 3 месяца назад +1

    Thanks for this video.

  • @shrikantdhumal1505
    @shrikantdhumal1505 5 месяцев назад +1

    Can I use the same template for Microsoft Teams notifications?

    • @learningsoftwareskills
      @learningsoftwareskills  5 месяцев назад

      Hi, i will try to find out and revert back, cheers 👍

    • @shrikantdhumal1505
      @shrikantdhumal1505 5 месяцев назад +1

      @@learningsoftwareskills HI, Thanks for the response. Please let me know.

  • @CSEBHARATHS
    @CSEBHARATHS 4 месяца назад +1

    hey dude, I trying to alert the error my project , My doubt is that can i customize that too ? I mean i need to add the log itself in the Alert. How can i do that ?

    • @learningsoftwareskills
      @learningsoftwareskills  4 месяца назад

      Hii, as far as I know, only numeric values can be added in the alert messages.
      So, I think you can't render a log in the alert.

    • @CSEBHARATHS
      @CSEBHARATHS 4 месяца назад

      @@learningsoftwareskills Thanks Bro, But can i Access a some filed of my log by referring the label name ?

    • @CSEBHARATHS
      @CSEBHARATHS 4 месяца назад

      @@learningsoftwareskills
      {{ range .Alerts }}
      Status: {{ .Status }}
      Starts at: {{ .StartsAt }}
      Name: {{ .Labels.alertname }}

      Values:
      start
      Case ID: {{ .Annotations.caseidvalue }}
      Service Name: {{ .Annotations.servicenamevalue }}
      {{ range $refID, $value := .Values }}
      inside
      {{ $refID }}={{ $value }}
      {{ end }}
      {{ $labels }}
      end
      {{ end }}
      This is Try to do
      but i cannot get the value of "caseidvalue" and "servicenamevalue"
      Are you have any idea on this ?

    • @CSEBHARATHS
      @CSEBHARATHS 4 месяца назад

      @@learningsoftwareskillsThis is i try to do
      {{ range .Alerts }}
      Status: {{ .Status }}
      Starts at: {{ .StartsAt }}
      Name: {{ .Labels.alertname }}

      Values:
      start
      Case ID: {{ .Annotations.caseidvalue }}
      Service Name: {{ .Annotations.servicenamevalue }}
      {{ range $refID, $value := .Values }}
      inside
      {{ $refID }}={{ $value }}
      {{ end }}
      {{ $labels }}
      end
      {{ end }}
      To fetch the value form live logs of caseidvalue,servicenamevalue
      can i do it ?

  • @hamdijedidi6375
    @hamdijedidi6375 3 месяца назад

    hello sir
    hello please could u help me
    I'm customizing a Grafana template and I want to include the alert value in the description field. I tried using the following code, but it doesn’t seem to work:
    {{ range .Alerts }}
    Name: {{ .Labels.alertname }}
    Status: {{ .Status }}
    Description: The {{ .Labels.alertname }} = {{ $value }}
    {{ end }}