Powershell

No time for a long writeup (but I assure you this will be covered in great detail in my book!) but the code and screenshots should explain very well:

Code:

   1: Process {
   2:     $HostView = Get-View $_.Id
   3:     $Process = "" | Select-Object VMHostName, OverallStatus, OverallCpuUsage, OverallMemoryUsage
   4:     $Process.VMHostName = $_.Name
   5:     $Process.OverallStatus = $HostView.Summary.OverallStatus
   6:     $Process.OverallCpuUsage = $HostView.Summary.Quickstats.OverallCpuUsage
   7:     $Process.OverallMemoryUsage = $HostView.Summary.Quickstats.OverallMemoryUsage
   8:     Write-Output $Process
   9: }

Attachment: get-hosthealth.ps1

Output:

PS > Get-VMHost | scripts:\book\Get-HostHealth.PS1

VMHostName                      OverallStatus       OverallCpuUsage    OverallMemoryUsage
----------                      -------------       ---------------    ------------------
192.168.0.51                            green                   336                  1070
192.168.0.55                            green                    24                   417

And even cooler, with PowerGadgets:

image

: http://halr9000.com/article/492

Post a comment now » Sorry, the comments are closed.

No comments yet.

Sorry, the comment form is closed at this time.

  • Microblog

  • Recent Posts

  • Recent Comments

  • meta