• Skip to main content
  • Skip to secondary menu
  • Skip to primary sidebar
The Blog of Jorge de la Cruz

The Blog of Jorge de la Cruz

Everything about VMware, Veeam, InfluxData, Grafana, Zimbra, etc.

  • Home
  • VMWARE
  • VEEAM
    • Veeam Content Recap 2021
    • Veeam v11a
      • Veeam Backup and Replication v11a
    • Veeam Backup for AWS
      • Veeam Backup for AWS v4
    • Veeam Backup for Azure
      • Veeam Backup for Azure v3
    • VeeamON 2021
      • Veeam Announces Support for Red Hat Enterprise Virtualization (RHEV/KVM)
      • Veeam announces enhancements for new versions of Veeam Backup for AWS v4/Azure v3/GVP v2
      • VBO v6 – Self-Service Portal and Native Integration with Azure Archive and AWS S3 Glacier
  • Grafana
    • Part I (Installing InfluxDB, Telegraf and Grafana on Ubuntu 20.04 LTS)
    • Part VIII (Monitoring Veeam using Veeam Enterprise Manager)
    • Part XII (Native Telegraf Plugin for vSphere)
    • Part XIII – Veeam Backup for Microsoft Office 365 v4
    • Part XIV – Veeam Availability Console
    • Part XV – IPMI Monitoring of our ESXi Hosts
    • Part XVI – Performance and Advanced Security of Veeam Backup for Microsoft Office 365
    • Part XVII – Showing Dashboards on Two Monitors Using Raspberry Pi 4
    • Part XIX (Monitoring Veeam with Enterprise Manager) Shell Script
    • Part XXII (Monitoring Cloudflare, include beautiful Maps)
    • Part XXIII (Monitoring WordPress with Jetpack RESTful API)
    • Part XXIV (Monitoring Veeam Backup for Microsoft Azure)
    • Part XXV (Monitoring Power Consumption)
    • Part XXVI (Monitoring Veeam Backup for Nutanix)
    • Part XXVII (Monitoring ReFS and XFS (block-cloning and reflink)
    • Part XXVIII (Monitoring HPE StoreOnce)
    • Part XXIX (Monitoring Pi-hole)
    • Part XXXI (Monitoring Unifi Protect)
    • Part XXXII (Monitoring Veeam ONE – experimental)
    • Part XXXIII (Monitoring NetApp ONTAP)
    • Part XXXIV (Monitoring Runecast)
  • Nutanix
  • ZIMBRA
  • PRTG
  • LINUX
  • MICROSOFT

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

23rd October 2018 - Written in: veeam

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:

  • https://my.slack.com/services/new/incoming-webhook/

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

param([string]$PlanName, [string]$PlanState)

Import-Module PSSlack
$Uri = "YOURWEBHOOKURLYOUJUSTCREATED"
$Channel = "vao-test"

[string]$Message = "+----------------------------------------------------------------------------+"
$Message += "" | Out-String
$Message += $PlanName + ' has been changed the status to ' + $PlanState


Send-SlackMessage -Uri $Uri `
                  -Channel $Channel `
                  -Parse full `
                  -Text  $Message

Slack-Plan-End.ps1

param([string]$PlanSummary)

Import-Module PSSlack
$Uri = "YOURWEBHOOKURLYOUJUSTCREATED"
$Channel = "vao-test"

[string]$Message = $PlanSummary
$Message += "+----------------------------------------------------------------------------+"

Send-SlackMessage -Uri $Uri `
                  -Channel $Channel `
                  -Parse full `
                  -Text $Message

Slack-Plan-VM.ps1

param([string]$VMName, [string]$VMIP, [string]$VMIPReplica)

Import-Module PSSlack
$Uri = "YOURWEBHOOKURLYOUJUSTCREATED"
$Channel = "vao-test"

$Message = '' + $VMName + ' with IP ' + $VMIP + ' and Replica IP ' + $VMIPReplica + ' has started a DR'

Send-SlackMessage -Uri $Uri `
                  -Channel $Channel `
                  -Parse full `
                  -Text $Message

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:

Install-Module PSSlack

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

NuGet provider is required to continue
PowerShellGet requires NuGet provider version '2.8.5.201' or newer to interact with NuGet-based repositories. The NuGet
 provider must be available in 'C:\Program Files\PackageManagement\ProviderAssemblies' or
'C:\Users\Administrator\AppData\Local\PackageManagement\ProviderAssemblies'. You can also install the NuGet provider by
 running 'Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force'. Do you want PowerShellGet to install
and import the NuGet provider now?
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"):

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

Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its
InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from
'PSGallery'?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): A

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.

Filed Under: veeam Tagged With: blogtober-2018, veeam, veeam availability orchestrator, veeam custom script orchestrator, veeam slack, veeam slack orchestrator

Reader Interactions

Comments

  1. Michele Domanico says

    24th October 2018 at 2:21 pm

    nice one mate!

Leave a Reply

Your email address will not be published. Required fields are marked *

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

Primary Sidebar

  • E-mail
  • GitHub
  • LinkedIn
  • RSS
  • Twitter
  • YouTube

Posts Calendar

October 2018
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
293031  
« Sep   Nov »

Disclaimer

All opinions expressed on this site are my own and do not represent the opinions of any company I have worked with, am working with, or will be working with.

Copyright © 2025 · The Blog of Jorge de la Cruz