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.
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.
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:
In Expressions, configure:
In Set evaluation behavior, create a folder by clicking on + New folder and a group by clicking on + New evaluation group.
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%.
Checking the alert, note that it was triggered.
Now, checking the email inbox, we have the notification.
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.
In Expressions, configure as follows:
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