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.
Table of Contents
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
After making any changes in the configuration file, we need to restart Grafana Services. 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” to send panel images in the 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. Below is a sample which sends an email alert whenever free memory goes down to less than 3,000,000,000 bytes.
In the Notification select the newly created Notification Channel, and in “Message” you can type the message you want to see 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.
- Embedding Grafana in a websiteIntroduction of Embedding Grafana in a website Embedding grafana in a website is pretty simple if you want to embed Grafana Panels using Iframe. Often there are times when you want one of the existing Grafana panels to be used in your website for various reasons. Grafana makes it so much easy for you to …
- Monitor Docker Using Telegraf and GrafanaIn this article I am going to show you how you can Monitor Docker Using Telegraf and Grafana. Let us begin with a quick official intro about what is Telegraf, InfluxDb and Grafana. As mentioned in official docs, Telegraf is a plugin-driven server agent for collecting and sending metrics and events from databases, systems, and IoT …
- Grafana Email Alerts and Change Default TemplateIn 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 …
- Grafana and Telegram IntegrationIf you want to integrate Grafana and Telegram so that Grafana alerts can be received in any of the Telegram groups then this article is for you. In this article I am going to show you step by step approach to send Grafana Alerts on Telegram. Sending Alerts from Grafana to Telegram is very popular …
- 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 …