Enable Grafana Alerting

This one is for those who would like to start using the Grafana alerting to recieve notifications by Email.
we will connect Grafana plugin to GMAIL account, that will allow to send emails with alerts.

Before I start (and SEC nerds will loose their minds) I will say that it is better to use !secret to fetch the login and password, but from v2.3.0 Frenck removed that functionality (https://github.com/hassio-addons/addon-grafana/releases/tag/v2.3.0), and now it is handled by Hassio, by now I did not figured out how it exactly works so anyone who has an idea is welcomed to comment.

First we will configure GRAFANA to use SMTP and configure a GMAIL account to be used by GRAFANA for sending emails.
that will be done from GRAFANA plugin Configuration tab.
add the following configuration under “env-vars”:

  - name: GF_SMTP_ENABLED
    value: 'true'
  - name: GF_SMTP_HOST
    value: 'smtp.gmail.com:587'
  - name: GF_SMTP_USER
    value: [email protected]
  - name: GF_SMTP_PASSWORD
    value: PASSWORD
  - name: GF_SMTP_SKIP_VERIFY
    value: 'true'
  - name: GF_SMTP_FROM_ADDRESS
    value: [email protected]
  - name: GF_SMTP_FROM_NAME
    value: GRAFANA
  • NOTE: If the password contains # or ; you have to wrap it with quotes. Ex ‘#password;’
    on some forums I was advised to wrap it with triple quotes, like this: “””#password;””” but this did not work for me so I was content with single quotes.
    the triple quotes might be needed when you edit the “.ini” file directly, but I’m not sure about that.

your config should look something like this:

next you will need to allow “Access for less secure apps” on your Google account:
log in to your google account-> manage your google account-> security-> less secure app access-> turn to ON

after that, you will need to configure Grafana and set a Notification Channel:
via Grafana plugin management open in webUI-> on the left pane click on alerting (bell icon)-> click on Notification Channels->

Name: whatever you like
Type: Email
Include Image: ON (so you could receive an image of the graph)
Addresses: type in the address that will receive the email notification.

And hit the “send test” to test your configuration.

For more information about the Grafana PlugIn you can check the GitHub repo:
https://github.com/hassio-addons/addon-grafana/releases

Leave a Comment