Lately I’ve been learning vRealize Automation (vRA) and it has involved bringing the environment up and down frequently as well as breaking and fixing various services to see how the system would respond. I got tired of going into the VAMI (port 5480 of the vRA appliance) and selecting the Refresh button to get status on all of the various services so I created a little Powershell script that will display the status of the vRA services.
The simplest way to invoke the script is with:
get-vRAHealth vra71.vmware.local
Where vra71.vmware.local is my load balancer VIP for vRA. By default the script will continously refresh every 5 seconds.
You can disable the looping like so:
get-vRAHealth vra71.vmware.local -loop $false
And control the refresh interval:
get-vRAHealth vra71.vmware.local -refresh 10
Here is the output:
The script can be found on GitHub and below:
function get-vRAHealth() { <# .SYNOPSIS Displays health status of vRA components .DESCRIPTION Displays health status of vRA components .EXAMPLE get-vRAHealth vra71.vmware.local .EXAMPLE get-vRAHealth https://vra71.vmware.local -loop $true .EXAMPLE get-vRAHealth https://vra71.vmware.local -loop $true $sleep 2 #&amp;gt; param( [Parameter(Mandatory=$true,Position=0)] [string]$url, [Parameter(Mandatory=$false,Position=1)] [string]$loop=$true, [Parameter(Mandatory=$false,Position=2)] [Int32]$refresh=5 ) $uri = [System.Uri] $url if ($uri.Host -eq $null -and $uri.OriginalString) { $uri = [System.Uri] "https://$($uri.OriginalString)" } if ($uri.Scheme -eq 'http') { $uri = [System.Uri] "https://$($uri.Host)" } if ($uri.LocalPath -ne '/component-registry/services/status/current') { $uri = [System.Uri] "$($uri.AbsoluteUri)component-registry/services/status/current" } while ($true) { clear Write-Host "Checking $($uri.AbsoluteUri)" try { $content = Invoke-WebRequest $uri.AbsoluteUri if ($content.StatusCode -eq 200) { $json = $content.Content | ConvertFrom-Json $json.content | select serviceName, ` @{N='Registered';E={ $_.serviceStatus.serviceInitializationStatus }}, ` @{N='Available';E={ if (!$_.notAvailable) {'True'} else {'False'}}}, ` lastUpdated, ` statusEndPointUrl ` | ft -auto if ($loop -eq $false) { break } } else { Write-Host "Unable to access vRA Component Registry. Error: $content.StatusCode" } } catch { Write-Host "Unable to access vRA Component Registry. Error: $_.Exception.Message." } sleep $refresh } }
Great one,, Do we just need to replace our vRA LB in 2 places and run the script or any other modification needed?
You mean where it says vra71.vmware.local? That’s just an example. You should be able to run the script with: get-vRAHealth.ps1 “your vRA LB”.