VMware {code} Community
qc4vmware
Virtuoso
Virtuoso
Jump to solution

Locating the api call for the information displayed on the Hardware Status tab summary

I am trying to find the information which is displayed in the Hardware Status tab.  Mainly the summary at the top.  I can locate most of the information walking through the managed object browser but what I need are the serial numbers and asset tags that are listed.  I need to update a machine database with this information.  Attached is a screen shot.

Screen Shot 2012-06-01 at 4.49.38 PM.png

0 Kudos
1 Solution

Accepted Solutions
venkyVM
Enthusiast
Enthusiast
Jump to solution

This can simply be done using the CIM API:

From a remote CIM Client issue the following. I use wbemcli (apt-get install wbemcli on Ubuntu)

wbemcli ei -nl -noverify 'https://root:<password>@<hostname>:5989/root/cimv2:CIM_Chassis' Tag,SerialNumber
Result
=====
<hostname>:5989/root/cimv2:OMC_Chassis.CreationClassName="OMC_Chassis",Tag="23.0"
-Tag="23.0"
-SerialNumber="XXXXXXX"

View solution in original post

0 Kudos
6 Replies
lamw
Community Manager
Community Manager
Jump to solution

All this information is avaiable as part of the HostSystemHealthStatusSystem - http://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.wssdk.apiref.doc_50%2Fvim.host.Healt...

0 Kudos
qc4vmware
Virtuoso
Virtuoso
Jump to solution

So when I use the managed object browser I am have no problems locating all of the sensor information etc which is what is listed below the summary... it is just the couple of items located up at the top in the summary I mentioned.  I see the bios version info under HostHardwareInfo.biosInfo and I find the manufacturer and model in the HostSystemInfo data object. What I can't locate are the "Serial", "Tag", and "Asset Tag" values.  After doing some more digging it looks like the information I need is located here: http://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.wssdk.apiref.doc_50%2Fvim.host.Syste... .  When I navigate to this via the MOB though the values are listed as "unset"

0 Kudos
lamw
Community Manager
Community Manager
Jump to solution

0 Kudos
venkyVM
Enthusiast
Enthusiast
Jump to solution

This can simply be done using the CIM API:

From a remote CIM Client issue the following. I use wbemcli (apt-get install wbemcli on Ubuntu)

wbemcli ei -nl -noverify 'https://root:<password>@<hostname>:5989/root/cimv2:CIM_Chassis' Tag,SerialNumber
Result
=====
<hostname>:5989/root/cimv2:OMC_Chassis.CreationClassName="OMC_Chassis",Tag="23.0"
-Tag="23.0"
-SerialNumber="XXXXXXX"
0 Kudos
qc4vmware
Virtuoso
Virtuoso
Jump to solution

This works for me and I also seemed to be able to get it working with pywbem.  I did run into one issue since the host I was testing against had an '@' in the password.  Do you know if it is possible to still use the command line against systems which have an '@' in the password?  I tried using an escape in front of the @ sign but that did not seem to do the trick.

0 Kudos
qc4vmware
Virtuoso
Virtuoso
Jump to solution

I figured I would follow up with a little more detail of how I got this working with pywbem:

1. install python and pywbem on a scripting host.

2. Create a workflow or action that uses the ssh plugin.

3. Create a script similar to this on your scripting host:

import pywbem,sys
# Make connection
esxHost = sys.argv[1]
username = sys.argv[2]
pwd = sys.argv[3]
conn = pywbem.WBEMConnection('https://' + esxHost,     # url
                             (username, pwd),  # credentials
                                default_namespace = 'root/cimv2')
# Get all CIM_System instances
names = conn.EnumerateInstanceNames('CIM_System')
# Call GetInstance on returned instances
for n in names:
    chassis = conn.GetInstance(n)
    keystoprint = ['Tag', 'SerialNumber', 'OtherIdentifyingInfo']
    for key, value in chassis.items():
        if key in keystoprint:
            print '%s = %s' % (key, value)

4. This will actaully only return values for 'OtherIdentifyingInfo' I was using the same script to test against other instance types and spit out any values for Tag and Serial Number as well.  I found with some of our older blade systems that the tagging was not consistent.  It seems like in newer systems there are always Tags 23 and 23.1 (Host and Chassis) .  VMware will display both of these if they are found but in some of the older HP blades there was only tags for the chassis and not the Host.  In OtherIdentyingInfo is where they would put the hosts serial which is what we needed.  This value seems consistent for the newer blades as well so that is the field we are extracting.  Hope this ends up helping some folk in the future.

0 Kudos