Sometimes we are affected by a (supposedly firmware) bug that rarely affects our ESXi hosts in vCenter. This happens mainly on HP BL460c blade servers. You will get an alarm with IPMI Event Log Status, Other Hardware Objects, or Hardware Temperature status, but everything will appear okay on the Hardware Status screen and the IPMI log will be clear (or show you that 65535 are present when they aren’t). The gathered information has pinpointed me towards resetting the CIM Service and Hardware Monitoring agents.
What this handy PowerCLI Script does is basically everything described above, but without tne hassle of connecting to each host manually – it’s a bit modular so take a look on the code first if you understand the mnemonics, if not just run it, enter your vCenter and VM name (don’t forget to see the $hosts value – it should contain your domain’t name!) and wait for a moment.
Write-Host "Reset sensors, refresh HW data & their views on an ESXi host" `n -ForegroundColor Green <# Uncomment this to enable connection to vCenters defined in a text file # $vcenterlist = Get-Content .\vcenters.txt ForEach ($vcenter in $vcenterlist) { Define vCenter Write-Host `n"Connecting to vCenter $vcenter" # Connect to vCenter Connect-VIServer $vcenter | Out-Null } #> # Define a blank array for the hosts $hosts = @() # input checking loop to check if $vcenter is null or not. if ($vcenterlist -eq $null) { do { [Boolean]$match = $false $vcenter = Read-Host "Define a vCenter where the host is located" $vcenter.Replace(' ','') if ($vcenter -notlike "") { $match = $true } Else { Write-Host "The value must not be null. Try again or CTRL+C to break."`n -ForegroundColor Red $match = $false } } Until ($match -eq $true) } # ESXi host definition $input = Read-Host "Enter a name of ESXi host where you want to reset the HW sensors" # Generate FQDN and store into an Array $hosts += "$input`.yourdomain.lab" # Connect to vCenter Write-Host `n "Connecting to vCenter $vcenter`..." ForEach ($vcenter in $vcenterlist) { Connect-VIServer $vcenter | Out-Null } # The VMhost needs to be stored into an array with Get-VMhost for further processing $vmhosts = Get-VMHost -Name $hosts # Get all vmhosts for the connected vCenter sessions #$vmhosts = Get-VMHost ForEach ($vmhost in $vmhosts) { Try { #initialize calls for refreshing hardware status.. Write-Host "Restarting CIM Server service on $vmhost" Get-VMHost $vmhost | Get-VMHostService | Where { $_.Key -eq “sfcbd-watchdog” } | Restart-VMHostService -Confirm:$false | Out-Null Start-Sleep -Seconds 15 Write-Host "Starting to refresh HW info on $vmhost (this can take a while)" # Define variables for system calls $hv = Get-View $vmhost $hss = get-view $hv.ConfigManager.HealthStatusSystem Write-Host "Resetting HW Sensors..." $hss.ResetSystemHealthInfo() Start-Sleep -Seconds 15 Write-Host "Refreshing Data..." $hss.RefreshHealthStatusSystem() Start-Sleep -Seconds 15 Write-Host "Refreshing Data View..." $hss.UpdateViewData() Start-Sleep -Seconds 15 } Catch [System.Exception] { Write-Host "There was an error while trying to refresh the hardware data." `n ` "Please check the ESXi host's Hardware Status Tab." -ForegroundColor 'Red' } Finally { Write-Host "Disconnecting from the vCenter Server..." Disconnect-VIServer $vcenter -Confirm:$false Write-Host "Done processing $vmhost." -ForegroundColor Green } }
I Hope it has alleviated at least one occurrence of this bug 🙂