Would you like to learn how to use configure Grafana Email Notification Setup? In this tutorial, we are going to show you how to configure a Grafana notification channel to send alert e-mails.

In our example, we are going to use Google Gmail as SMTP server.

• Ubuntu 18.04
• Ubuntu 19.04
• Grafana 6.0.2

What is Grafana?

Grafana is an open-source platform for data monitoring, analysis, and visualization that comes with a web server that allows it to be accessed from anywhere.

On the Web interface, users are able to create Grafana dashboards with panels to represent metrics over time.

Grafana Tutorial:

On this page, we offer quick access to a list of Grafana tutorials.

Tutorial – Gmail Integration

First, we need to enable your Gmail account to receive connections from external programs.

Open your browser and access your Gmail account.

In our example, the following URL was entered in the Browser:

http://gmail.google.com

On the login screen, enter your Gmail username and password.

Gmail account

After the login, you need to access the following URL:

• https://myaccount.google.com/lesssecureapps

Select the option to enable the use of less secure applications.

google less secure app

Now, we need to test if we can use the Linux command-line to send an email using Gmail.

Use the following command to install the required packages.

# sudo apt-get update
# sudo apt-get install ssmtp

Edit the ssmtp.conf file to connect to our Gmail account.

# vi /etc/ssmtp/ssmtp.conf

root=virtualcoin.videos@gmail.com
mailhub=smtp.gmail.com:587
FromLineOverride=YES
AuthUser=virtualcoin.videos@gmail.com
AuthPass=kamisama123
UseTLS=YES
UseSTARTTLS=YES

In our example, we are using the Gmail account virtualcoin.videos@gmail.com.

In our example, the Gmail account virtualcoin.videos@gmail.com is using the password kamisama123.

You need to change the Gmail account and password to reflect your account.

Use the following command to send an email using the command-line.

# echo “E-Mail using the command-line” | ssmtp virtualcoin.videos@gmail.com

Check your Gmail inbox for the test message that you just sent.

gmail inbox

If the test was successful you may advance to the next section of this tutorial.

If the test was unsuccessful, the following message may be presented.

• ssmtp: Authorization failed (534 5.7.14 https://support.google.com/mail/answer/78754 v24-v6sm2921112pfl.31 – gsmtp)

To solve this problem, you need to access the following URL .

• https://accounts.google.com/DisplayUnlockCaptcha

Select the option to unblock your account.

google unlock account

Try again to send the email using the command-line.

If the test was successful you may advance to the next section of this tutorial.

Grafana SMTP Configuration

Now, we need to configure the Grafana server to authenticate on Gmail.

Locate and edit the grafana.ini.

# locate grafana.ini
# vi /etc/grafana/grafana.ini

Uncomment and enable the Grafana SMTP section.

Here is the original SMTP section.

Copy to Clipboard

Here is the new SMTP section.

Copy to Clipboard

Restart the Grafana service.

# /etc/init.d/grafana-server restart

Now, you need to configure the Alert channel using the Grafana web interface.

Grafana Email Notification Setup

Open your browser and enter the IP address of your server plus :3000.

In our example, the following URL was entered in the Browser:

• http://34.216.84.149:3000

The Grafana web interface should be presented.

grafana default password

On the prompt screen, enter the Grafana Default Password login information.

• Username: admin
• Password: admin

After a successful login, the Grafana dashboard will be displayed.

On the Grafana dashboard screen, access the Alerting menu and select the Notification channels option.

grafana notification channels menu

On the Alerting screen, click on the Add channel button.

Grafana notification channel

On the Notification Channel screen, perform the following configuration and click on the Save button.

• Name – EMAIL
• Type – E-mail
• Send on all alerts – Yes
• Include image – Yes
• Disable Resolve Message – No
• Send reminders – No
• Email addresses – Enter a list of e-mail addresses separated by ;

grafana email alert configuration

Click on the Send Test button and look into your email account inbox for the message you just sent.

Grafana will now try to send a test message.

Here is an example of the message sent by Grafana.

grafana email alert example

Congratulations you have successfully configured the Grafana email notification.