Created
November 29, 2016 18:24
-
-
Save srpomeroy/736ab5b39a2aaa63e700a66b32a3e1e8 to your computer and use it in GitHub Desktop.
PowerShell example of retrieving RightScale system status
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$headers = @{"accept"="application/json"} | |
$statusPageContent = Invoke-WebRequest -Uri "http://status.rightscale.com" -Headers $headers | |
$components = ($statusPageContent | ConvertFrom-Json).components | |
$componentObject = @() | |
foreach ($component in $components) { | |
$componentObject += [pscustomobject]@{ | |
"name" = $component.name | |
"status" = $component.status | |
} | |
} | |
#Echo all components status | |
#Valid component states: Operational, Under Maintenance, Degraded Performance, Partial Outage, Major Outage | |
$componentObject | |
#Echo API Status | |
$apiStatus = $componentObject | Where-Object {$_.name -eq "Cloud Management API 1.5"} | Select-Object -ExpandProperty status | |
Write-Output "API Status: $apiStatus" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment