VMware Cloud Community
meistermn
Expert
Expert
Jump to solution

List VM's per VCPU in cake diagram

Now after the virtualization project management whats a report, where is shown how many vm's have 1 vcpu, 2 vcpu, 4 vcpu and 8 vcpu.

Is it possible to show this directly in a cake diagram.

0 Kudos
1 Solution

Accepted Solutions
Grzesiekk
Expert
Expert
Jump to solution

Hi,

what you also can do :

download

Microsoft Chart Controls for Microsoft .NET Framework 3.5

http://www.microsoft.com/en-us/download/details.aspx?id=14422

then from this site

http://www.shogan.co.uk/vmware/generating-graphical-charts-with-vmware-powercli-powershell/

download

http://www.shogan.co.uk/wp-content/plugins/download-monitor/download.php?id=Create-Chart.zip

and

http://www.shogan.co.uk/wp-content/plugins/download-monitor/download.php?id=Create-HashTable.zip

then

$vms=get-vm   (or get-vm -location "some-cluster" if you want to have vms from specific location on the chart)

$ht=@{}
$vms|Group-Object -Property numcpu |%{$ht.add(("Vcpus: "+$_.name),$_.Count)}

Create-Chart -ChartType Pie -ChartTitle "Vms and vcpus" -YAxisName "vpus" -XAxisName "vms" -ChartWidth 700 -ChartHeight 600 -DataHashTable $ht -FileName mychart

you should get mychart.png file  like the one below Smiley Wink i made it 5 minutes ago to test this out Smiley Wink

chart1.jpg

--- @blog https://grzegorzkulikowski.info

View solution in original post

0 Kudos
6 Replies
RvdNieuwendijk
Leadership
Leadership
Jump to solution

You can use the PowerShell Group-Object cmdlet to get this information:

Get-VM | Group-Object -Property NumCpu

The number of vCPU's is in the Name column of the output.

You can use Luc's Export-XLS function to export the information to Excel and make a nice diagram from that.

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
Grzesiekk
Expert
Expert
Jump to solution

Hi,

what you also can do :

download

Microsoft Chart Controls for Microsoft .NET Framework 3.5

http://www.microsoft.com/en-us/download/details.aspx?id=14422

then from this site

http://www.shogan.co.uk/vmware/generating-graphical-charts-with-vmware-powercli-powershell/

download

http://www.shogan.co.uk/wp-content/plugins/download-monitor/download.php?id=Create-Chart.zip

and

http://www.shogan.co.uk/wp-content/plugins/download-monitor/download.php?id=Create-HashTable.zip

then

$vms=get-vm   (or get-vm -location "some-cluster" if you want to have vms from specific location on the chart)

$ht=@{}
$vms|Group-Object -Property numcpu |%{$ht.add(("Vcpus: "+$_.name),$_.Count)}

Create-Chart -ChartType Pie -ChartTitle "Vms and vcpus" -YAxisName "vpus" -XAxisName "vms" -ChartWidth 700 -ChartHeight 600 -DataHashTable $ht -FileName mychart

you should get mychart.png file  like the one below Smiley Wink i made it 5 minutes ago to test this out Smiley Wink

chart1.jpg

--- @blog https://grzegorzkulikowski.info
0 Kudos
meistermn
Expert
Expert
Jump to solution

Hey maybe, how has the wildest cake diagramSmiley Wink

0 Kudos
Grzesiekk
Expert
Expert
Jump to solution

Just try to imagine that this is a cake Smiley Wink  like... focus .. focus.. yeah ! a cake ! Smiley Wink

Seriously, um.. i guess you need to check that MS chart library im sure they offer other kinds of charts, it was just an example.

Anyway... if you want to have it more like a cake either go through this :

http://msdn.microsoft.com/en-us/library/dd456674.aspx  -> custom attributes

And from here you might adjust your cake to look more like a cake than a button Smiley Wink

I'll see tomorrow how can i enchance this one myself too Smiley Wink

Greg

--- @blog https://grzegorzkulikowski.info
0 Kudos
Grzesiekk
Expert
Expert
Jump to solution

Ok, more cakes Smiley Wink

if you will edit the chart drawing function like this:

if (($ChartType -eq "Pie") -or ($ChartType -eq "pie")) {
        $ChartArea.AxisX.Title = $XAxisName
        $ChartArea.AxisY.Title = $YAxisName
        $Chart.Series["Data"].ChartType = [System.Windows.Forms.DataVisualization.Charting.SeriesChartType]::Pie
        $Chart.Series["Data"]["PieLabelStyle"] = "Outside"
        $Chart.Series["Data"]["PieLineColor"] = "Black"
        $Chart.Series["Data"]["PieDrawingStyle"] = "SoftEdge"
        ($Chart.Series["Data"].Points.FindMaxByValue())["Exploded"] = $true
        $Chart.Series["Data"].Label = "#VALX = #VALY\n" # Give an X & Y Label to the data in the plot area (useful for Pie graph) (Display both axis labels, use: Y = #VALY\nX = #VALX)

you will get almost a cake:

1cake.jpg

If you will set it to default:

Ok, more cakes Smiley Wink

if you will edit the chart drawing function like this:

if (($ChartType -eq "Pie") -or ($ChartType -eq "pie")) {
        $ChartArea.AxisX.Title = $XAxisName
        $ChartArea.AxisY.Title = $YAxisName
        $Chart.Series["Data"].ChartType = [System.Windows.Forms.DataVisualization.Charting.SeriesChartType]::Pie
        $Chart.Series["Data"]["PieLabelStyle"] = "Outside"
        $Chart.Series["Data"]["PieLineColor"] = "Black"
        $Chart.Series["Data"]["PieDrawingStyle"] = "Default"
        ($Chart.Series["Data"].Points.FindMaxByValue())["Exploded"] = $true
         $Chart.Series["Data"].Label = "#VALX = #VALY\n" # Give an X & Y  Label to the data in the plot area (useful for Pie graph) (Display both  axis labels, use: Y = #VALY\nX = #VALX)

then i guess this one looks like a normal pie chart.

2cake.jpg

--- @blog https://grzegorzkulikowski.info
0 Kudos
meistermn
Expert
Expert
Jump to solution

mychart.png

My loks like this.

0 Kudos