Monitoring Hyper-V Replica on a Failover Cluster

Recently we enabled Hyper-V Replica between two of our Windows Server 2012 R2 Datacenter Clusters.
In the first days I was checking the replication of theVMs manually using a PowerShell one-liner.

Eventually I got tired of that, so I searched a little bit and found a PS Script (not sure where) and customized it to fit my needs.

When executed on one Cluster Node (could also be a standalone machine), the script gathers information regarding the replication and sends it via Mail to me:

Replica

In order to automate the sending of the report, I created a scheduled task on one Cluster Node, following the settings:

General:

  • Name: ReplicaMail
  • User: replica (restricted service user)
  • Run whether user is logged on or not
  • Run with highest privileges
  • Configure for: Windows Server 2012 R2

Triggers:

  • Run Daily
  • Stop task if running longer than 3min

Actions:

  • Start a program:
    • Program: %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe
    • Arguments: .\MailRepHealth.ps1 -to hypervadmin@test.com -from replica@test.com -smtpserver xxx.xxx.xxx.xxx -hostorclustername clustername -iscluster
    • Start in: C:\tmp\       (this is the location of the script)

Now this is pretty much all the configuration needed to do, except saving the script on your server. Here it is (please save it in .ps1 format:

ReplicaHealthMailer

Please note that I’m not responsible for any issues caused by running PowerShell scripts on your systems.
Read the script, make sure you test it and you are ready to use it.

Advertisements
About

I'm a Systems Engineer working for an IT-Service Provider in Frankfurt am Main, Germany. I am specialized in Virtualization, High Availability, Storage- and Server Administration. In my free time, I like spend time with my lovely wife, to do sports like jogging and biking. I enjoy movies and a good bottle of fermented grape juice.

Tagged with: , , ,
Posted in Server, Virtualization, Windows Server 2012 R2

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: