-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add documentation about how to send alerts from Grafana be e-mail
- Loading branch information
1 parent
f7da8c0
commit 191de96
Showing
9 changed files
with
117 additions
and
1 deletion.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,7 +46,7 @@ Monitoring topics | |
----------------- | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
grafana | ||
exploring-logs | ||
receive-alerts-by-email |
116 changes: 116 additions & 0 deletions
116
docs/source/reference/monitoring/receive-alerts-by-email.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
.. _receive-alerts-by-email: | ||
|
||
Receive Alert By Email | ||
====================== | ||
|
||
This guide will walk you through the steps to configure Grafana to send email notifications when an alert is triggered on your dashboard. This process involves modifying configuration files and setting up an SMTP server to handle the outgoing emails. | ||
|
||
Copy the grafana.ini File from Docker Container | ||
----------------------------------------------- | ||
First, you need to extract the grafana.ini configuration file from your Grafana Docker container to your local system. For example: | ||
|
||
.. code-block:: bash | ||
docker cp grafana:/etc/grafana/grafana.ini /your-local-directory | ||
This command copies the grafana.ini file from the Docker container to your local machine for editing. | ||
|
||
Modify the grafana.ini File | ||
--------------------------- | ||
|
||
Open the grafana.ini file you just copied in a text editor and locate the [smtp] section. You will need to enable SMTP and configure it to use your email provider's SMTP server. Here’s how you can configure it for an email account: | ||
|
||
.. image:: ../../_static/smtp\ configuration.png | ||
:width: 800px | ||
:alt: smtp configuration | ||
:align: center | ||
|
||
.. note:: | ||
|
||
The password used in the grafana.ini SMTP configuration is not your regular email account password. | ||
Detailed descriptions are provided at the bottom of this page. | ||
|
||
Mount the Modified grafana.ini File to the Grafana Container | ||
------------------------------------------------------------ | ||
You now need to ensure that your modified grafana.ini file is used by Grafana inside the Docker container. To do this, update the docker-compose-monitoring.yml file to mount the local grafana.ini file into the container: | ||
|
||
.. image:: ../../_static/mount\ grafana.ini.png | ||
:width: 800px | ||
:alt: mount grafana | ||
:align: center | ||
|
||
This line tells Docker to use the local version of grafana.ini when starting the Grafana container. | ||
|
||
Restart wis2box to Apply Changes | ||
-------------------------------- | ||
For the changes to take effect, restart your wis2box environment: | ||
|
||
.. code-block:: bash | ||
python3 wis2box-ctl.py restart | ||
This command stops and then restarts your containers, ensuring that the new configuration is loaded. | ||
|
||
Set Up the Notification Channel in Grafana | ||
------------------------------------------ | ||
Log in to Grafana with your admin credentials: | ||
|
||
(1) Navigate to Alerting -> Notification channels. | ||
|
||
(2) Click Add channel and choose Email as the notification type. | ||
|
||
.. image:: ../../_static/add\ channel.png | ||
:width: 800px | ||
:alt: add channel | ||
:align: center | ||
|
||
Enter your email address in the appropriate field and save the notification channel. | ||
|
||
.. image:: ../../_static/notification\ channel\ detail.png | ||
:width: 800px | ||
:alt: notification channel detail | ||
:align: center | ||
|
||
Configure Alerts in Your Grafana Dashboard | ||
------------------------------------------ | ||
Now, set up alerts within your Grafana dashboard: | ||
|
||
(1) Open the dashboard where you want to add an alert. | ||
|
||
(2) Go to the panel where you want to add the alert and click on the Alert tab. | ||
|
||
(3) Set your alert conditions, then under Notifications, select the email notification channel you configured earlier. | ||
|
||
(4) Click Apply and save the dashboard. | ||
|
||
(5) Export and save the updated dashboard JSON to ensure the changes are persistent. | ||
|
||
.. image:: ../../_static/add\ alert\ notification.png | ||
:width: 800px | ||
:alt: add alert notification | ||
:align: center | ||
|
||
Final Step: Test the Setup | ||
-------------------------- | ||
After setting everything up, trigger an alert in your Grafana dashboard to test if the email notifications are working. You should receive an email when the alert conditions are met. | ||
|
||
.. image:: ../../_static/receive\ alert\ email.png | ||
:width: 800px | ||
:alt: receive alert email | ||
:align: center | ||
|
||
.. note:: | ||
The most challenging part of this setup is obtaining the correct SMTP password. Here’s how to do it for different email providers: | ||
|
||
For Gmail: | ||
|
||
(1) Enable Less Secure Apps: If you don't use 2FA, enable "Less secure app access" in your Google account settings. | ||
(2) Generate an App Password: If you use 2FA: | ||
(3) Go to your Google Account -> Security -> App passwords. | ||
(4) Generate a new app password for "Mail". | ||
(5) Use this app password in the grafana.ini password field. | ||
|
||
For WMO Email or Other Providers: | ||
|
||
(1) Check Provider Documentation: Different providers have different methods for generating app passwords or enabling SMTP. | ||
(2) Contact IT Support: If you're using a corporate email (like WMO email), contact your IT department to get the correct SMTP settings and password. | ||
|