Grafana SMTP Configuration

SMTP (Simple Mail Transfer Protocol) configuration in Grafana is used to set up email notifications and alerts. Grafana allows you to configure an SMTP server so that it can send emails for various purposes, such as alert notifications, report delivery, and more. To configure SMTP in Grafana, follow these steps:
Access the Grafana dashboard using http://localhost:3000, on the dashboard navigate to the contact point and look out for Add Contact Point

Fill out the required fields and in the Integration select as per your requirement it could be either Email, Discord, Slack, Teams etc.., and save the contact point.
Let's configure the SMTP to be able to send email alerts to the Contact point. For that navigate to the grafana.ini folder by using the command
cd /etc/grafana/
sudo vim grafana.ini
Scroll down to the SMTP section and uncomment(by removing semicolon";") the following lines as shown below

The password type should be "Application-specific password" Google requires you to use an application-specific password instead of your regular Gmail password when configuring third-party applications like Grafana to send emails via SMTP. This is part of Google's security measures.
Create an Application-Specific Password:
To generate an application-specific password for Grafana to use, follow these steps:
* Visit Google's App Passwords page: Go to Google's App Passwords page.
*Sign in: Sign in to your Google account if you aren't already.
*Select the App: In the "Select app" dropdown, choose "Mail" or "Other (Custom name)," and provide a custom name for the application (e.g., "Grafana").
*Generate the Password: Click the "Generate" button.
*Copy the Generated Password: Google will generate a unique, 16-character password.
Copy the password and paste it into the password field of grafana.ini File.
In the last part, You can set up alert notifications in Grafana by defining notification channels and associating them with alert rules

Navigate to the new nested policy and set the label as the email and Value as the email address and contact point select from the drop-down.

To test the SMTP configuration, navigate to the contact points and look for the pen option and run the test

In conclusion, configuring SMTP for Grafana is a crucial step in ensuring seamless communication and alerting within your monitoring environment. By following the steps outlined in this guide, you've empowered your Grafana instance to send emails, keeping you informed and aware of any critical events and performance metrics.


