In this article I am going to show you how you can configure Grafana Email Alerts and Change Default Template. Please notice that in this article we have install Grafana on a Windows server. However, Steps are going to exactly the same regardless of which Operating System you have installed Grafana to.
For Video Tutorial Lovers
Grafana SMTP Integration To Send Email Alerts From Grafana
First and foremost step is that you should have SMTP details. You are going to get SMTP details from the project which you are working in. It might be provided to you by your client, so get in touch with them.
However if you want to Integrate SMTP for learning purpose then there are many SMTP providers are available. They provide you SMTP details with limitations of sending few free emails every day. You can google about Free SMTP Providers.
Adding SMTP Details in Grafana Configuration File
Open Grafana configuration file which by default is available at below locations depending on the Operating System Type:
- For Windows It is available at this location: C:\Program Files\GrafanaLabs\grafana\conf\Defaults
- For Unix/Linux it is available at the following location: /etc/grafana/grafana.ini
Required SMTP Details:
Below are the SMTP details which I have received from my provider, so I have updated that here. In your case, SMTP details will be different. Important thing to notice here is that you will have to change enabled = true for remaining changes to take effect.
Restarting Grafana Services
It is required to restart Grafana Services whenever we make any changes in configuration file. Changes take effect only after restart of Grafana Services. So for windows you can restart Grafana services by going to services management console as shown below.
Creating Alert Notification Channel In Grafana
Open Grafana (default URL is http://localhost:3000 )and from the left pane, select Alerting->Notification Channels as shown in below example.
Provide Notification Channel Name, Type and Addresses. You can provide multiple email addresses by separating them with a semicolon. In the notification settings select “Include Images” if you want panel images to be sent in email body.
Click on “Test” and Grafana will send a Test email to confirm that Email settings are working properly. Here is the sample email which I have received.
Adding alerts in Grafana Panels
After you successfully create a working Email Notification Channel you can add alerts in your Grafana Panels. For this, go to alerts tab of any Grafana panel. Sample is shown below, I want an email alert to be sent whenever free memory goes down to less than 3,000,000,000 bytes.
In the Notification select the newly created Notification Channel. For Message you can type whatever message you want to be shown in the email body.
That is it. Save it and now you should receive an email whenever value goes below threshold based on the rule you have defined.
Default Email Alert Template
Default email alert will look like below. But don’t worry you can change the default template and I will show you how.
Changing Default Email Template
All the notification email templates are kept at below locations based on the type of Operating System.
Windows Default path: C:\Program Files\GrafanaLabs\grafana\public\emails\
Unix/Linux Default path: /etc/grafana/public/emails/
Changing Default Email Template
Open alert_notification.html file and make changes in this file based on your requirement. In this example I am just making one word change in the footer. I am changing Copyright information from default (Grafana Labs) to vikasjha001 (which is my youtube channel username as well).
Restart Grafana Services
Whenever you make any changes in Email Templates, you will have to restart Grafana. Changes will take effect immediately after a successful start of Grafana Services. Here is the email alert I received after making the change.
Hopefully you liked this article. You can continue reading more about Grafana here.
- Grafana and Telegram IntegrationSending Alerts from Grafana to Telegram is very popular method. Let’s learn the integration by following step by step approach. First thing you need is a Telegram bot to be created using Telegram “botfather”. Here are the steps for that:Guess What, Below website already talks about this in detail, So I am not going to …
- Installing InfluxDb and TelegrafIn this article I will show you steps for Installing InfluxDb and Telegraf. If there is any query please write in the comment box and I will be happy to answer. Steps for Installing InfluxDB on CentOS Steps to Install Telegraf on CentOS I hope you liked this article about Installing InfluxDb and Telegraf. You …
- Upgrading from Grafana 6 to Grafana 7In this article I am going to show you steps for Upgrading from Grafana 6 to Grafana 7. We will be installing Latest version of Grafana RPM on top of existing version (6) , in order to Upgrade Grafana. In this example we are using Linux (Centos) operating system. Download Grafana Latest Version First step …
- Changing Grafana Database to MySQLIn this article you are going to learn steps for changing Grafana Database To Mysql. We will begin with learning to install Mysql database first. Post Mysql database is installed then we will change Grafana to use Mysql. Installing MySQL Server Starting MySQL Server Creating a new database in MySQL Database Making changes in Grafana …
- Installing Grafana on WindowsIn this article I will show you all the steps required for Installing Grafana on Windows Operating System. After reading this article if you still have any query then please write to me in the comment box. I will be happy to answer your query. There are two approaches of installing Grafana on Windows. Approach …