Wednesday, February 24, 2010

Dell system monitoring with WMI

For those who may be interested in checking Dell hardware through scripts there are several ways to do it. I will focus on Windows in this post, and skip over wmic and vbscript, to show some powershell examples of this. For background reference and WMI, there is a useful document at Dell for wmic and a reference guide for Common Information Model administration as well. For some background on Dell's WMI namespace, this has existed for quite some time in Dell OpenManage, starting sometime in version 4.x (I have seen in it 4.4 and higher, though I can't verify earlier versions). The namespace is unique branch on CIMV2, called root\CIMV2\Dell. Some examples of information provided inside this namespace: -Per component details and status -Hardware log retrieval -Component types installed and firmware information -Remote access card component information Using the same WMI capabilities that come with the Dell OpenManage software, we can use Powershell's Get-WMIObject commandlet to pull information from a machine. Using this, you can limit the results displayed similar to the examples of wmic, however the results are objects, so they are much easier to work with for further programming. Here is a basic example
PS C:\> gwmi -namespace root\cimv2\dell -class CIM_PhysicalMemory __GENUS : 2 __CLASS : CIM_PhysicalMemory __SUPERCLASS : CIM_Chip __DYNASTY : CIM_ManagedSystemElement __RELPATH : CIM_PhysicalMemory.CreationClassName="CIM_PhysicalMemory ",Tag="0" __PROPERTY_COUNT : 27 __DERIVATION : {CIM_Chip, CIM_PhysicalComponent, CIM_PhysicalElement, C IM_ManagedSystemElement} __SERVER : myserver __NAMESPACE : root\cimv2\dell __PATH : \\myserver\root\cimv2\dell:CIM_PhysicalMemory.Crea tionClassName="CIM_PhysicalMemory",Tag="0" BankLabel : Capacity : 2147483648 Caption : CreationClassName : CIM_PhysicalMemory DataWidth : 64 Description : FormFactor : 9 HotSwappable : InstallDate : InterleavePosition : Manufacturer : MemoryType : 19 Model : Name : DIMM1_A OtherIdentifyingInfo : PartNumber : PositionInRow : PoweredOn : Removable : Replaceable : SerialNumber : SKU : Speed : 2 Status : OK Tag : 0 TotalWidth : 72 Version : __GENUS : 2 __CLASS : CIM_PhysicalMemory __SUPERCLASS : CIM_Chip __DYNASTY : CIM_ManagedSystemElement __RELPATH : CIM_PhysicalMemory.CreationClassName="CIM_PhysicalMemory ",Tag="1" __PROPERTY_COUNT : 27 __DERIVATION : {CIM_Chip, CIM_PhysicalComponent, CIM_PhysicalElement, C IM_ManagedSystemElement} __SERVER : myserver __NAMESPACE : root\cimv2\dell __PATH : \\myserver\root\cimv2\dell:CIM_PhysicalMemory.Crea tionClassName="CIM_PhysicalMemory",Tag="1" BankLabel : Capacity : 2147483648 Caption : CreationClassName : CIM_PhysicalMemory DataWidth : 64 Description : FormFactor : 9 HotSwappable : InstallDate : InterleavePosition : Manufacturer : MemoryType : 19 Model : Name : DIMM1_B OtherIdentifyingInfo : PartNumber : PositionInRow : PoweredOn : Removable : Replaceable : SerialNumber : SKU : Speed : 2 Status : OK Tag : 1 TotalWidth : 72 Version :
As you can see, this provides a lot of attributes, many of which are not read by the system. You can filter out what you want with Select-Object, such as: PS C:\> gwmi -namespace root\cimv2\dell -class CIM_PhysicalMemory|select-object name,status name status ---- ------ DIMM1_A OK DIMM1_B OK This provides a nice summary of a component. You can easily do follow on processing to look for bad components, such as a foreach loop on the result and list where status does not match "OK". If you are looking for a solution in a mixed hardware environment where not all servers may be up to date for OMSA, and updating is not an easy task, a work around is to set your erroraction to silentlycontinue, read the error message of the wmi connection and direct the user to use the web interface for omsa or a command line tool like omreport to collect the information. For more examples of code, you can use scriptomatic to look through the namespace and test what information is available. I also have a few examples posted on Microsoft's technet script center.

1 comment:

  1. I have posted some expanded code examples and working script at http://poshcode.org/1812

    ReplyDelete