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 "
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
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
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
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 👍
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 ?
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 ?
@@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 ?
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 }}
Thanks for making these--there is not great documentation on this tool and its a great tool.
Thank you for the encouraging feedback 👍🙏
one of the best video on this topic
@@multiplewaya-qk7uq thank you for the awesome feedback 👍🙏
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 "
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
Thanks for this video.
@@shyam8999 you are welcome 🙏👍
Guess what, I have been searching for this kind of explainer for almost an year now.
Thank you 👍
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
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
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 👍
Can I use the same template for Microsoft Teams notifications?
Hi, i will try to find out and revert back, cheers 👍
@@learningsoftwareskills HI, Thanks for the response. Please let me know.
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 ?
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.
@@learningsoftwareskills Thanks Bro, But can i Access a some filed of my log by referring the label name ?
@@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 ?
@@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 ?
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 }}