Saturday, August 10, 2013

Monitoring Azure from a Raspberry Pi?

We have an Azure cloud network that we would like to monitor with a standalone status board.  One option is to do the "all Microsoft" Powershell thing with a windows device. Another option is to use the Linux and MAC Azure management tools released in 2012. There is also a Node.js based set of tools. An older MSDN blog entry is also useful for understanding this. Another option is to directly consume the Azure REST services used by the Node.js library.  I decided to try the Node.js tools.   REST service information is available on MSDN.

Hardware

Sometimes when you have stuff lying around you just have to come up with some way to use it. Sometimes it works out fine and some times not so much.  I have a 700MHz 512GB  Raspberry Pi computer sitting on the shelf with nothing to do.  Its that nifty Linux ARM based computer: with built in Ethernet, USB, video and an hardware extension bus. That hosts our monitoring scripts.

I also have the Adafruit LCD Keypad Kit for the Raspberry Pi.  It gives you 2 line LCD display with RGB backlight.

Raspberry Pi setup

Raspberry Pi setup i pretty straightforward.  Follow the instructions in the quick start guide http://www.raspberrypi.org/quick-start-guide to install and boot the operating system.  I had some additional config to do:

  1. Use raspi-config to set the timezone
  2. Use raspi-config to set the locale and keyboard type
  3. Install the chromium browser so that we don't have to download Azure publishing configuration onto a different machine. The default browser can't download the settings.
    • sudo apt-get install chromium-browser

Azure Command Line Interface (CLI) setup

The library is written on Node.js
  1. Install Node JS. I found this article useful. Later pre-compiled ARM versions of Node.js are available on the nodejs.or web site. I used v0.10.13. Install it into /usr/local
  2. Install the Azure Node.js based command line tools using the npm command as documented on windowsazure web site.  
    1. Download the Azure publishing settings per the windowsazure.com instructions.  I found I had to use a browser for this because of the way credentials are handled. The default Raspberry Pi browser is not powerful enough. Use something like chromium or use a different machine and transfer over the network or via thumb drive.
    2. Load those Azure publishing settings into the Azure Node.js configuration so that it can use those credentials to talk with the Azure cloud.
  3. At this point you can run Azure commandline commands from a terminal windows.  Every command starts with Azure.  Run something like Azure VM list to get a list of all virtual machines under that Azure subscription.

Performance Problems with Azure CLI on Raspberry Pi

The main problem is that it takes about 9.5 seconds to run even the Azure Help  command.  This is a pretty simple command with no obvious network or Azure dependencies. Here are some more timing numbers. 

azure help                 9.7 secondsazure vm list               21 secondsazure vm show <machineName> 21 seconds.

Azure CLI Limitations

The Node.js based tools can control and check status VM status.  They cannot retrieve any metrics or watch the load or behavior in the Azure network. This is a showstopper four our monitoring project. 

Adding an LCD panel to the Raspberry Pi

The Adafruit folks have a great tutorial on how to buy, build and write software for their 2x20 LCD display.  It describes all of the things you have to do to enable and configure the I2C based shield on a stock Raspberry Pi.

Conclusion

This project failed for two reasons:
  1. The CLI API does not provide the information needed for monitoring.
  2. The Azure Node.js library has too much overhead to perform on a Raspberry Pi.

No comments:

Post a Comment