Building a Dashboard for the Hands on Lab Project

After finishing up my HOL Provisioning script I moved on to the second thing on my list of Todo’s since the first HOL event in Kansas City… Build a dashboard.

I found that about 10 minutes into the lab things were starting to act funny, like vcloud director not opening console windows, and it wasn’t until i opened the vSphere client and seen that we were using something like 24Ghz of CPU power and 94GB of ram, that I realized the hardware was tapped out. Well this time we are going to know when we get close way before the cliff. You can check out the real-time dashboard at http://dashboard.vcloudlab.net

Dashboard showing HOL Stats in near realtime

The dashboard uses many different technologies to produce the finished product:

  • Google Visualization API’s for chart generation
  • PowerCLI for gathering stats from View, vCloud Director, and vSphere
  • MySQL to store the stats
  • PHP/Javascript/AJAX/JSON to get the stats from MySQL convert to Google API format and generate the charts
  • Apache web server to serve the finished product to you!

To say the least this is the most ive ever dug into a few of these languages, but with the help of Google we have something that works!

If you are interested in the code that makes this work let me know, I’m not just going to post a download link because it is pretty complex to setup and I haven’t created an install guide or even gathered all the parts and pieces into one area. If you need it though email me and Ill get it together. [email protected]

 

Setting vCenter Alarms with PowerCLI

Update: This script was intended for vSphere 4 and had a bunch of limitations. For a newer version with more functionality check out FixingITpro.com.

PowerCLI, and Powershell in general, are two things I don’t do much with. I’ve used it before when generating a few vSphere Health Check reports but other then that I haven’t played around with it. Today though I was trying setting up a vCenter server and was faced with the daunting task of configuring email alerts from all the alarm settings. This is something that I do on all installs and it normally takes at least 30 minutes because each one has to be done individually.

Not anymore though. I found Chris Uys’s  PowerCLI script that can setup vCenter alarms with a single command! Below is the script and to run it you only need to change four fields.

  1. vCenter IP address
  2. vCenter Username
  3. vCenter Password
  4. Email address to send alerts to

I have modified the script from its original version because it only touched four of the 30 settings in vCenter, my version sets up 17.

How to use it

The first thing to do is download VMware PowerCLI from here. After installing you will have a PowerCLI Icon on your desktop… find it as we will come back to it in a minute.

Next download the script below and extract it to your c:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI directory

Right click on the file and edit it with your favorite text editor. You will need to change the following variables to match your environment.

$vCenterServer = “192.168.126.10”
$user = “VCENTER USER NAME”
$pass = “VCENTER PASSWORD”
$MailToRandom1 = “EMAIL ADDRESS 1”
$MailToDefault1 = “EMAIL ADDRESS 2”
$MailToDefault2 = “EMAIL ADDRESS 3”
 

Note, If you do not need 3 destination email addresses you will need to remove the other two variables from the script(in all locations). Now save the file.

Now open the PowerCLI icon that you found on your desktop earlier. The first thing we need to do is allow PowerCLI to run unsigned scripts. To do this type:

Set-ExecutionPolicy Unrestricted

You will need to answer ‘Y’ when it prompts you but now we can run our script.
Simply type:

.\Set_Email_Alarms.ps1

Now the script will take a few minutes to go through and set the 17 alarms to whenever email addresses you tell it.

 

Here is the script