#!/usr/bin/python # # Script for checking the serial number of the chassis where is installed the VmWare ESXi # # Licence : GNU General Public Licence (GPL) http://www.gnu.org/ #--------------------------------------------------- # Date : 20110209 # Author : Aitor Arregi # Notes : The original idea it was from the plugin "check_esx_wbem.py" # url : http://exchange.nagios.org/directory/Plugins/Operating-Systems/*-Virtual-Environments/VMWare/Check-hardware-running-VMware-ESXi/details #--------------------------------------------------- import sys import pywbem wbemclient = pywbem.WBEMConnection(sys.argv[1], (sys.argv[2], sys.argv[3]), 'root/cimv2') for instance in wbemclient.EnumerateInstances('CIM_PhysicalElement') : if instance['ElementName'] == 'Chassis' : print "%s" % (instance['SerialNumber'])