Grafana smtp Configuration(Gmail)

Sushruthan
2 min readJun 11, 2021
Photo by Maxim Ilyahov on Unsplash

OVERVIEW:

In this post we will configure grafana.ini file in linux and setup smtp using gmail to send alerts.

Objective:

  1. Locate and configure grafana.ini
  2. Configure Gmail
  3. Test and Setup notification channel

Configure grafana.ini

Step 1: Locate file

The file path is /etc/grafana/grafana.ini

$ cd /etc/grafana
$ sudo nano grafana.ini

Step 2: smtp configuration

Uncomment the the following lines as shown below

enabled = true
host = smtp.gmail.com:465
user = alertgrafan@gmail.com
password = ********
skip_verify = true
from_address = alertgrafana@gmail.com
from_name = Grafana

Make the following changes as shown bellow and save the file.

enabled = true
host = smtp.gmail.com:465
user = alertgrafan@gmail.com ##enter your email address
password = ********
skip_verify = true ##change it to true
from_address = alertgrafana@gmail.com ##same mail id as user
from_name = Grafana ##set any name

It should look similar to the lines mentioned below.

[smtp]
enabled = true
host = smtp.gmail.com:465
user = alertgrafan@gmail.com
# If the password contains # or ; you have to wrap it with triple quotes. Ex """#passwor>
password = ********
;cert_file =
;key_file =
skip_verify = true
from_address = alertgrafan@gmail.com
;from_address = admin@grafana.localhost
from_name = Grafana
# EHLO identity in SMTP dialog (defaults to instance_name)
;ehlo_identity = dashboard.example.com
# SMTP startTLS policy (defaults to 'OpportunisticStartTLS')
;startTLS_policy = NoStartTLS

Step 3: Restart Grafana server

Type the following command

$ sudo service grafana-server restart 

--

--