Grafana Alert Message Custom

Hello, I’m Sampler808 (South Korea User)
We are building a monitoring system using Grafana’s alert message function.
Alert Code Query:“select numerator/denominator*100 from number”

However, in addition to the value for the threshold value, is it possible to express the value used in the calculation or the value exposed by separately querying the DB in alert_message?

As an example, 33.33 can be expressed as 100/300 * 100 → 33.33%
“33.33” → X
“33.33 (numerator: 100, denominator: 300)” → O
I want this type of data to be displayed in the alert

Thank You.

~ the grafana team

Hello,

One way to do it, is to include those in the select statement,

select
    cast(numerator as string) as numerator,
    cast(denominator as string) as denominator,
    numerator/denominator*100
from number

this will generate 2 labels named “numerator” and “denominator” which you can include in the alert’s description/summary using {{ $labels.numerator }}, …

*if you didn’t change the alert message template, they will be automatically shown in the labels section.

Or, retrieve each one with a query, and then include them using {{ $values.name_of_query }}.