VMware Health Check Report v0.9.4

This script generates a health check report of all attributes pertaining to a single ESX/ESXi 3.x+ host or VMware vCenter and its managed entities (i.e. clusters and individual ESX/ESXi 3.x+ hosts). The generated report is based off of some earlier Powershell script work created by Ivo Beerens/Duncan Eppping.

I was primarily motivated on this project because it allowed me to start learning about how to utilize the VI API through the VI Perl Toolkit. Existing information provided by the RCLI and VI Perl Toolkit default utilities are useful though they can be limited. This gave me an opportunity to learn how to write my own Perl scripts that may ultimately lead to more functional tools that the community as well as VI administrators can utilize.

The generated health check report contains most of what Ivo Beerens has included in his latest release. For this project, I am attempting to create a non-Powershell solution as opposed to the direction taken by Ivo and Duncan. This Perl script will generally be a work in progress as I continue to learn about the API. Moreover, I hope that this will be something of use to administrators especially those seeking to query important pieces of information such as VM(s) containing snapshots and/or RDM(s).
The script reports on the following:

  • vCenter Build/Release
  • License summary
  • Active Sessions
  • ESX/ESXi Build/Release
  • Cluster(s) Name/Statistics (Hosts,CPU and MEM availabity, HA,DRS and DPM enabled, Resource Pools, Health)
  • ESX/ESXi Hardware configuration (NICs/HBAs)
  • ESX/ESXi Hardware Health Sensor via CIM
  • ESX/ESXi State
  • ESX/ESXi Configurations (for detailed information, use detail-hosts option)
  • ESX/ESXi Multipathing Info (only available in host or detail-hosts option)
  • ESX/ESXi Datastore summary
  • ESX/ESXi LUN summary
  • ESX/ESXi Portgroup summary
  • ESX/ESXi Hostd logs
  • CDP Summary
  • Recent Tasks
  • Virtual Machine summary
  • VM Storage summary
  • VM Network summary
  • VM w/Snapshots
  • VM w/Snapshot delta age
  • VM w/RDMs
  • VM w/NPIV enabled
  • VM w/connected CD-ROMs
  • VM w/connected Floppys

For more details, please take a look at the sample reports located here and here

Requirements:

Usage

[vi-admin@vima-primp-industries ~]$ ./vmwareHealthCheck.pl
Required command option 'type' not specified.

Synopsis: ./vmwareHealthCheck.pl OPTIONS

Command-specific options:
   --cluster
      The name of a vCenter cluster
   --datacenter
      The name of a vCenter datacenter
   --logcount
      The number of lines to output from hostd logs
   --report
      The name of the report to output
   --type (required)
      Type: [vcenter|datacenter|cluster|host|detail-hosts]

Common VI options:
   --config (variable VI_CONFIG)
      Location of the VI Perl configuration file
   --encoding (variable VI_ENCODING, default 'utf8')
      Encoding: utf8, cp936 (Simplified Chinese), iso-8859-1 (German), shiftjis (Japanese)
   --help
      Display usage information for the script
   --passthroughauth (variable VI_PASSTHROUGHAUTH)
      Attempt to use pass-through authentication
   --passthroughauthpackage (variable VI_PASSTHROUGHAUTHPACKAGE, default 'Negotiate')
      Pass-through authentication negotiation package
   --password (variable VI_PASSWORD)
      Password
   --portnumber (variable VI_PORTNUMBER)
      Port used to connect to server
   --protocol (variable VI_PROTOCOL, default 'https')
      Protocol used to connect to server
   --savesessionfile (variable VI_SAVESESSIONFILE)
      File to save session ID/cookie to utilize
   --server (variable VI_SERVER, default 'localhost')
      VI server to connect to. Required if url is not present
   --servicepath (variable VI_SERVICEPATH, default '/sdk/webService')
      Service path used to connect to server
   --sessionfile (variable VI_SESSIONFILE)
      File containing session ID/cookie to utilize
   --url (variable VI_URL)
      VI SDK URL to connect to. Required if server is not present
   --username (variable VI_USERNAME)
      Username
   --verbose (variable VI_VERBOSE)
      Display additional debugging information
   --version
      Display version information for the script

Supported Use Cases:

1) This will collect information about all cluster(s)/host(s) providing vCenter Server:

./vmwareHealthCheck.pl --server VC_SERVER --username VC_USERNAME --password VC_PASSWORD --type vcenter

2) This will collect information about a specific datacenter provided with vCenter Server:

./vmwareHealthCheck.pl --server VC_SERVER --username VC_USERNAME --password VC_PASSWORD --type datacenter --datacenter DATACENTER_NAME

3) This will collect information about a specific cluster provided with vCenter Server:

./vmwareHealthCheck.pl --server VC_SERVER --username VC_USERNAME --password VC_PASSWORD --type cluster --cluster CLUSTER_NAME

4) This will collect information about a specific host provided with ESX/ESXi Server:

./vmwareHealthCheck.pl --server ESX_ESXi_SERVER --username ESX_ESXi_USERNAME --password ESX_ESXi_PASSWORD --type host

5) This will collect detail information about all ESX/ESXi hosts under vCenter (for datacenter/cluster specific, please look at option 1-3).

This option is meant to provide a report similiar to that of esxhealthscript within the capablities of the VI API utilizing the VI Perl Toolkit. For a high level view of your VMware environment, please use the other options, as this pertains to detail configurations of your hosts.

./vmwareHealthCheck.pl -server VC_SERVER --username VC_USERNAME --password VC_PASSWORD --type detail-hosts

To specify the number of the latest lines in the hostd logs, use –logcount {noformat}number_of_lines{noformat}
(e.g.)

./vmwareHealthCheck.pl -server VC_SERVER --username VC_USERNAME --password VC_PASSWORD --type detail-hosts --logcount 20

Custom Configurations

Edit the following at the top of the script to configure the warning levels for the various resource consumptions (disk,memory,cpu):

####################################
{noformat}#{noformat} resource consumption warnings
####################################
{noformat}#{noformat} yellow < 30 %
my $yellow_warn = 30;

{noformat}#{noformat} orange < 15 %
my $orange_warn = 15;

{noformat}#{noformat} red < 10%
my $red_warn = 10;

Edit the following at the top of the script to configure the number of days aged for a snapshot delta file:

######################################
{noformat}#{noformat} vm snapshot age warnings
######################################
{noformat}#{noformat} yellow < 15 days
my $snap_yellow_warn = 15;

{noformat}#{noformat} orange < 30 days
my $snap_orange_warn = 30;

{noformat}#{noformat} red < 60 days+
my $snap_red_warn = 60;

Changes

##########################################################################

03-24-2009 – v0.9.4
Fixes:
-There was a bug reported by Duncan Epping and others regarding hosts that were appearing in the wrong cluster with respect to the portgroup listings, this should be fixed.

Enhancements:
-Detail Hardware Health sensor readings provided by CIM
-CDP Summary (individual cdp.pl available)

##########################################################################

02-28-2009 – v0.9
Fixes:
-Due to VMware API bug, the VMDK count per VM is not displaying correctly, a work around has been setup to print # of disks

Enhancements:
-Retrieve script version by using –version
-Cluster Health
-Recent Tasks

##########################################################################

02-11-2009 – v0.8
Fixes:
-Fixed an issue where disconnected VM(s) may cause the script to halt

Enhancements:
-Added hostd logs with –logcount flag to specify the last number of lines (default 15 lines)
-Performance enhancement, script should execute much faster (YMMV)

Example report here

##########################################################################

02-09-2009 – v0.7
Fixes:
-Removed invalid cluster stats (output was not regarding consumption but availablity)
-Fixed an issue that may allow the script to execute on Windows VI Perl Toolkit again(no guarantees)

Enhancements:
-Licensing/features information
-Active Sessions
-ESX UUID
-Additional ESX/ESXi host configurations (available with host or detail-hosts flag)
-Performance increase on script execution (YMMV)
-Added detail-hosts flag which provides additional host configurations (comparable to esxhealthscript)

  • VMotion enabled
  • Service Console network summary
  • VMkernel summary
  • DNS
  • Offload capabilities
  • Diagostic Partition
  • vswif summary
  • vSwitch/cdp summary
  • Firewall known services
  • …much more

Example report here

##########################################################################

02-05-2009 – v0.6
Fixes:
-Fixed minor typographic errors
-Fixed issue if no additional hardware vendor information is available
-Fixed potential issue with displaying information about datastores not being accessible

Enhancements:
-Display snapshot deleta file(s) age (options configurable by users)
-Display root resource pool information if appliacable

##########################################################################

02-04-2009 – v0.5
Fixes:
-Cleaned up a little of the html structure
-Fixed issue when no ntpServers configured
-Fixed issue when VMware tool status is not available
-Fixed the order of the Adv options
-Fixed Host to Datastore access (If a datastore is presented to hosts that reside in separate clusters, false positives may be included in the output)

Enhancements:
-Added support for –datacenter argument for specifying a specific datacenter in vCenter
-Additional hardware info (possibly AssetTag if configured)
-Display Adv options: Disk.SchedNumReqOutstanding and NFS.LockDisable

##########################################################################

02-01-2009 – v0.4
Fixes:
-Only display summary on valid clusters (w/hosts attached)

Enhancements:
-Display hosts in cluster with inconsistent storage presentation
-Display hosts in cluster with inconsistent portgroup configurations
-Display Disk.UseDeviceReset
-Display Disk.UseLunReset

##########################################################################

02-02-2009 – v0.4
Fixes:
-Fixed color output to highlight the correct values
-Fixed the output of the script execution time to output correct time format

Enhancements:
-Display MB,GB,TB and MHz,GHz instead of just (MB,MHz)
-Display cluster resources % free
-Display hosts in cluster with inconsistent LUN access


TO-DO/WIP

-None atm

Known Issues

1) Firewall information is limited to only known and blessed services, this is a limitation of the VI API

2) Multiple Service Console interfaces may not display correctly

3) SNMP infor (may or may not work)

Source : http://communities.vmware.com/docs/DOC-9420

Posted in VMWare and tagged , , .

Leave a Reply