I added it to the Description and I’m getting the message below:
- description = The disks are almost full for the applications below:
<no value> - <no value> - %!f(<nil>)%
<no value> - <no value> - %!f(<nil>)%
I also tried looping the values and didn’t work. Like:
{{ range .Value}}<strong>{{ .Name }}</strong>: {{ .Value }} {{ end }}
{{ range .Value}}<strong>{{ $labels.host.name }}</strong>: {{ .Value }} {{ end }}
{{ range .Labels}}<strong>{{ .Name }}</strong>: {{ .Value }} {{ end }}
A loop was going to work better in my case because the number of values varies. I was trying to get a specific item first because it will be helpful in other situations. However, I couldn’t get the values in both cases.
I think the problem may be due the fact that you have a dot ( . ) in the label names. Can you try the same thing with but a label like “hostname” (instead of “host.name”)?
Hello
New to the new alerting system - we have tons of alerts and i really dislike the new output
How can we make it print only the relevant alerting label?
Is there a way to control how the alerts are being migrated to the unified alerting system? (we have hundreds of legacy alerts on grafana 8)
I was using this templating with GO range but since latest version, new alerting format has 2 expressions: B is a reduce (get single value from query) and C is a threshold (evaluates B).
This format is mandatory for managing silence correctly but as a result, the alert template issues value for both queries for each alerts which is not convenient.
However, using variables in the format {{ $labels.instance }} became possible again (because labels are the same between the 2 expressions.
To get value from var='B', simply use this format {{ $values.B }}.
Configure an Alert Notification Channel: Set up a notification channel in Grafana that sends alerts to a webhook or external service. Grafana supports various notification channels, and you can choose one that fits your needs.
Create a Script or Service: Develop a script or a small service that receives the alert data, performs the necessary transformations, and sends the formatted message to the desired destination. This script could be written in a language of your choice (e.g., Python, JavaScript).
Update Grafana Notification Channel: Update the Grafana notification channel settings to use the webhook or external service created in step 2.
Format the Message: In your script or service, parse the incoming data, extract the relevant information, and format the message according to your requirements.
Without knowing the specific tools and services you have in your environment, it’s challenging to provide a detailed solution. However, this approach should give you the flexibility to format alert messages as needed.