Veeam: Slack notifications for each execution of Failover Plans, includes VMs and work summary

Greetings friends, I haven’t written much about Veeam Availability Orchestrator yet, and that’s going to change soon, today I start with an advanced entry and later we’ll come back with the basics.

One of the amazing things Veeam Availability Orchestrator allows us is to include additional steps in our Disaster Recovery plan. Talking to a customer I said to him if he would like to receive Slack notifications when a job is running, and have a brief summary in Slack too once the job finishes, of course he loved the idea, today we’ll see the steps necessary to get it up and running.

How to activate an Incoming WebHook in Slack to send simple notifications

Depending on the amount of WebHooks you have available in your Slack channels, this will work or give you an error, simply go to this link:

And we will appear something similar to this, we will select the channel where we want to send alerts:

This will give us a unique code that we will use in the scripts below:

Preparing Powershell Scripts for VAO

I have three different scripts, one when the work starts and another for later, I also have a script that is processed with each VM, they are very simple, let’s see both:

Slack-Plan-Start.ps1

Slack-Plan-End.ps1

Slack-Plan-VM.ps1

Very simple for now, we will improve them in the future.

How to Install the PSSlack module on the Veeam Availability Orchestrator and Veeam Backup & Replication servers.

Open a Powershell with Administrator permissions and launch the following command to install the PowerShell to Slack module:

We may not have the latest version of NuGet that is needed, so we’ll say AND here:

And finally we will say A in this question of whether we trust the module:

We already have our VAO and our VBR, ready to launch PowerShell to Slack Scripts.

How to Create custom scripts in Veeam Availability Orchestrator

Now that we have everything almost ready, it’s time to go to Veeam Availability Orchestrator and create custom scripts, in my case are these of Slacks, in yours can be:

  • Configurations of Routers or Switches
  • Public DNS configuration, e.g. Amazon Route 53
  • etc

We will go to the configuration of Veeam Availability Orchestrator and on Plan Steps, we will be able to add the three different custom scripts:

For example, the custom script for when we start work, and select the script on our PC:We’ll tell him to be available for all Sites: Within the Script, in particular this of starting the work, we have to have two parameters, PlanName and PlanState, and these must have as default Value %plan_name% and %plan_state% respectively:Finish Script must have a new parameter called PlanSummary with value %plan_summary%.

The VM Script must have VMIP, VMIPReplica and VMName which must have %current_vm_ip%, %replica_vm_ip% and %source_vm_name% respectively:

In all of them we have the Common Parameters, I like to leave it this way:

Already in our Failover Plan we will add a new step in the pre-failover steps, with our Script:

Similar to post-failover, add a new step with the script: And, inside the VMs:

Executing a Failover Plan and displaying the notifications in Slack

With everything ready, we will be able to launch our Failover, which will show us something similar to this in Scripts:

From Slack we will be able to see the notifications for each VM, besides that the process has begun:

And at the end we will see a complete summary of all the work, in plain text:

Next steps

This project is a v0.1 without a doubt, it works, but notifications can be better, using icons and colors, apart from tables with information. Surely you have time before the end of the year to leave everything much more perfect, but at least and for now you can receive notifications in Slack.

Advertisements

One thought

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.