PowerShell – Monitor MS Azure Status

If you are using MS Azure or MS Office 365 you are depending on the uptime of all the MS Cloud services.

Well to monitor this there is the Azure Status site.

image

This site offers for each service a RSS subscription to monitor the status.

In this case there was an issue, so we can kick in Powershell to grab the RSS output.

Here we go

 

CLS

$hsg = Invoke-WebRequest  "http://azure.microsoft.com/en-us/status/feed/"

$hsg.Content

[xml]$ret = $hsg.Content.TrimStart("")

#$ret.rss.channel.item | Select-Object *

write-host ""



if($ret.rss.channel.item.category -eq $null){

        write-host $ret.rss.channel.title " On : "  $ret.rss.channel.pubDate
        write-host "All services are working properly"
        write-host ""
    }
Else
    {

    write-host $ret.rss.channel.title " On : "  $ret.rss.channel.pubDate
    Write-Host "Issue Category : " $ret.rss.channel.item.category
    write-host ""
    Write-Host "Details : " $ret.rss.channel.item.title

    $ret.rss.channel.item.description
    write-host ""

}

rv hsg, ret
image

As you can see the raw XML data is prefixed (deliberately or not?) by a few strange characters which we have to eliminate before PowerShell can dig it.

So the final output is like this.

image

So you can create a job to have this run at a frequency to check for uptime issues.

Enjoy!

5 Responses to PowerShell – Monitor MS Azure Status

  1. dragan979 says:

    if i set $hsg.Content | out-null

    in order to eliminate raw XML data would i get output when service is disrupted ?

    • Hi, when you set the output to out-null there is no XML output at all…
      Out-Null : Send output to null, delete output instead of sending it to the console

      But you will get the TEXT output properly like this :
      “Azure Status On :
      All services are working properly”

      Rgds

      • dragan979 says:

        if i send it to null, will still i get output when some issues happens in Azure (same output from last picture in your blog but without XML data), i can’t test it because all Azure services are UP 🙂 ?

  2. dragan979 says:

    ok, i figured out, exported “raw” output to variable and if some Azure issue appears, description is shown without RAW XML data, thanks

  3. Great, good to know you figured it out…

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: