VMware Cloud Community
NuggetGTR
VMware Employee
VMware Employee

Create a monitoring dashboard = easy

Hi all,

I’ve been looking for something so I can have on a screen or 2 that is at a whole environment at a glance type monitoring. There is lots of different ways of doing it and I thought I would share what I have done. hahaha I’m sure someone has already done this but hey it’s a slow day so ill post anyway.

I was looking for some powercli script and even looked at writing my own thing in VB.net but then I thought of an easier way, sure its not perfect and not the neatest but hey it works and surprisingly well.

Basically excel is doing most the work well visual work anyway. With excel 2007 it allows you to import data into a sheet from a text file and then allows you to set an update period to get that information from that text file, then you create a chart with that information. (note 2003 does not allow this only from access and sql etc)

So I use a powercli script to grab lest say cpu usage % for hosts


While ($true) {
	$clusters = get-cluster

	Foreach ($cluster in $clusters) {

	$esxhosts = get-cluster $cluster | get-vmhost | sort name
	$clustername = $cluster.name 

	$filename = "c:\$clustername.txt"
	$tempfile = "C:\charts\$clustername.txt"
	Clear-content $tempfile
	write-host $clustername
	Foreach ($esxhost in $esxhosts) {
		write-host $esxhost.name


		$stats = get-stat -Entity (get-vmhost $esxhost) -Stat cpu.usage.average -MaxSamples 12 -intervalMins 5 | where{$_.instance -eq ""} | sort timestamp



		$values = ""
		Foreach ($entry in $stats) {

	
			$values = $values + $entry.value + ","

	
			}

		write-host $values 
		$values | out-file -filepath $Tempfile -append

		}
	Copy-item C:\charts\$clustername.txt c:\
	}

}

Then you import the data into excel for me I used a new sheet for every cluster. Then create a chart from that data, excels charting is really good. I created one page with all the CPU usage for the hosts in those clusters; I have another for memory, for people with smaller environments you could fit heaps on one page. The charts and data refresh every 5 minutes in excel and constantly updating. it’s been working great.

You would want to avoid writing directly to the file that excel uses because if its refreshes when the data is not complete etc you get a nasty error saying it’s not correct. This is why i write to a tempfile and copy that across whole to avoid the errors.

I have attached an image for the cpu utilization that I knocked up, it displays the last hour( you will notice that some are at 0 at the end I can only guess that when I grab the 5min interval from the host that 5 minutes has not been written yet, its cool because next time it runs through it will be there and you won’t get dips in the graph if your worried about that).

it does the job for an at a glance monitoring and its easy and cheep to setup.

________________________________________ Blog: http://virtualiseme.net.au VCDX #201 Author of Mastering vRealize Operations Manager
0 Kudos
1 Reply
david615
Enthusiast
Enthusiast

Great script.  I am going to use this with following command to automatically save the chart as graphic file.  So I can link it tom my HTM report.

$objChart.Export("C:\Scripts\Test.jpg", "JPG")

http://powerclinic.blogspot.com/
0 Kudos