Grafana Alerts How to Create

imagem alerting in grafana

In this article, we will configure Grafana alerts. In the previous articles, we performed the installation and creation of monitors. If you haven’t seen them yet, access the monitoring track to view all the articles.

To configure the alerts, first access the left menu and click on the Alerting option.

Click on the Contact point option.

In grafana-default-email, click on the pencil icon to edit.

configurações de email

Configure as follows and enter the email address in the addresses field where you want to receive notifications. You can click Test to receive a test email.

configuring grafana alerts

Go back to the left menu and select the Alert rules option.

Here you can create various types of Grafana alerts, but for this article, we will configure two alerts, one for when memory consumption exceeds 90% and another to monitor the expiration date of the site certificate.

Click on New alert rule.

Give it a title and configure Define query and alert condition as follows:

configuring new grafana alerts

In Expressions, configure:

exemplo de configuração de expressions para alertas

In Set evaluation behavior, create a folder by clicking on + New folder and a group by clicking on + New evaluation group.

configuring grafana alerts

Click Save rule and exit.

Now, by performing a stress test on the host machine and increasing memory consumption, we can test the alert.

Note in the graph how memory consumption exceeds 90%.

exemplo de visualização de consumo de memoria no gráfico

Checking the alert, note that it was triggered.

exemplo de visualização de alerta disparado

Now, checking the email inbox, we have the notification.

exemplo de email de alerta disparado

With the functional alert, just replicate it for the other monitored computers.

To finish, let’s create an alert to notify us when the site certificate is about to expire. Create a new alert and give it a name. Configure the query as follows and remember to set the math field value to /60/60/24.

configuring grafana alerts

In Expressions, configure as follows:

exemplo de configuração de expressions para alerta

Use the same settings as the first alert for the Set evaluation behavior section.

Done, when the number of days until the certificate expires is equal to 7, it will alert via email.

Access documentation clicking on this link

We have completed the implementation of monitoring with Grafana; we hope the articles have been useful to you. Follow other articles like this one; we have already set up an asset inventory service for companies available at this link, and there will be more articles with new solutions coming soon.

Leave a Reply

Your email address will not be published. Required fields are marked *