Automation

 View Only
  • 1.  powercli script not detecting hardware issues

    Posted Nov 10, 2015 08:07 AM

    I am currently using the script below to perform hardware checks on all the esxi's.

    Today I found out that one of the esxi's has a problem with a hard disk, as shown in the attached screen shot. Yet, the script did not report any issues with that server.

    How can I modify this script, to get more reliable hardware status results?

    foreach($esx in Get-VMHost){

        Write-Host "Checking $esx" -ForegroundColor Yellow
        (Get-View -Id $esx.ExtensionData.ConfigManager.HealthStatusSystem).Runtime.SystemHealthInfo.NumericSensorInfo |
        where{$_.HealthState.Label -notmatch 'Green|Unknown' -and $_.Name -notmatch 'Rollup'} |
        Select @{N='Host';E={$esx.Name}},Name,@{N='Health';E={$_.HealthState.Label}} | Format-Table
       
        (Get-View -Id $esx.ExtensionData.ConfigManager.HealthStatusSystem).Runtime.HardwareStatusInfo.MemoryStatusInfo |
        where{$_.Status.Label -notmatch 'Green|Unknown'} | Select @{N='Host';E={$esx.Name}},Name,@{N='Health';E={$_.Status.Label}} | Format-Table

        (Get-View -Id $esx.ExtensionData.ConfigManager.HealthStatusSystem).Runtime.HardwareStatusInfo.CpuStatusInfo |
        where{$_.Status.Label -notmatch 'Green|Unknown'} | Select @{N='Host';E={$esx.Name}},Name,@{N='Health';E={$_.Status.Label}} | Format-Table

        (Get-View -Id $esx.ExtensionData.ConfigManager.HealthStatusSystem).Runtime.HardwareStatusInfo.StorageStatusInfo |
        where{$_.Status.Label -notmatch 'Green|Unknown'} | Select @{N='Host';E={$esx.Name}},Name,@{N='Health';E={$_.Status.Label}} | Format-Table
        }



  • 2.  RE: powercli script not detecting hardware issues

    Posted Nov 11, 2015 10:55 AM

    Same issue here. I have a memory warning for one host.

    I have explored everything under HealthSystemRuntime without finding anything.

    vSphere 6.0 Documentation Center

    Memory in "memoryStatusInfo" is reported as green.

    (And with only one value in the table...i was expecting one value per memory slot)

    All numericSensorInfo are reported as green as well.

    My conclusion at this stage.

    These API properties don't provide the same information as what is visible in the "Hardware Status" in vSphere client.



  • 3.  RE: powercli script not detecting hardware issues

    Posted Dec 07, 2015 01:25 PM

    Found it.

    Information in the "Hardware Status" > "Sensors" view are available via VMware CIM API in the OMC_DiscreteSensor

    To extract them in an easy way from PowerCLI.

    get-vmhost "YourHostName" | Get-VMhostCimInstance -ClassName "OMC_DiscreteSensor" -SkipCACheck -SkipCNCheck -SkipRevocationCheck | ogv

    You will find on my blog the function Get-VMHostCimInstance.  (Function inspired from many others bloggers)

    I will update the blog soon but one line has to be added in the function to be able to work with "OMC_DiscreteSensor"
    (Or you will end up with the error: Get-CimInstance : The response that the WS-Management service computed exceed the internal limit for envelope size.)

    $CimSessionOptionParameters = @{

    Encoding = 'Utf8'

    UseSsl = $true

    MaxEnvelopeSizeKB = 1024

    }

    Finally you will not get the "Warning" or "Error" category in the result it will be necessary to filter.
    The properties "HealthState" or "OperationalStatus" seem to be relevant in that case.

    Check the ValueMap for these properties in the OMC_DiscreteSensor

    For example for a memory module with a warning "Correctable ECC logging limit reached":

    HealthState has a value of 10. It means "Degraded/Warning"
    OperationalStatus has a value of 3. It means "Degraded"

    For the memory modules without any warning/errors the values are:
    HealthState 5 OK
    OperationalStatus 2 OK



  • 4.  RE: powercli script not detecting hardware issues

    Posted Dec 07, 2015 01:44 PM

    It seems that i should have replied to the original question.

    Answer in the previous post.