Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

ESXI CIM hardware monitors

Summary

This template is the example how to use VMware CIM SMASH/Server Management API to obtain hardware state information from ESXi host.

Credentials

Create Windows user credentials for ESXi host in IPHost Network Monitor client. For this select "Settings > User Credentials", click "Windows" tab, click "New").
Assign credential fields as below:
Domain: .
User: ESXI host API administration account (usually root)
Password: ESXI host API administration account password

Assign the above Windows credentials to the ESXi host. Make sure monitors created for this host inherit the above credentials (this is default).

Usage

ESXI CIM hardware monitors template includes two PowerShell script files appearing in C:\ProgramData\IPHost Network Monitor\templates\ESXI CIM hardware monitors\ after monitors creation:
- esxi-cim-filter-class-instance.ps1
- esxi-cim-getinstance.ps1

esxi-cim-filter-class-instance.ps1 is used in monitors to get a metric value of the CIM class, element and field specified via arguments.

esxi-cim-getinstance.ps1 can be additionally used to read list of elements of the specified class installed on particular EXSi host.

ESXi host doesn't instantiate corresponding CIM/derived classes for the hardware that isn't installed. Thus, you might need to check actual hardware identifiers prior to running monitors.

For example, to list all available controllers navigate to scripts directory and run command like
powershell -ExecutionPolicy ByPass -File esxi-cim-getinstance.ps1 -HostEsxi ESXIip -UserName "root" -UserPassword "password" -ClassName CIM_Controller -FieldName ElementName
Replace the ESXI host IP and credentials with their actual values.

The above command will print some lines, like this:
  Intel Corporation PX7450 Network Controller
  ACME 2017 IDE Controller No.1
  USB controller
Now, if you wish to monitor HealthState property of "ACME 2017 IDE Controller No.1", the "Arguments" field for your monitor in IPHostMonitor client should look like this:
-ExecutionPolicy ByPass -File $AppFiles\esxi-cim-filter-class-instance.ps1 -HostEsxi $HostIP -UserName $WindowsUser -UserPassword $WindowsPassword -ClassName CIM_Controller -CreationClassName VMware_PCIDevice -ElementName "*IDE Controller*" -FieldName HealthState
(the asterisk in "-ElementName" parameter are wildcards and mean "any amount of any characters".

You can also include the exact element name, i.e.
-ExecutionPolicy ByPass -File $AppFiles\esxi-cim-filter-class-instance.ps1 -HostEsxi $HostIP -UserName $WindowsUser -UserPassword $WindowsPassword -ClassName CIM_Controller -CreationClassName VMware_PCIDevice -ElementName "ACME 2017 IDE Controller No.1" -FieldName HealthState
For more information, please refer to the mentioned API reference link above.

Support

In case you need assistance with selecting proper class/instance name and/or finding proper CIM class for your monitor, please send us the results of command
powershell -ExecutionPolicy ByPass esxi-cim-getinstance.ps1 -HostEsxi ESXIip -UserName "root" -UserPassword "password" -ClassName "CIM class"
For example, if you need help choosing proper CIM_Controller instance, run the command like
powershell -ExecutionPolicy ByPass esxi-cim-getinstance.ps1 -HostEsxi ESXIip -UserName "root"  -UserPassword "password" -ClassName CIM_Controller > cim-output.txt
and send us the cim-output.txt file it creates, along with explanation of what are you looking for.
If you are unsure which CIM class to use, send the above output for CIM_ManagedSystemElement or CIM_LogicalDevice class (after "-ClassName" parameter, instead of CIM_Controller in the command above) with details on what you are looking for.
ESXI-hardware.zip 5.6K Downloaded: 3356 times
Sign In or Register to comment.