What should be done for Mail notification should NOT be sent when No data or null values are there, It should send only when it satisfies the condition

what should be done for Mail notification should not be sent when No data or null values are there, It should send only when it satisfies the condition?
The Mails are triggering when No data is there, I want only “Alerting” mails that to only when given condition is satisfied means when threshold is breached. Please help

For every alert, set the “if no data or all values are null” value to Keep Last State.

Thank you so much for replying :slightly_smiling_face:
After doing this as above, It will not affect in triggering Email notification when threshold is breached(like when given condition is met) right?
My requirement is send Email notification only when threshold is breached.
It should not trigger Email notification saying “OK” or “No Data” , It should only trigger Email notification saying “Alerting” when threshold is breached(given Condition is met).
Please help

After doing the above, you’ll be notified when the threshold is breached and then again with an “OK” once the alarm stops firing. I don’t think you can turn off the OK email, but this will remove the “No data” emails.

You can turn off “OK” notifications by setting the “states” in your Notification
object. By default all states are acted upon, but you can select only the
ones you want.

See https://icinga.com/docs/icinga2/latest/doc/09-object-types/#notification
for details.

Antony.

Looks like it is not Grafana, It is “icinga”
I could not understand what is written in the link. It is some different monitoring tool.

@emiltullstedt, Mail Notification will be sent when threshold is breached. Why does it send “OK” mail? What is the reason behind it?
and also Please let me know if it is possible to turn off the OK email

I don’t know the rationale that was the reason for Grafana having OK notifications. Generally speaking, having them makes a lot of sense to me as the resolution of a problem is every bit as important as the occurrence of the same.

You can disable the OK messages by going to [your grafana URL]/alerting/notifications you can enable the Disable Resolve Message option, that should disable sending OK messages.

@emiltullstedt
Sure…Thank you so much for the answer :slight_smile: Below are my last Questions, Please help

  1. Is it possible to customize the States? Like “Resolved” in the place of “OK” ? when the condition’s output value goes back BELOW the threshold

  2. And also is below thing possible? Can we customize like:
    suppose if the condition is “if count is > 3” then State should show as “Warning”(instead of “Alerting”) in the Mail Notification and “if count is >= 5” then State should show as “Critical” (Instead of “Alerting”) in the Mail Notifications

  3. In the Message Body of a Email Notification Is it possible to show Time Range at which the threshold is breached (NOT like Image using Image Render)
    and also in the same Message body of Mail Notification is it possible to show some values which are coming as output from the Query.
    Basically I want to make Message body little dynamic ans show meaningful information in the Mail Notification.

Sorry, I don’t know the answer to any of that :slight_smile:

Ok Anyways Thanks for helping on other Questions :slight_smile:

Hi @rajeshmakam

to your question 2. as a workaround you could define a separate alerts for each threshold with different Names. Then the mail would look e.g. [Alerting] Warning, or [Alerting] Critical. It’s not a direct response to your question but a workaround that we use quite often.

@ogu,
Thanks for Reply :slight_smile:

Separate alert can not be done for the same panel right? So we should create 2 panels(same Panel twice) with 2 alerts(1 alert each)

@rajeshmakam

Correct. For lack of flexibility in the grafana alert system, we often have one dashboard neatly arranged with the graphs we like to show and one dashboard with the graphs to generate the needed alerts.

Ok Thank you @ogu

Could you please help me on my 1st and 3rd Questions too if you know

AFAIK these two questions can only be solved by touching code.
The email templates are stored in /usr/share/grafana/public/emails/.
Theoretically you can modify them to your needs, but personally I have never done that, so I don’t know how well it works.
If you try it, it would be nice if you could share your findings here.