Hey
could you please show us the actual emoji you used in your alert code?
Hey
could you please show us the actual emoji you used in your alert code?
Hi @yosiasz
I used like below.
{{ range .Alerts }} PMM | {{ .Labels.severity}} | {{ .Labels.node_name}} | {{ .Annotations.summary }}
Hi @yosiasz
Is it correct way I am using the emoji or any changes needed to get actual emoji color in the mail subject?
Honestly I am not sure. one way it to try things by process of elimination. try to send alerts to something else like slack or teams or telegram
If it does not function well in these then it could be grafana alerts itself.
Sure @yosiasz
Thanks for the help.
Hello @simpres99, and thank you for hearing us. Regarding collecting feedback on the documentation, that sounds like a great idea â instead of you having to hunt through dozens of posts. Please let us know how you would like us to provide what you need. Perhaps a dedicated forum under Alerting? However we can help, we will.
Oops, DMâd the wrong person. @georgerobinson, pls see above.
How can I get Label values in the new line?
{{ define âemail.bodyâ }}
{{- range .Alerts -}}
{{ if gt (len .Annotations) 0 }}
Summary: {{ .Annotations.summary }}
Description: {{ .Annotations.description }}
Labels:
{{ range .Labels.SortedPairs }} {{ if or (eq .Name âENVâ) (eq .Name âAPP_TYPEâ) }} ⢠{{ .Name }}: {{ .Value }}
{{ end }}{{ end }}
{{ end }}
{{ end }}
{{ end }}
I am using the above code but I am getting the output like this.
Summary: MariaDB Repl Lag is 4104 Secs Behind for C-DEV4-RO Description: MariaDB Slave is Lagging Behind Of 4104 Seconds From http://test402.test.com to test404: C-DEV4-RO Labels: ⢠APP_TYPE: DEV_ALL_TRACKS ⢠ENV: C-STACK-DEV
But I want output like below.
Summary: MariaDB Repl Lag is 4104 Secs Behind for C-DEV4-RO
Description: MariaDB Slave is Lagging Behind Of 4104 Seconds From http://test402.test.com to test404: C-DEV4-RO
Labels:
â˘APP_TYPE: DEV_ALL_TRACKS
⢠ENV: C-STACK-DEV
@georgerobinson Can you please help me on the above?
Hi! What about the something like this?
Labels:
{{ range .Labels.SortedPairs }}{{ if or (eq .Name "foo") (eq .Name "bar") -}}
- {{ .Name }}: {{ .Value }}
{{ end }}{{ end }}
@georgerobinson Yeah this looks good, let me try and update you on the same.
@georgerobinson Still I am not getting the same issue?
{{ define âemail.bodyâ }}
{{- range .Alerts -}}
{{ if gt (len .Annotations) 0 }}
Summary: {{ .Annotations.summary }}
Description: {{ .Annotations.description }}
Labels:
{{ range .Labels.SortedPairs }} {{ if or (eq .Name âENVâ) (eq .Name âAPP_TYPEâ) -}} - {{ .Name }}: {{ .Value }}
{{ end }}{{ end }}
{{ end }}
{{ end }}
{{ end }}
Hi! What email client is this?
@georgerobinson
Apologies for jumping in here, I have alerts + image rendering to S3 + notifications to teams with images all working (and deployed via helm). Its taken a week and 100âs of searches but I got thereâŚ
The final hurdle is making the messages pretty and as noted in this thread, the template documentation is not very clear⌠Iâm copy/pasting/editing bits of the the default template:
into my own template but canât figure out what part is responsible for the image?
Can you help?
Thanks,
Tom
Its a Microsoft Office Outlook.
Hi Tom! Images are added to notifications after templating as its difficult to provide a consistent templating experience for images given the varied contact points supported in Grafana. This is something we could reconsider, but it would be good to know what kind of problem youâre looking to solve and whether it would be possible with templates.
Its a Microsoft Office Outlook.
Hi @georgerobinson ,
Thanks for the reply.
Thats useful info - I think the template I was playing with sometimes contained errors which caused screenshots to go missing, leading me to think it was a function of the template. I was trying to have some text below the image, but its entirely cosmetic.
Back to the main topic of this thread, I think we need more documentaion around converting json from the alert-api into a configmap or equivalent that can be used to provision alerts.
For example, if I create an alert-rule in the UI (v9.3.1), and then get it via the api:
curl -XGET http://some:password@somegrafana/api/v1/provisioning/alert-rules/1jIgdlKVk | jq . > alert-rule.json
delete the original in the UI and then post back the json, I always get this error:
curl -XPOST http://some:password@somegrafana//api/v1/provisioning/alert-rules -d @alert-rule.json
{"message":"bad request data","traceID":""}
My thinking is that if I canât get the json to work via the api, it wonât work as a configmap with sidecar.
The example yaml given here is too simple:
and not all the json is adequately described by the api documentation,
for example, its not clear from âAlertQueryâ if this is required or not:
"datasource": {
"name": "Expression",
"type": "__expr__",
"uid": "__expr__"
},
As others have asked for, it would be nice if we could have an export function in the UI for alerts where similar to dashboards, you can put the json in the required directory/create a config map out of it for a sidecar, and it âjust worksâ!
Thanks,
Tom
Hi! Would it be possible to update Grafana to 9.3 as I recall there being a similar issue for line breaks in some email clients Newlines not being preserved in certain email clients ¡ Issue #53879 ¡ grafana/grafana ¡ GitHub.