Customize Grafana alert emails

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

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

  • @johnsimpledimple
    @johnsimpledimple 2 месяца назад +2

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

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

    one of the best video on this topic

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

    Thanks for this video.

  • @StartedAtSeven
    @StartedAtSeven 3 месяца назад +2

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

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

    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

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

    Very useful, I am trying to integrate with Splunk On-Call, so this will be useful. If you have done with Splunk On-Call, please create a video for future. Thank you.

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

    Can I use the same template for Microsoft Teams notifications?

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

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

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

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

    • @kabirbaghel8835
      @kabirbaghel8835 12 дней назад

      @@learningsoftwareskills Hi, any update on teams?

  • @CSEBHARATHS
    @CSEBHARATHS 6 месяцев назад +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  6 месяцев назад

      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 6 месяцев назад

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

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

      @@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 6 месяцев назад

      @@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 ?

  • @koushik4531
    @koushik4531 7 месяцев назад +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  7 месяцев назад

      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

  • @saiteja-td1zk
    @saiteja-td1zk 7 месяцев назад +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  7 месяцев назад

      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 👍

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

    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 }}