This request showed up few days ago into Veeam Forums, and since I’m a happy Slack user, I thought it would have been cool to see if it would have been possible. The example below is made for Veeam Backup & Replication, but can be easily applied to any received notification.
Veeam Backup & Replication can notify job results using different methods: email, SNMP traps,notes in vSphere. For my project, I’m going to use SMTP emails. The first part of the task is to configure e-mail notifications in Veeam. From the main menu, select Options and then E-Settings. Configuration should be like this:
Note the custom text “SkunkWorks Veeam” I’ve added at the beginning of the subject parameter. This will come handy later. Once you’ve setup Veeam Backup & Replication, enable e-mail notification in the job:
By just enabling email notifications in the job advanced settings, without additional parameters, my email address I’ve setup in the general options will receive status updates of this job, regardless the success or failure of it. After running the backup job, this is the email in my inbox:
From Gmail to Slack
Now that the email notification is into Gmail, it’s time to classify it. By using the custom subject i’ve configured in Veeam, let’s create a filter:
In the upper right menu, select “Filter messages like this”. Gmail will open up a search bar, where you can use the custom subject as a filter:
The filter, in this configuration, is going to select any email in the inbox where the subject contains “SkunkWorks Veeam”, so any email notification arriving from my jobs, and will label them with the tag “Veeam_backups” that I’ve created during the creation of the filter.
Now, in order to send these emails to Slack, we need IFTTT. I’m not spending time to explain this great tool; simply put, if you don’t know it you should. It’s by far the best internet automation tool, and it’s completely free! In IFTTT, we are going to create a new “recipe” that will send these emails to Slack:
IFTTT stands for “If This Then That”. The trigger to start an action in this recipe is going to be a Gmail email with a given label. And obviously, our label will be “Veeam_backups”:
When the trigger is confirmed, the action we want IFTTT to do is to post a new message into Slack. For this, I’ve created a new private channel, so i’m going to be the only receiver of the alerts. If you need to have multiple people looking at notifications, simply invite other Slack users to your channel. The final recipe is going to appear like this:
now, when a new email notification arrives into my inbox (but obviously, if you do not want to have these reports in both locations, you can create a dedicated gmail account just for logs) Slack will receive a new message:
One thought on “Send email notifications to Slack”
I would have bet my a** that you too were on slack. Ciao Dellock!
Comments are closed.