During a couple of vRealize Automation (vRA) design engagements I had to explain that the vRealize Automation Manager Service doesn’t have an Automated Failover process (active/passive) and relies on a manual intervention. This was quite hard for the customers to understand and accept because of active / active redundancy of other vRA components like the Web Service.
So OK what does the vRA Manager Service do (link)?
The Manager Service is a Windows service that coordinates communication between IaaS DEMs, the SQL Server database, agents, and SMTP. IaaS requires that only one Windows machine actively run the Manager Service. For backup or high availability, you may deploy additional Windows machines where you manually start the Manager Service if the active service stops.
And that last part is something my customers didn’t like (at all) because this depends on a person to activate the service manually. OK then how can we solve this?
Automating the Manager Service Failover
I like to keep things simple and wanted to Automate the Manager Service failover with vRealize Operations (vROps) monitoring the service and kicking off an action when the service is down. Eventually I got this to work but this took way too much effort and didn’t like the complex setup of vROps sending a SNMP trap to vRO and then let vRO kick off a Powershell script on the vRA IaaS Manager server. So back to the drawing board and the solution was way too simple… Running a scheduled task on the Secondary vRA IaaS Manager server that checks the Manager Service on the Primary and then starts it locally when the service is down.
Pre-requisites
The Script
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
$ServiceName = "VMware vCloud Automation Center Management Agent" $PrimaryComputerName = "DCVRA01" $SecondaryComputerName = "DCVRA02" $CheckService = Get-Service -ComputerName $PrimaryComputerName -Name $ServiceName -Ea SilentlyContinue if ($CheckService.Status -ne "Running"){ Write-Host $(get-date) "Service is down on Primary vRA node" Write-Host $(get-date) "Starting service on Secondary vRA node" Get-Service -Name $ServiceName -ComputerName $SecondaryComputerName | Set-Service -Status Running Write-Host $(get-date) "Service is now started on Secondary vRA node" Write-Host $(get-date) "Trying to start the service again on the Primary vRA node" Get-Service -Name $ServiceName -ComputerName $PrimaryComputerName | Set-Service -Status Running -Ea SilentlyContinue } if ($CheckService.Status -eq "Running"){ Get-Service -Name $ServiceName -ComputerName $SecondaryComputerName | Stop-Service Write-Host $(get-date) "The service is running on Primary vRA node" } |
Scheduling the execution of the script
Now copy the script and store it on the Secondary vRA IaaS Server running the “passive” Manager service under for example:
C:\Scripts\vRAManagerServiceCheck.ps1
Open the Task Scheduler and select Create Task.
Give the Scheduled Task a Name and select “Run whether user is logged on or not” and “Run with highest privileges”.
Select Triggers and “New”, select “Daily” fill in 00:00:00 as start time. Select “Repeat task every” 5 mins “for a duration of” 1 day. And optionally select “Stop task if it runs longer than” 30 mins. And select OK
Select Actions and “New”, fill in as “Program/Script” PowerShell and under “Add arguments (optional)” –File “C:\Scripts\vRAManagerServiceCheck.ps1”. And select OK on the Create Task form.
Fill in the vRA Service Account where the script is started under.
Wait for 5 minutes and voila status 0x0 (successful)!
Now this is a really basic script and it can be extended with for example some logging and additional service checking etc etc but of course that all depends on the requirements of the customer! 🙂



