VMware

VMware vSphere Health Check Report v1.2

VERSION 6 Published

Created on: Apr 21, 2009 11:24 PM by lamw - Last Modified:  Sep 23, 2009 7:40 PM by lamw

Description:


This script generates a health check report similiar to that of vmwareHealthCheckScript but for the new vSphere release of VMware ESX(i) 4.x and VMware vCenter 4.x and it's managed entities.


The script reports on the following:

  • New New licensing format/summary
  • New EVC Enabled information
  • New Cluster VM monitoring
  • New Cluster Host monitoring
  • New # of VMotions within a cluster
  • New Datastore uncommitted info
  • New CPU power management info
  • New VM info (FT, Record/Replay, Clean Poweroff)
  • New Host IPv6, FT, SSL Thumbprint
  • New Host Profiles
  • New vApp information
  • New Distributed vSwitch information
  • vCenter Build/Release
  • 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 (standard) and here (detailed)

Requirements:


Usage


[vi-admin@rafaeli ~]$ ./vmwarevSphereHealthCheck.pl
Required command option 'type' not specified.

Synopsis: ./vmwarevSphereHealthCheck.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. Please add ".html" extension
   --type (required)
      Type: [vcenter|datacenter|cluster|host|detail-hosts]


Common VI options:
   --config (variable VI_CONFIG)
      Location of the VI Perl configuration file
   --credstore (variable VI_CREDSTORE)
      Name of the credential store file defaults to <HOME>/.vmware/credstore/vicredentials.xml on Linux and <APPDATA>/VMware/credstore/vicredentials.xml on Windows
   --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:

./vmwarevSphereHealthCheck.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:

./vmwarevSphereHealthCheck.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:

./vmwarevSphereHealthCheck.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:

./vmwarevSphereHealthCheck.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.

./vmwarevSphereHealthCheck.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 [number_of_lines]
(e.g.)
./vmwarevSphereHealthCheck.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):

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

# orange < 15 %
my $orange_warn = 15;

# 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:

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

# orange < 30 days
my $snap_orange_warn = 30;

# red < 60 days+
my $snap_red_warn = 60;

Changes


##########################################################################
05-24-2009 - v1.2
Fixes:
-Minor fix in nDVS that was causing script to halt

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

05-04-2009 - v1.1
Enhancements:
-Display additional VM Storage details (committed,uncommitted and unshared)



TO-DO/WIP

-None atm

Known Issues

-None atm
Attachments:
Average User Rating
(0 ratings)




Jun 22, 2009 8:25 AM vancod  says:

I've noted that with the vMA on ESX3.5U4 I get an error with the .9.4 script you have also graced us with. Is it even worth an attempt to try this script (with the vMA) on older hosts?

I am assuming the it's a VIMA/.9.4/ESX3.5.x and vMA/1.2/vSphere kind of relationship....

Jun 22, 2009 7:12 PM lamw  says: in response to: vancod

If you look at the requirements in the documentation you'll see one is for pre-vSphere and the other is for vSphere.

The relationship is the following:

VIMA 1.0 + ESX(i) 3.5u2+ = VMware Health Check Report v0.9.4
vMA 4.0 + ESX(i) 4.0+ = VMware vSphere Health Check Report v1.2


=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at: http://engineering.ucsb.edu/~duonglt/vmware/
vGhetto Script Repository
VMware Code Central - Scripts/Sample code for Developers and Administrators
http://twitter.com/lamw

http://engineering.ucsb.edu/~duonglt/vmware/vexpert_silver_icon.jpg

If you find this information useful, please award points for "correct" or "helpful".

Aug 24, 2009 4:17 AM Bers  says:

How to scheduler this report on daily basis and email it automatically?

Thanks in advance.

Aug 24, 2009 5:40 AM vancod  says: in response to: Bers

If you're launching it from a Windows box I would guess that you could do it as a couple of scheduled tasks (1> generate 2> email).

If you're doing it from the vMA it would be a cron job.

Maybe someone with direct experience will chime in, but examples of both should be on the interwebs.

Oct 6, 2009 5:40 AM IPF  says: in response to: vancod

What an awesome script! If anyone knows how to schedule this as a Scheduled Task in Windows 2008 please post it. It would help greatly!

Oct 6, 2009 6:36 AM vancod  says: in response to: IPF

@IPF - I've seen other scripts here that do this, I just don't recall which off top of my head. I'm sure a search will get you an answer...

Oct 6, 2009 8:05 AM IPF  says: in response to: vancod

I've got as far as creating a .bat file with the following:

START "C:\Program Files\VMware\VMware vSphere CLI\Perl\bin\perl.exe" "C:\Scripts\vmwarevSphereHealthCheck.pl" --server SERVER --username USERNAME --password PASSWORD --type vcenter"

When I run the .bat file it runs great. As a scheduled task...nothing happens. I've tried just the command in the scheduled task as well...nothing.

Oct 7, 2009 7:01 AM IPF  says: in response to: IPF

There has to be someone who has created a scheduled task? Anyone?

Oct 7, 2009 9:05 AM vancod  says: in response to: IPF

I so have to learn to copy my comments into my paste buffer before trying to hit submit on these sh*t forums... I lost a much longer post

Anyway -
Remove the "START"

Pass a "-- report" option - your command just send the output to null space

Start your task or specify your file output path as required or you'll be hunting for the result.

William - I use the vMA mostly, but am getting wonky results

"Can't use an undefined value as an ARRAY reference at ./vmwarevSphereHealthCheck.pl line 1114."

  • my licensing data is screwy (shows negatives)
  • the "Features" section has headers on top and sides, but no actual table data at all (not even empty cells)
  • my cluster hosts show up fine but my stand-alone host is ignored (I think this was a legacy known issue?)

Oct 7, 2009 7:58 PM lamw  says: in response to: vancod

Please provide the exact syntax you're using with all the command line flags to help me better understand your issue.

Are you using vMA 4.0? and what is your environment like both vCenter and ESX(i) systems? build/versions?

Regarding line #1114, this refers to the following:

my $luns = $host->config->storageDevice->scsiLun;
      foreach (sort {$a->canonicalName cmp $b->canonicalName} @$luns) {


If you don't have any LUN(s) or have only one LUN, it should still process. I'm not sure why it's not.

=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at: http://engineering.ucsb.edu/~duonglt/vmware/
vGhetto Script Repository
VMware Code Central - Scripts/Sample code for Developers and Administrators
VMware Developer Comuunity
Twitter: @lamw

http://engineering.ucsb.edu/~duonglt/vmware/vexpert_silver_icon.jpg

If you find this information useful, please award points for "correct" or "helpful".

Oct 8, 2009 6:18 AM vancod  says: in response to: lamw

Syntax (used on both my XP-based perl toolkit and the vMA):
vmwarevSphereHealthCheck.pl" --server 192.168.2.160 --username Administrator --password xxxxxx --type vcenter --report vCenter.html

The vMA:

  • it is the 4.0 release
  • there's a security patch I have yet to apply, but is otherwise up-to-date / current

Env:
(these are all "real" machines - no VMs / tomfoolery)
vSphere vCenter (also has FUNCTIONING legacy license server, it was an upgrade from 2.5)
Single vSphere ESXi host that is stand-alone
Pair of vSPhere hosts (one ESX, one ESXi) in a cluster
  • all are current (patched)

All have single active GigE connection at present

All use a single NFS share (RHEL based server should it matter)

I have a couple of licenses at present and can detail if required.

I will send you a link to the output via PM

Oct 8, 2009 6:56 AM lamw  says: in response to: vancod

With the information you've provided, here is what I'm thinking:

Is the vCenter fully managing all ESX(i) 4.0 hosts? If so, then the licensing server from VI3.5 might be what's causing the issue since the licensing portion of the API has significantly changed between VI and vSphere ... which could explain why it's off. If you don't for see needing the license server, can you try uninstalling and re-running the report to see if license output is fixed? This was one of the main reason I had two separate health check scripts for VI 3.5 and vSphere 4.0 due to the differences in the APIs.

Regarding the stand alone host, if it's not part of a vCenter cluster, it will not be caught by the script and that is a requirement. How is your ESX(i) host connected to your vCenter? Can you provide me with the inventory breakdown (e.g. hosta/b are in cluster1 and hostc is in cluster/etc?)

=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at: http://engineering.ucsb.edu/~duonglt/vmware/
vGhetto Script Repository
VMware Code Central - Scripts/Sample code for Developers and Administrators
VMware Developer Comuunity
Twitter: @lamw

http://engineering.ucsb.edu/~duonglt/vmware/vexpert_silver_icon.jpg

If you find this information useful, please award points for "correct" or "helpful".

Oct 8, 2009 8:40 PM vancod  says: in response to: lamw

At present, yes, vCenter is managing 4.0 hosts only. Until only a couple days ago I maintained a 3.5 host. Customer requirement (I'm a working consultant by trade) will likely mean another 3.5 host sooner or later.

However, I can test with the licensing server off (is uninstalling really required?) I will say that I have a number of customers that will have both legacy and vSphere based licensing simply because of the upgrade process and internal requirement - I hope the script can be made happy by just killing the legacy service for a few ticks. I will test this tomorrow as time permits.

Yes - my one host is, at present, outside a cluster, and I thought I recalled that this was a limitation / requirement of the script. SO basically I have hast a & b in a cluster, and host c is "a loner". But again, this changes frequently as required.

VMware Developer

SDKs, APIs, Videos, Learn and much more in the Developer community.

Learn More

Developer Sample Code

Increase your developer productivity with VMware API sample code.

Learn More

VMworld Sessions & Labs

Online access to the latest VMworld Sessions & Labs and online services.

Learn more

Purchase PSO Credits Online

Purchase credits to redeem training and consulting services online.

Buy Now

Community Hardware Software

View reported configurations or report your own.

Learn More

VMware vSphere

Come witness the next giant leap in virtualization.

Register Today

Communities