Skip to content

Instantly share code, notes, and snippets.

@srpomeroy
Created November 29, 2016 18:24
Show Gist options
  • Save srpomeroy/736ab5b39a2aaa63e700a66b32a3e1e8 to your computer and use it in GitHub Desktop.
Save srpomeroy/736ab5b39a2aaa63e700a66b32a3e1e8 to your computer and use it in GitHub Desktop.
PowerShell example of retrieving RightScale system status
$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