Fan redundancy information is useful to
system administrators who need to monitor system health. This example shows how
to locate system fans and query the CIMOM for redundant fan relationships.
This example shows how to enumerate the fans by
starting from the Interop namespace and traversing associations from the
managed server Scoping Instance.
Locating Redundant Fans
shows the relationships of the CIM objects involved. If the managed server
provides redundant cooling, the redundancy is modeled in the CIMOM by an
instance of CIM_RedundancySet
that is associated with two (or more) redundant fans.
Specify the Interop namespace, supplied as a
parameter, for the connection.
use wbemlib
use sys
use connection renamed cnx
connection = Null
params = cnx.get_params()
if params is Null
sys.exit(-1)
interop_params = params
interop_params['namespace'] = 'root/interop'
connection = cnx.connect_to_host( interop_params )
if connection is Null
print 'Failed to connect to: ' + params['host'] + ' as user: ' + params['user']
sys.exit(-1)
Locate the Base Server Scoping Instance
of CIM_ComputerSystem.
use scoping_instance renamed si
scoping_instance_name = si.get_scoping_instance_name( connection )
if scoping_instance_name is Null
print 'Failed to find server Scoping Instance.'
sys.exit(-1)
Traverse the
CIM_SystemDevice
association to reach the
CIM_Fan
instances on the managed server.
fan_instances = connection.Associators( scoping_instance_name, \
AssocClass = 'CIM_SystemDevice', \
ResultClass = ’CIM_Fan’ )
if len( fan_instances ) is 0
print 'Error: No fans associated with server Scoping Instance.'
sys.exit(-1)
For each fan instance, print the ElementName
and DeviceID
properties.
function print_info( instance )
print '\n' + ’CIM_Fan [' + instance.classname + '] ='
for prop in [ 'ElementName', 'DeviceID' ]
print ' %30s = %s' % ( prop, instance[prop] )
for fan_instance in fan_instances
print_info( fan_instance )
For each fan instance, traverse the CIM_MemberOfCollection
association to reach any instances of CIM_RedundancySet.
For each fan instance, print the redundancy
status. If the fan is not a member of a redundancy set, the redundancy status
is not applicable.
if len( set_instances ) is 0
print ' Redundancy status: N/A'
else
for instance in set_instances
name = instance[’Name’]
status = instance[’RedundancyStatus’]
print ’ redundancy set (%s) status = %s’ %
( instance[’Name’], (status==2 ? ’Fully Redundant’ : ’unknown or degraded’)
A sample of the output looks like the following:
CIM_Fan [OMC_Fan] =
ElementName = FAN 1 RPM
DeviceID = 48.0.32.99
redundancy set (117.0.32.0) status = Fully Redundant
CIM_Fan [OMC_Fan] =
ElementName = FAN 2 RPM
DeviceID = 49.0.32.99
redundancy set (117.0.32.0) status = Fully Redundant