VMware Cloud Community
Sureshadmin
Contributor
Contributor

Hardware monitoring in ESX

Hi,

I need to monitor my ESX servers hardware (HP proliant) and generate a report on their health status. The CIM providers could provide these information. I need a powershell script to export health status of CPU, MEM and HDD of esx servers.

Platform : ESX 3.5 and VC 2.5

Thanks in advance!

Reply
0 Kudos
5 Replies
RvdNieuwendijk
Leadership
Leadership

Hi,

to be able to retrieve the hardware status of your HP ProLiant ESX servers, you need to have the HP Management Agents for VMware ESX Server software installed on your ESX server.

NOTE: The link goes to the current version of the software at the day I write this post. Check if there is a newer version of this software if you read this later. There is also a different version version for ESX 4. If you use ESXi you need to install the HP ESXi image.

I am able to retrieve the status information for CPU, memory, storage adapters and sensors. I am not able to retrieve the information for hard disk drives.

Get-VMHost | Get-View | ForEach-Object {
  $VMHostView = $_
  $HealthStatusSystem = Get-View $VMHostView.ConfigManager.HealthStatusSystem
  $HardwareStatusInfo = $HealthStatusSystem.Runtime.HardwareStatusInfo
  $SystemHealthInfo = $HealthStatusSystem.Runtime.SystemHealthInfo
  ForEach ($Cpu in $HardwareStatusInfo.CpuStatusInfo) {
    $Report = "" | Select-Object VMHost,Device,Type,Status
    $Report.VMHost = $VMHostView.Name
    $Report.Device = $Cpu.Name
    $Report.Type   = "Cpu"
    $Report.Status = $Cpu.Status.Key
    $Report
  }
  ForEach ($Memory in $HardwareStatusInfo.MemoryStatusInfo) {
    $Report = "" | Select-Object VMHost,Device,Type,Status
    $Report.VMHost = $VMHostView.Name
    $Report.Device = $Memory.Name
    $Report.Type   = "Memory"
    $Report.Status = $Memory.Status.Key
    $Report
  }
  ForEach ($Storage in $HardwareStatusInfo.StorageStatusInfo) {
    $Report = "" | Select-Object VMHost,Device,Type,Status
    $Report.VMHost = $VMHostView.Name
    $Report.Device = $Storage.Name
    $Report.Type   = "Storage"
    $Report.Status = $Storage.Status.Key
    $Report
  }
  ForEach ($Sensor in $SystemHealthInfo.NumericSensorInfo) {
    $Report = "" | Select-Object VMHost,Device,Type,Status
    $Report.VMHost = $VMHostView.Name
    $Report.Device = $Sensor.Name
    $Report.Type   = "Sensor"
    $Report.Status = $Sensor.HealthState.Key
    $Report
  }
}

I have run this script against ESX 3.5 servers and ESXi 4.1 servers (HP ESXi image). The ESXi 4.1 servers return a lot more information.

Regards, Robert

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
Sureshadmin
Contributor
Contributor

Thanks much Robert. Would love to have HDD status into this script. Is it not possible to get it via CIM?

Reply
0 Kudos
AlbertWT
Virtuoso
Virtuoso

Rob, many thanks for your script,

I'm about to modify your script so that it writes something in colour, based on the status, there can be only threr condition with inconsistent character casing ?

Red, Yellow, Green ?

$colour = "Red";
if($Report.Status -ilike "green")     {
$colour = "Green";
}
Write-Host -ForegroundColor $colour ......
/* Please feel free to provide any comments or input you may have. */
Reply
0 Kudos
Sureshadmin
Contributor
Contributor

Hi Robert,

Is it possible to collect the version of HP SIM agent version on ESX 3.5 using "Numericsensorinfo"?

Reply
0 Kudos