Skip to main content

How to Setup Alerts in Grafana?


Here's a sample process on how to create an alert on Grafana:

1. Go to your desired graph where you wanted to add an alert.

2. Click Edit



3. Go to the Alert tab.

4. Click "Create Alert"

5. In the "Alert Config" section, change the following values:

a. Name - this will appear on the alert notification

b. Evaluate every - change this to 5s.

This means that the graph will update its data every 5 seconds.

c. For - change this to 0m (zero minutes)


6. Under Conditions, set the following:

a. When - click on "avg() to change to min().

There are also other options to choose from – depending on what you need.

b. Of - change to query(A,1h,now)

Query parameters:

1st parameter is the metric.

2nd parameter is the FROM value.

3rd parameter is the TO value.

This is the condition being set to validate metrics data.

c. Is Above - change this to "IS BELOW" and put the value "0.01".

There are also other options to choose from – depending on what you need.

We set 0.01 if we are to catch the metric value that would become zero.


7. If execution error or timeout, Set State to: "Keep Last State"


If there is a Grafana request or execution timeout, this will prompt an alert. Such as this:


8. Click "Test Rule" to check if the conditions you created are correct. Scroll down to see the results.
If the current condition holds "False", State is "ok".
Also, you can see within the arrays the metric values.


9. If everything is ok, click the Save icon found at the top.

Note:
Do NOT drag the heart metric condition because it will change your "Is Below" value.


You will know if a graph has an alert being set on it if you can see a heart on the left of the panel title.
Green indicates status is ok.
Red indicates status is not ok -- based on your alert condition.


Comments