I know this is supposed to be a weekend project, but I had some spare time on my Thursday evening :-) So here an update on my vSphere Alarm Box.

I received my analog panel meters this week. Instead of them displaying 0 to 5v I created some new face plates for them using my automatic paper cutter so they can display CPU and Memory consumption.  These meters are very easy to control by using a PWM signal, but the challenge is that the Raspberry PI only has one PWM port. So I decided I want to use an arduino for this. Making the Raspberry PI talk to the arduino is fairly straight foward. I am using I2C, but as the arduino uses 5v for its logic circuits and the Raspberry 3.3v I had to build a small level shifter to allow both both safely to communicate over I2C.

Everything now connected hardware wise, now I just had to make the meters work, displaying the right information from VC. I am writing my code in PHP and already had last weekend written the PHP code to use the QueryPerf API call to retrieve the last 5 minute average for CPU and memory of my cluster. But PHP does not allow me to send I2C calls, so I had to write an extension module for PHP to enable me to do this. As I never had written an PHP module, thanks to google, this did not take too long :-)

So there it is.. IT IS WORKING :-) Every minute Raspberry PI uses QueryPerf to retrieve information from VC. Using my PHP I2C extension it sends an I2C call, via the level shifter to my arduino. The arduino uses the value received via I2C to set the PWM for the specific pins and tha dah… working ;-)