VMware vSphere Health Check Report v5.1.0

VMware vSphere Health Check Report v5.1.0

Table of Contents

  • Author

  • Description

  • Sample Report

  • Requirements

  • Usage

  • Setup

  • Supported Use Cases

  • Additional Commandline Options

  • Custom Report Configuration

  • Setup & Run Health Check Script on Windows

  • Change Log

Author

William Lam

-


Description:

This script generates a health check report similar to that of vmwareHealthCheckScript but for the new vSphere release of VMware ESX(i) 4.x/5.x and VMware vCenter 4.x/5.x and it's managed entities. User's can now fully customize the report based on the categories that are of importance to their operating environment, including selecting specific set of ESX(i) hosts and/or Virtual Machines.

The script reports on the following:

  • New vCenter Information including InstanceUUID and hostname
  • New Storage DRS Configuration
  • New FDM/HA Heartbeat Policy and State
  • New Host details (Host Agent, iSCSI, FCoE, Source Packages, Capablities, SMC Hardware, Host Cache, DVS)
  • New Virtual Machine details (HW Version, Firmware, Overhead Memory, Swap, State, Snapshot Consolidation, HA Protection, EZT Disks)
  • New updated Color mappings for mulitpath states
  • New Support for Standalone ESX(i) hosts without vCenter Cluster
  • New updated Color scheme for HTML Report
  • DRS GROUP/VM Rules
  • HA Configuration Issues
  • COS VMDK Information
  • Storage I/O COntrol Information
  • Host Authentication Services
  • VM count per datastore
  • VM count / VM-to-Host Ratio in Cluster Section
  • Report is now completely modular in which categories to display via a configuration file

  • Report can be configured to output as printer friendly format

  • Ability to specify specific ESX/ESXi host to query

  • Ability to specify specific Virtual Mchines to query

  • vCenter HA Advanced Runtime information

  • vCenter HA Configuration (primary/secondary and node states)

  • vCenter HA Advanced Configurations

  • vCenter DRS Advanced Runtime information

  • vCenter Resource Pool CPU/MEMORY shares

  • vCenter Plugin information

  • ESX/ESXi IP/HOSTNAME of vCenter Management IP

  • ESX/ESXi Newly improved Hardware and System Health Stuats information

  • ESX/ESXi Advanced Configurations

  • ESX/ESXi NUMA information

  • ESX/ESXi Datastore VMFS block size + version

  • ESX/ESXi Host capabilities

  • ESX/ESXi Lockdown Mode information

  • VM UUID,Bootime,Resource Statistics, Fault Tolerance, Thin provisioned and NPIV information

  • VM Resource Allocation information

  • VM Device information

  • Supports multiple email recipients

  • vCenter VPX Configurations summary

  • VMware Applications running in a VM

  • vCenter Managed IP per ESX(i) host

  • vCenter User/Group Permissions

  • Added Host & SCSI LUN Model attribute

  • Added Host boottime

  • Additional LUN Mapping information including Datastore,VolumeUUID,DiskName and DeviceName

  • VM portgroup + dvportgroup mapping

  • Performance Stats for both Cluster + Hosts (cpu/mem avg + %)

  • Performance Stats for VM (cpu/mem avg + %, ready & ballon)

  • Email report capability

  • Added additional command line options for including Cluster,Host and VM Performance stats (default: off)

  • New licensing format/summary

  • EVC Enabled information

  • Cluster VM monitoring

  • Cluster Host monitoring}

  • # off VMotions within a cluster

  • Datastore uncommitted info

  • CPU power management info

  • VM info (FT, Record/Replay, Clean Poweroff)

  • Host IPv6, FT, SSL Thumbprint

  • Host Profiles

  • vApp information

  • 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


Sample Report

For more details, please take a look at the following sample report: here

Issues/Feature Request

Please join the vSphereHealthCheck Group to post comments/discussions


Requirements:


Usage

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

Synopsis: ./vmwarevSphereHealthCheck.pl OPTIONS


Command-specific options:
   --cluster
      The name of a vCenter cluster to query
   --clusterperformance (default 'no')
      Enable Cluster Performance gathering [yes|no] (Can potentially increase your runtime)
   --conf
      File containing Host and VM specific configurations to output
   --datacenter
      The name of a vCenter datacenter to query
   --demo (default 'no')
      [yes|no]
   --email (default 'no')
      [yes|no]
   --hostlist
      File containting list of ESX/ESXi host(s) to query
   --hostperformance (default 'no')
      Enable Host Performance gathering [yes|no] (Can potentially increase your runtime)
   --logcount (default '15')
      The number of lines to output from hostd logs
   --printerfriendly (default 'no')
      Whether the html output will be printer friendly [yes|no]
   --report (default 'vmware_health_report.html')
      The name of the report to output. Please add ".html" extension
   --type (required)
      Type: [vcenter|datacenter|cluster|host]

   --vmlist
      File containting list of VM(s) to query
   --vmperformance (default 'no')
      Enable VM Performance gathering [yes|no] (Can potentially double your runtime)

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

-


Setup

1. Download the packaged script vmwarevSphereHealthCheck.tar.gz and transfer it to your vMA host

2. Extract the contents:

[vi-admin@scofield ~]$ tar -zxvf vmwarevSphereHealthCheck.tar.gz
vmwarevSphereHealthCheck/
vmwarevSphereHealthCheck/vmwarevSphereHealthCheck.pl
vmwarevSphereHealthCheck/healthCheck.conf

3. You should now have a directory called vmwarevSphereHealthCheck and the script is located inside with a sample configuration file

4. If you decide to create a custom user to run this script, ensure the user has a minimum of the following permissions:

Datastore.Browse
Global.Diagnostics
Global.Licenses
Sessions.TerminateSession
Sessions.ValidateSession
System.Anonymous
System.Read
System.View


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

-


Additional Commandline Options:

Use a configuration file

./vmwarevSphereHealthCheck.pl --server VC_SERVER --username VC_USERNAME --password VC_PASSWORD --type vcenter --conf healthCheck.conf

Please take a look at the sample healthCheck.conf configuration file attached down below

Specify specific ESX/ESXi hosts to query

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

where hostlist can be any filename that contains the display name of a ESX/ESXi separated by a newline

e.g.

[vi-admin@scofield ]$ cat hostlist
esx4-1.primp-industries.com
esx4-2.primp-industries.com
esxi4-1.primp-industries.com
esxi4-2.primp-industries.com

Specify specific Virtual Machines to query

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

where vmlist can be any filename that contains the display name of a Virtual Machines separated by a newline

e.g.

[vi-admin@scofield ]$ cat vmlist
Norman-CL1
ft-test-vm
VA-Tomcat
reflex-g2
vMA-2
build-centos
build-ubuntu
sam3testV2
Rhapsody
goldmaster
test-vm1
test-vm2
dummy

Email report

./vmwarevSphereHealthCheck.pl -server VC_SERVER --username VC_USERNAME --password VC_PASSWORD --type vcenter --email yes

Note:

Ensure that you have all the email variables configured either within the script or in the external configuration file, else the report will not be sent.

Hostd Log

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 vcenter --logcount 20

Cluster Performance Stats

To collect basic performance stats from all Clusters, note that the duration of the script may potentially increase. Only use if you need and by default it's disabled.

(e.g.)

./vmwarevSphereHealthCheck.pl -server VC_SERVER --username VC_USERNAME --password VC_PASSWORD --type vcenter --clusterperforamnce yes

Host Performance Stats

To collect basic performance stats from all Hosts, note that the duration of the script may potentially increase. Only use if you need and by default it's disabled.

(e.g.)

./vmwarevSphereHealthCheck.pl -server VC_SERVER --username VC_USERNAME --password VC_PASSWORD --type vcenter --hostperformance yes

VM Performance Stats

To collect basic performance stats from all VMs, note that the duration of the script may potentially double. Only use if you need and by default it's disabled.

(e.g.)

./vmwarevSphereHealthCheck.pl -server VC_SERVER --username VC_USERNAME --password VC_PASSWORD --type vcenter --vmperforamnce yes

Output printer friendly format

This will update the CSS in the html report to allow you to print the report in a friendly format

./vmwarevSphereHealthCheck.pl -server VC_SERVER --username VC_USERNAME --password VC_PASSWORD --type vcenter --printerfriendly yes

-


Custom Report Configuration

There are 54 parameters that can be configured to display various categories of the health check report. By default, everything is set to "yes" except the following 4:

CLUSTER_PERFORMANCE

HOST_PERFORMANCE

VM_PERFORMANCE

VM_DELTA

as these can potentially increase the amount of time the report takes to generate.

###################
## EMAIL OPTIONS ##
###################

EMAIL_HOST=mail.primp-industries.com
EMAIL_DOMAIN=primp-industries.com
EMAIL_TO=william@primp-industries.com,tuan@primp-industries.com,monitoring@primp-industries.com
EMAIL_FROM=vMA@primp-industries.com

###################################
## RESOURCE CONSUMPTION WARNINGS ##
###################################
# yellow < 30%
# orange < 15%
# red < 10%

YELLOW_WARN=30
ORANGE_WARN=15
RED_WARN=10

############################
##  SNAPSHOT AGE WARNINGS ##
############################
# yellow > 15 days
# orange > 30 days
# red > 60 days
SNAPSHOT_YELLOW_WARN=15
SNAPSHOT_ORANGE_WARN=30
SNAPSHOT_RED_WARN=60

#################
## SYSTEM INFO ##
#################
SYSTEM_LICENSE=yes
SYSTEM_FEATURE=yes
SYSTEM_PERMISSION=yes
SYSTEM_SESSION=yes
SYSTEM_HOST_PROFILE=yes
SYSTEM_PLUGIN=yes

#################
## DVS
#################
DVS_SUMMARY=yes
DVS_CAPABILITY=yes
DVS_CONFIG=yes

###############################
## DATASTORE CLUSTER OPTIONS ##
###############################
DATASTORE_CLUSTER_SUMMARY=yes
DATASTORE_CLUSTER_POD_CONFIG=yes
DATASTORE_CLUSTER_POD_ADV_CONFIG=yes
DATASTORE_CLUSTER_POD_STORAGE=yes

#####################
## CLUSTER OPTIONS ##
#####################

CLUSTER_SUMMARY=yes
CLUSTER_PERFORMANCE=no
CLUSTER_HA=yes
CLUSTER_DRS=yes
CLUSTER_DPM=yes
CLUSTER_AFFINITY=yes
CLUSTER_RP=yes
CLUSTER_VAPP=yes

##################
## HOST OPTIONS ##
##################

HOST_HARDWARE_CONFIGURATION=yes
HOST_MGMT=yes
HOST_STATE=yes
HOST_HEALTH=yes
HOST_PERFORMANCE=no
HOST_NIC=yes
HOST_HBA=yes
HOST_ISCSI=yes
HOST_CAPABILITY=yes
HOST_CONFIGURATION=yes
HOST_ADVOPT=yes
HOST_AGENT=yes
HOST_NUMA=yes
HOST_CDP=yes
HOST_LUN=yes
HOST_DATASTORE=yes
HOST_CACHE=yes
HOST_MULTIPATH=yes
HOST_PORTGROUP=yes
HOST_DVS=yes
HOST_LOG=yes
HOST_TASK=yes

################
## VM OPTIONS ##
################

VM_STATE=yes
VM_CONFIG=yes
VM_STATS=yes
VM_RESOURCE_ALLOCATION=yes
VM_PERFORMANCE=no
VM_FT=yes
VM_EZT=yes
VM_THIN=yes
VM_DEVICE=yes
VM_STORAGE=yes
VM_NETWORK=yes
VM_SNAPSHOT=yes
VM_DELTA=no
VM_CDROM=yes
VM_FLOPPY=yes
VM_RDM=yes
VM_NPIV=yes
VM_TOOL=yes

#################
## VMware Apps ##
#################
VMW_APP=yes

##################
## VPX SETTINGS ##
##################
VPX_SETTING=yes

-


Setup & Run Health Check Script on Windows

Here are instructions on configuring vSphere Health Check Script to run on Windows with PowerCLI submitted by user whinshaw

http://www.myvmland.com/?p=124

Note: For comments/inquires about this intergration, please refer to the author of the post.


Change Log

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

02-17-2013 - v5.1.0

Enhancements:

  • Updated to support vSphere 5.1 and minor fixes

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

12-29-2011 - v5.0.2

Enhancements:

  • Permission validation was recently added but had several unforeseen   issues when logging in with domain accounts. For now, this has been   removed. The documentation has been updated with the minimum permission   set required to the run the script.
  • Added --debug flag for troubleshooting

Fixes:

  • Minor fixes in validation of output

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

06-19-2011 - v5.0.0

Enhancements:

  • vCenter Server Instance UUID
  • vCenter hostname
  • Storage DRS Configuration (Maintenance Mode, Stats Aggregation, Stats Collection for Datastores)
  • FDM/HA Heartbeat Policy + Datastore
  • FDM/HA State
  • Host Agent Settings
  • Host New iSCSI Configuration/Information
  • Host FCoE HBAs
  • Host Source Packages for ESXi Services
  • Host ESXi Capabilities
  • Host SMC Hardware Information regarding OSX Support
  • Host Updated Firewall Rules (direction, port type, port, protocol and allowedIPs)
  • Host Cache SSD Datastore details
  • Host DVS IPFIX Details + NIOC
  • Virtual Machine Virtual Hardware Version
  • Virtual Machine Firmware, Initial overhead memory + swap
  • Virtual Machine State
  • Virtual Machine Snapshot consolidation + HA protection
  • Virtual Machine Detailed Disk Type (zeroedthick,eagerzeroedthick and thin)
  • Updated color mappings for multipath states
  • Support for standalone ESX(i) hosts without vCenter Clusters
  • New healthCheck.conf variables:  DVS_SUMMARY, DVS_CAPABILITY, DVS_CONFIG, DATASTORE_CLUSTER_SUMMARY, DATASTORE_CLUSTER_POD_CONFIG, DATASTORE_CLUSTER_POD_ADV_CONFIG, DATASTORE_CLUSTER_POD_STORAGE, HOST_ISCSI, HOST_AGENT, HOST_CACHE, VM_STATE, VM_EZT
  • Updated color scheme for HTML report

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

04-18-2011 - v4.1.9

Enhancements:

  • Included vCenter Server in title of report

  • Included time stamp in title of report

Fixes:

  • VM ratio count issue resolved

  • Can't locate object method "group" via package "ClusterConfigInfoEx"

  • Compressed memory metric display issue resolved

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

01-23-11 - v4.1.6

Fixes:

  • Resolved CSS display issues with Chrome & Safari, report now should be compatible with Firefox, Internet Explorer, Chrome and Safari

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

01-03-11 - v4.1.5

Fixes:

  • Minor fix on cluster info that causes the following error "Undefined subroutine &ClusterVmHostRuleInfo::vm called"

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

10-16-2010 - v4.1.4

Enhancements:

  • VM count per cluster displayed in Cluster Summary tab

  • VM-to-Host ratio displayed in Cluster Summary tab

Fixes:

  • Minor fix on cluster info

  • Added VMware/3rd Party Application Section (some reason the code was missing during one of the updates)

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

10-10-2010 - v4.1.3

Enhancements:

  • VM count per datastore

Fixes:

  • Fixed logic for checking SIOC for non-VMFS volumes

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

07-22-2010 - v4.1.2

Fixes:

  • Updated script to support running on both vMA 4.0 and vMA 4.1. If you're managing ESX(i) or vCenter 4.1 hosts, you must use vMA 4.1

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

07-13-2010 - v4.1.0

Enhancements:

  • DRS Affinity Rules

    • In Compliance

    • Mandatory

    • User Created

  • DRS GROUP Rules

    • Host group

    • VM group

  • COS VMDK PATH

  • HA Configuration Issues

  • Host capabilities

    • Storage IORM

    • VM Directpath G2

    • vStorage Hardware Acceleration

  • Host Datastore

    • SIOC State

    • Congestion Threshold

  • Host Configurations

  • Feature specific version information

  • Host State

    • Uptime

    • Standby mode

  • VM State

    • Uptime

  • Host Authentication Services

    • Local

    • Active Directory

  • VM Config

  • App Heartbeat

  • VM Stats

    • Compressed memory

  • Host LUN

    • vStorage/SIOC capable

  • Host Advanced Configuratoins

    • VMFS3.HardwareAcceleratedLocking

    • DataMover.Hardwar eAcceleratedMove

    • DataMover.HardwareAcceleratedInit

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

06-05-2010 - v4.0.8

Enhancements:

  • Added two new configuration options VMW_APP and VPX_SETTING

  • Added vCenter VPX Configuraton tab (only available when connecting to vCenter)

  • Added VMware Application tab (only available when connecting to vCenter)

  • Updated HA cluster failover policy display

Fixes:

  • Resolved minor html mis-match tags

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

04-28-2010 - v4.0.7

Fixes:

  • Resolved issue with HA configuration policy failover

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

04-02-2010 - v4.0.6

Enhancements:

  • Added VMFS blocksize + version in Datastore output

  • Added param to output printer friendly format

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

04-01-2010 - v4.0.5

Enhancements:

  • Added VM Devices section (VM_DEVICE)

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

03-27-2010 - v4.0.4

Enhancements:

  • Changed "Cluster Statistics" to "Cluster Summary" (CLUSTER_SUMMARY)

  • Added Table of Contents for Cluster Tab

  • Changed Cluster Performance "mem.usage.average" to "mem.consumed.average"

  • Added CLUSTER_SUMMARY as configurable property

  • Added DRS Current and Target balance information

  • Added VM list to Affinity Rules

  • Added CPU/MEMORY Shares info in Resource Pool under Cluster + CPU/MEM Units per VM

  • Added Lockdown Mode informaiton (applies to ESXi only)

  • Added 8 addtional Advanced Host Configuration including (NFS + TechSupport Mode configurations)

    • NFS.MaxVolumes

    • SendBufferSize

    • ReceiveBufferSize

    • Net.TcpipHeapSize

    • NFS.HeartbeatFrequency

    • NFS.HeartbeatTimeout

    • NFS.HeartbeatMaxFailures

    • VMkernel.Boot.techSupportMode

  • Added Host Capabilities section (HOST_CAPABLITIY)

  • Added VM Resource Allocation (shares/limits/etc) section (VM_RESOURCE_ALLOCATION)

  • Added vCenter Plugin information (SYSTEM_PLUGIN)

Fixes:

  • Resolved a few bad HTML tags

Known Issues:

Big thanks goes out to Raphaël SCHITZ for providing some feature suggestions + extensive testing of the script!

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

03-21-2010 - v4.0.1

Enhancements:

  • Email report now supports multiple email recipients

Fixes:

  • Thanks to user arjaysam1 for noticing there was some bad math going on with the hardware numeric sensor values, this has now been fixed so properly display the values (e.g. 48 C instead of 4800)

  • Thanks to user Altix for suggesting adding addtional padding to the CSS style for the scrollbar at the bottom for better visiblity

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

03-18-2010 - v4.0.0

Enhancements:

Cluster

  • HA Advanced Runtime information

  • HA Configuration (primary/secondary and node states)

  • HA Advanced Configurations

  • DRS Advanced Configurations

Host

  • IP/HOSTNAME of vCenter Management IP

  • Newly improved Hardware and System Health Status information

  • Advanced Configurations

  • NUMA information

Virtual Machine

  • UUID

  • Bootime

  • Resource statistics

  • Fault Tolerance information

  • Thin provisioned information

  • NPIV information

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

02-28-2010 - v1.5.3

Enhancements:

-Added additional command line options to specify whether or not to includ Cluster,Host or VM performance stats, the default is to not display this information as it can increase the runtime of the script depending on the size of your environment

Fixes:

-Updated email functionality to have the report as an attachment

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

02-13-2010 - v1.5.0

Enhancements:

-Added email report capablity

Fixes:

-Finally resolved performance data issue for VMs (Thanks to Raphael Schitz for reporting the initial problem and verifying the fix)

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

01-21-2010 - v1.4.1

Fixes:

-Performance data was not properly displaying and now have been fixed for all 3 entity levels (cluster,host and vm)

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

01-17-2010 - v1.4

Enhancements:

-Host configurations now includes vCenter managed IP Address

-Summary of User and Group permissions for vCenter server

-Host summary now includes Host & SCSI LUN Model attribute

-Host state summary now includes boottime

-Host LUNs now include additional information including Datastore,VolumeUUID,DiskName and DeviceName

-VM network summary now includes portgroup information from both standard vSwitches + distributed vSwitches

-Performance statistics (cpu/mem AVG+%) for both vCenter clusters and host

-Performance Statistics for VM (cpu/mem avg + %, ready & ballon) is optional.

Note:

Enabling VM performance stats gathering can potentially incrase the script execution up to 2x. From the sample execution in our envrironment, the report went from 46secs to 1.3min. By default this feature is disabled and you'll need to specify param --vmperformance 1 to enable at runtime.

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

11-23-2009 - v1.3

Fixes:

-Fixed snmp output, small typo in the script

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

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)

Attachments
Comments

Actually the script does handle this use case and I was able to verify on one of my test hosts. There is a check that's implemented before going into any of the host details by looking at it's connectionState property. When a host goes into Standby mode completed via DPM (automated/manually), you will see that it's connectionState marked in the API as "notResponding" and I only allow the code to proceed if it's set to "connected"

Could you provide the exact command you're running on the CLI? Are you running this as --type vcenter? What you can also try is specifying --hostlist and only specify the host that's in standby and see if the report generates correctly AND try all hosts and exclude the one in standby mode. One thing to note, if you're running this report while it's entering standby mode, the connectionState will show connected until the task has complete finished which can cause an issue with the report.

If you could also attach the report via a URL of if you don't feel comfortable, PM me the URL for the report. I would like to see what part of the script is is it halting at.

Thank

=========================================================================

William Lam

VMware vExpert 2009,2010

VMware scripts and resources at:

Twitter: @lamw

vGhetto Script Repository

Getting Started with the vMA (tips/tricks)

Getting Started with the vSphere SDK for Perl

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

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

Just installed the new v4.1.0 script in vMA and I am seeing the following against a standalone VMware ESXi, 4.0.0, 261974 host:

Can't locate object method "vStorageSupport" via package "HostScsiDisk" at ./vmwarevSphereHealthCheck.pl line 2458.

End Disconnect

The new v4.1.0 should be installed on vMA 4.1 or greater. It's having a problem trying to look up properties that do not exists as you're using older version of the SDK. I've made it backwards compatible if you're on 4.1 but not the other way around.

You should only be using v4.1.0 if you have 4.1 hosts in your environment, else there is nothing new for vSphere 4.0

=========================================================================

William Lam

VMware vExpert 2009,2010

VMware scripts and resources at:

Twitter: @lamw

vGhetto Script Repository

Getting Started with the vMA (tips/tricks)

Getting Started with the vSphere SDK for Perl

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

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

Gotcha. I read the notes in the beginning of the KB differently. Thank you for the clarification.

In looking at the results (HTML) from the script. I am getting incorrect version numbers for the vCenter and ESXi servers I have. My 4.1 servers are stating they are "VMware ESXi 4.0.0 build-236512" when they are actually ESXi 4.1.0 260247. Same goes for the vCenter Server an I only have one vCenter server. The script states it's "VMware vCenter Server 4.0.0 build-258672" when it's really 4.1.0 258902.

When running the script it throws out 2 errors which are the same:

Use of uninitialized value in concatenation (.) or string at C:\Program Files (x

86)\VMware\VMware vSphere CLI\bin\vmwarevSphereHealthCheck\vmwarevSphereHealthCh

eck.pl line 878.

Use of uninitialized value in concatenation (.) or string at C:\Program Files (x

86)\VMware\VMware vSphere CLI\bin\vmwarevSphereHealthCheck\vmwarevSphereHealthCh

eck.pl line 878.

Lastly, I am running the script using vSphere Cli 4.1, and using the following:

vmwarevSphereHealthCheck.pl -server myvcs --username mydomain\vmware --password ***** --type vcenter

Thanks!

Disregard the above. For some reason it is now working correctly.

Thank you,

Larry

Hi William

This script seems like it might be exactly what I'm looking for, but unfortunately I was getting the same error as c33jbeckwith, as I'm not yet using vSphere 4.1 - we have no immediate plans to upgrade from 4.0 across all of our virtual infrastructure, so I have a need to run the previous version of your script.

I can't seem to find the previous version though. I have found v0.9.5 (for VI3.5), and I found http://communities.vmware.com/docs/DOC-12456 which doesn't have a download link. It just has the code as text on the webpage, so I tried copy/paste into a blank .pl file, but generated 200+ errors when I ran it on the vMA appliance, so the copy/paste operation could not have got all the script (I tried it from both chrome and IE) (maybe due to a webpage formatting issue - e.g. CR/LFs in wrong places - I'm not sure. EDIT: on closer inspection, the code snippet only contains 4000 lines of code whereas v4.1.0 contains almost 5000. It looks like the snippet is cut off in the middle of a subroutine - makes sense that it wasn't working :smileygrin:).

So, a link to a downloadable version 4.0.x would be hugely appreciated.

Cheers in advance

Scott

I actually missed a section in the script where it checks on the version of the API (vStorageSupport error you're seeing) and I've just updated the script. You will now be able to run this on both vMA 4.0 and vMA 4.1 system. If you're managing vCenter or ESX(i) 4.1 hosts, you must use vMA 4.1.

=========================================================================

William Lam

VMware vExpert 2009,2010

VMware scripts and resources at:

Twitter: @lamw

vGhetto Script Repository

Getting Started with the vMA (tips/tricks)

Getting Started with the vSphere SDK for Perl

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

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

running into one other problem that I have not seen mentioned. The new 4.1.2 script works without issue when I am querying a single host. However, when I query vCenter (running in eval mode currently but that should not be an issue) I get the information for the vCenter itself, but not the attached host. I don't see anything in reference to additional flags when I am contacting the vCenter.

Thanks in advance!

I run the script to check esxi 4.1 server but failed with following errors.

This can take a few minutes depending on environment size.

Get a cup of coffee/tea and check out http://www.virtuallyghetto.com

Can't locate object method "systemFile" via package "HostConfigInfo" at D:\exsi_

tool\vmwarevSphereHealthCheck\vmwarevSphereHealthCheck.pl line 1659.

End Disconnect

Me too, no problem when running on top of EXS/i hosts but failed on vSphere Hypervisor 4.1 with below error :

Can't call method "enabled" on an undefined value at C:\Program Files\VMware\VMware vSphere CLI\bin\vmwarevSphereHealthCheck.pl line 2522.

http://www.no-x.org

I'm assuming you're running on vMA 4.1? and your infrastructure is all 4.1? Do you have a cluster created?

=========================================================================

William Lam

VMware vExpert 2009,2010

VMware scripts and resources at:

Twitter: @lamw

vGhetto Script Repository

Getting Started with the vMA (tips/tricks)

Getting Started with the vSphere SDK for Perl

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

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

Are you using vMA 4.1? Are you running this on a licensed or free version of ESXi 4.1?

=========================================================================

William Lam

VMware vExpert 2009,2010

VMware scripts and resources at:

Twitter: @lamw

vGhetto Script Repository

Getting Started with the vMA (tips/tricks)

Getting Started with the vSphere SDK for Perl

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

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

Are you using vMA 4.1? Are you running this on a licensed or free version of ESXi 4.1?

=========================================================================

William Lam

VMware vExpert 2009,2010

VMware scripts and resources at:

Twitter: @lamw

vGhetto Script Repository

Getting Started with the vMA (tips/tricks)

Getting Started with the vSphere SDK for Perl

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

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

First of all, great script! I use this to report our Infrastructure since Version 4.0.0 on a weekly basis.

I have vMA Version 4.0, ESX Hosts Version 4.0 and vCenter 4.0

Since the last update of the script to 4.1.2, the report will not include any information about 3rd Party Apps and I don't know what I can do, to bring them back into?! I've running the older Version 4.0.8 after that, to check if there are errors in my infrastructure, but the report looks fine, and 3rd Party Apps are included.

You can have a look at your sample report, it doesn't include 3rd Party Apps, too!

What's going wrong? The sub "getVMwareApps" seems to be unchanged...

William, here are the particulars:

vCenter 4.0u2

Single ESXi 4.0u2 host

AD integrated authentication.

I have both the 4.1.2 and the 4.0.8 code installed. I have the same problem with each script. vCenter information pulls without issue, no addtional information is displayed.

Thanks!

I'll need to see if I have some time to verify this on vMA 4.0, I had tested the script and it should work on either 4.0 or 4.1.

Regarding my sample report, that should not be used to compare what you should see on report. At the time of running the script, I had rebuilt our dev environment and we don't have any 3rd party applications. Remember, it's primarily 3rd party applications who have a specific hook into VMware such as VUM, vDR, etc. and there is some metadata that is provided for me to query for that information.

=========================================================================

William Lam

VMware vExpert 2009,2010

VMware scripts and resources at:

Twitter: @lamw

vGhetto Script Repository

Getting Started with the vMA (tips/tricks)

Getting Started with the vSphere SDK for Perl

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

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

What version of vMA are you using?

=========================================================================

William Lam

VMware vExpert 2009,2010

VMware scripts and resources at:

Twitter: @lamw

vGhetto Script Repository

Getting Started with the vMA (tips/tricks)

Getting Started with the vSphere SDK for Perl

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

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

Running vMA 4.0 and if memory serves me correctly I have updated to vCLI 4.0 U2 within vMA. I have no problem building a fresh vMA if that would assist with information gathering. I would assume since I am on the 4.0 train that I need to be on vMA 4.0 as well.

Thanks for the assistance.

I'm trying to understand the environment and potentially try to reproduce. atm, it sounds like it's only with vMA 4.0 on a 4.0 environment and potentially with U2. I was able to run the latest version of the health check script on a vCenter 4.0u1 with 4.0 hosts without any issues. I'm not aware of any changes that would cause the hosts to not show up.

The only thing is, you need to make sure your hosts are part of a cluster, that is requirement else it will not be able to query hosts and VMs.

=========================================================================

William Lam

VMware vExpert 2009,2010

VMware scripts and resources at:

Twitter: @lamw

vGhetto Script Repository

Getting Started with the vMA (tips/tricks)

Getting Started with the vSphere SDK for Perl

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

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

As it turns out you hit the nail on the head. I built a small dev environment to perform testing of a few new monitoring applications etc, but did not create a cluster for the single host that was being managed by the vCenter. Once the cluster was created, the script runs without issue. Thanks for the assistance.

whew...yea there should not be any issues running vMA 4.0 or 4.1.

I know today, the script does not provide any error or warning messages. This sounds like something I need to add so it's clear. I'm assuming this probably what the other user is running into as well.

Thanks

=========================================================================

William Lam

VMware vExpert 2009,2010

VMware scripts and resources at:

Twitter: @lamw

vGhetto Script Repository

Getting Started with the vMA (tips/tricks)

Getting Started with the vSphere SDK for Perl

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

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

William

One item I think would be nice to see if it is possible to add in a future release, would be to add a field under Hosts > ESX/ESXi Datastores to reflect how many VM's are utilizing that particular LUN. In environments with a large amount of LUN's where consolidation of datastores is being looked into, it would be great to use this tool to target LUN's that are less populated.

Great job on this script. It has become a staple in my arsenal of tools I use almost every day.

CJ Beckwith

Actually, that sounds really handy.....

Dear William,

I got the same problem like "azsysteam":

Can't call method "enabled" on an undefined value at C:\Program Files\VMware\VMware vSphere CLI\bin\vmwarevSphereHealthCheck.pl line 2522.

He did not answer your question, for me it´s:

vMA Version 4.1

Free Version of ESXi 4.1

The report is created, but the host information is emty.

I have the same software configuration as you state above, although I issue my command via batch script:

/home/vi-admin/scripts/vmwarevSphereHealthCheck/vmwarevSphereHealthCheck.pl --server myserver.edu --username just --password pretend --type host --printerfriendly yes --report myserver.html

which yields the same result:

Can't call method "enabled" on an undefined value at /home/vi-admin/scripts/vmwarevSphereHealthCheck/vmwarevSphereHealthCheck.pl line 2522.

This particular lines checks if Storage I/O Control is enabled, this part of the code is only valid for vSphere 4.1 and there is a check prior to that to see verify the version before going into this section of code. If you're using the latest version, you should not get an error whether you're using vSphere 4.0 or 4.1

=========================================================================

William Lam

VMware vExpert 2009,2010

VMware scripts and resources at:

Twitter: @lamw

vGhetto Script Repository

Getting Started with the vMA (tips/tricks)

Getting Started with the vSphere SDK for Perl

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

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

Thank you so much for your reply.

Using vMA Version 4.1 and Free Version of ESXi 4.1

I am assuming the tar.gz on this web page is the latest version. If not Is there a newer version elsewhere?

If it is the latest, then it appears the version check is working as we expect as I do enter that section of code correctly.

However, lines 2522-2533, where the $iormEnable and $iormThres variables are assigned fail.

Note: This issue appears to happen only to esxi4.1 hosts. The program completes fine on esx4 vsphere hosts.

As a test, commenting the above lines out at least lets the rest of the program finish.

Yes the latest version is on here, I'll have to test this out when I get a chance to see what the outcome is. I'll get back to you

=========================================================================

William Lam

VMware vExpert 2009,2010

VMware scripts and resources at:

Twitter: @lamw

vGhetto Script Repository

Getting Started with the vMA (tips/tricks)

Getting Started with the vSphere SDK for Perl

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

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

William -

I noticed that the email function is not working, in that it's not reading the data set in the config file.

If I manually edit the .pl it works great, but if I strictly edit the config file I get:

Error: Unable to setup connection with email server: "emailserver"!

I've tested both editing the script and using a configuration file. If you can provide more details and what you're setting the configurations files to, I might be able to help. Pretty swamped still, but I'll try to get back to you but I'm pretty sure it works. The other thing you can try is to print out the values of the email configurations and NOT edit the script email settings to see if it actually is reading in the right information.

=========================================================================

William Lam

VMware vExpert 2009,2010

VMware scripts and resources at:

Twitter: @lamw

vGhetto Script Repository

Getting Started with the vMA (tips/tricks)

Getting Started with the vSphere SDK for Perl

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

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

Sure - the settings I used in the config file (with NO edits to the script) are as follows:

EMAIL_HOST=owd-exch1.customer.local

(NOTE: I tried with "just hostname" and with FQDN here - same result)

EMAIL_DOMAIN=customer.local

EMAIL_TO=Customer@customer.gov

EMAIL_FROM=vMA@Cluster1.customer.local

With just these values set in the config file I get:

Error: Unable to setup connection with email server: "emailserver"!

If I put those

SAME values

in the corresponding places of the script, I have complete success.

There is NO NEED to hurry on this for me - I have it working, and for the target environment this is totally a non-issue.


Also, to let you know, there is a typo in the output. On the "Hosts" page you will see "COS

VDMK

" - I can only assume you mean to have VMDK there....

I think Storage I/O Control is not available in free version of vSphere 4.1.

Maybe that´s the problem?

I think you nailed it. I did some digging and found this:

http://geeksilver.wordpress.com/2010/07/28/vmware-vsphere-4-1-storage-io-control-sioc-understanding/

According to that article, In addition to a esx 4.1 host as a requirement, you also need the vcenter server system up and running as well as an Enterprise License.

Actually the licensing has nothing to do with the property, yes this feature is only available with 4.1, but querying on whether SIOC is enabled or not should not depend on the license. What's happening is SIOC is only available under VMFS volumes, my guess is that you have an NFS volume and when the script tries to validate this, it fails and throws the error.

I believe this can be fixed by changing line 2521 to the following which checks that the datastore is of type VMFS:

if(($hostAPIVersion eq "4.1.0" || $hostAPIVersion eq "4.5.0") && $ds->summary->type eq 'VMFS') {

Let me know if this resolves the problem.

Thanks

=========================================================================

William Lam

VMware vExpert 2009,2010

VMware scripts and resources at:

Twitter: @lamw

vGhetto Script Repository

Getting Started with the vMA (tips/tricks)

Getting Started with the vSphere SDK for Perl

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

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

Hi Mr William Lam,

very nice script.

The section with the VM Snapshots are very important for us, thanks.

But, is it possible to make a small sript only find the snapshots as in the full report??

Thank, for help

You are correct. I am using an NFS Volume in both esxi 4.1 hosts. My apologies for not pointing this out at the outset.

The line change you made at line 2521 appears to have resolved the problem and the script now completes successfully.

A feature question: Does your script list the startup/shutdown order of VM's within an esx/esxi host? I'm hoping it does and I just missed it.

Thank you for a most excellent script!

Hi varaway,

Please take a look at the documentation, specifically the section called Custom Report Configuration which allows you to fully customize the report. If you're only interested in snapshot info, you can leave that enabled and disable all other checks.

=========================================================================

William Lam

VMware vExpert 2009,2010

VMware scripts and resources at:

Twitter: @lamw

vGhetto Script Repository

Getting Started with the vMA (tips/tricks)

Getting Started with the vSphere SDK for Perl

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

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

apesma1,

Thanks for confirming, I'll make sure this fix is in the next release. Regarding startup/shutdown, no that is not being captured today. I'm not sure exactly how it would be displayed, as it currently displays VMs based on their display name which is listed in alphabetical order if I recall correctly. I don't have any plans on changing that.

=========================================================================

William Lam

VMware vExpert 2009,2010

VMware scripts and resources at:

Twitter: @lamw

vGhetto Script Repository

Getting Started with the vMA (tips/tricks)

Getting Started with the vSphere SDK for Perl

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

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

Hi William,

We have VC with 2 datacentres in it. Whe I run the script with "--type vcenter" the report only give inform about 1 datacentre (all clusters + hots within it etc..).

I know there is switch to specfify which datacentre to get inform from. Is there way to run the script just once to get inform for ALL datacentres in the VC ie, without havginto run mutiple times?

I just realise that even to specify the --datacentre there is no inform collected for the particular 2nd datacentre. I think it is because this datacenter does NOT have Cluster/Hosts structure ie, I group the Hosts in a Host Folder, there is no Cluster (since the ESX hosts are local onsites, geographically separate). I belive your script report on Datacentre is based on Cluster/Hosts structure?

thanks

Van

Hi truo1van,

I can confirm the script supports for multiple datacenters, but the key is that you must have a cluster defined in which the hosts are under. Even if you don't use any of the "cluster" features, from a scripting perspective, there are certain things I extract out which is much easier at a cluster level. That is most likely why you're not seeing information being captured in the other datacenter. You should be able to create a cluster and just have HA/DRS disabled and stick with the defaults and re-run the script and it should work.

=========================================================================

William Lam

VMware vExpert 2009,2010

VMware scripts and resources at:

Twitter: @lamw

vGhetto Script Repository

Getting Started with the vMA (tips/tricks)

Getting Started with the vSphere SDK for Perl

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

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

thanks William,

Thought about that, in facted had tried it. HOwever, we have more than 100 hosts in the 2nd clusters. This breaks the cluster limit max. Anyway, if need be I can put them in Host list and run the scripts against it. HAvent not tried it but should be ok.

I want to use this script to generate reports for management and they r only interested in some key aspects of the report from viewpoint of performance and/or capacity planning ie, Host performance/utlilisations wrt CPU, RAM, Disk IO.., VM CPU/RAM utils, VMs created in the last 7 days (configurable para)..

The default report has excelletn inform for tech guys like but I need somehtings more "less interlligent" for managt.

How can I turn off selective report aspects??.

PS: I have not tried to turn on the performance switches for Host/VM/Cluster yet so not sure what it can gives (will surely try next week). If usefull, can I have the 3 switches on in command line? instead of having to run 3 times? Am I correct to assume that?

Again. thanks very much.

VanT

Followup. Just have a look at your sample report's performance sections for Hosts and VMs. THey have the averages.. what are the durations of taken to work out the avarages?

Tried 4.1.3 yesterday from a 4.1 vMA against a 4.0 vCenter:

email still not working as intended (from config file)

Turned off VMware/3rd party Apps - report still contained the "dead" tab

Turned off VPX settings - VPX data still appears in report

(HMM - almost seems like the config file is being ignored entirely?????)

Also - in the VM section, there were a couple of VMs that showed up "in the yellow" for Overall Status - and the cell is merely labeled "VM" - is there supposed to be more information?

I've also been curious about something - is there any way to get the report to look like the "old" script - where it was all just one long, simple HTML file?

truo1van,

Please take a look at the documentation, specifically the section called Custom Report Configuration which allows you to fully customize the report. You will be able to select only a subset of what the report generates.

PS: I have not tried to turn on the performance switches for Host/VM/Cluster yet so not sure what it can gives (will surely try next week). If usefull, can I have the 3 switches on in command line? instead of having to run 3 times? Am I correct to assume that?

There already exists 3 separate switches to control performance data for cluster,host and VM. Please read the documentation.

Thanks

=========================================================================

William Lam

VMware vExpert 2009,2010

VMware scripts and resources at:

Twitter: @lamw

vGhetto Script Repository

Getting Started with the vMA (tips/tricks)

Getting Started with the vSphere SDK for Perl

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

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

vancod,

1) I've not been able to re-produce your email issue, though haven't dug super deep and hence it was not called out in the change list. What email server are you using specifically? I've tested using postfix and it works fine.

2) VMware/3rd Party Apps - I'll look into it, I think by default the tabs are auto-generated but no data will be populated.

3) VPX Settings, I'll look into it, last I checked this works

Could you either attach or PM your config file, I want to make sure you don't have any typos Smiley Wink I'm sure you don't, but these are things I've tested in the past and the code snippets have not changed.

Also - in the VM section, there were a couple of VMs that showed up "in the yellow" for Overall Status - and the cell is merely labeled "VM" - is there supposed to be more information?

Nope, this is an overall status of the VM, a property that it's exposed via the API to give you a quick look at any given VM, no additional information.

I've also been curious about something - is there any way to get the report to look like the "old" script - where it was all just one long, simple HTML file?

Yes, please take a look at the documentation and use the flag --printerfriendly which makes it into one long HTML report. This was added for those that wanted to print the report but provides the same functionality.

Thanks

=========================================================================

William Lam

VMware vExpert 2009,2010

VMware scripts and resources at:

Twitter: @lamw

vGhetto Script Repository

Getting Started with the vMA (tips/tricks)

Getting Started with the vSphere SDK for Perl

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

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

So I've now uploaded the new health script to our vMA's, but unfortunately I cannot get it to work no matter what I've tried, and fails on the following error:

Syntax: ./vmwarevSphereHealthCheck.pl --server server01 --username XXXX --password XXXX --type vcenter

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

If I run the old version of the script (1.5.2) it works fine even with the advanced options including forwarding emails, collecting all the performance data etc... This latest build 4.1.3 it just errors out while running even the simplest method.

My setup:

vMAs are 4.1

vCenters are 4.0 update 2

ESXi Hosts are 4.0 update 2

line 468 appears to be in the sessions area of the script. Anyone else have had experience with this type of error?

Cheers

I think the issue is when it only finds 1 active session and it tries to perform a sort on the name to display the output. Try modifying the code starting at line 468:

                if($demo eq "no") {
                        my $sessionMgr =  Vim::get_view (mo_ref => $sc->sessionManager);
                        my $sess_list = $sessionMgr->sessionList;
                        if(@$sess_list ne 1) {
                                foreach(sort {$a->userName cmp $b->userName} @$sess_list) {
                                        $summary_start .=  "<tr><td>".$_->userName."</td><td>".$_->fullName."</td><td>".$_->loginTime."</td><td>".$_->lastActiveTime."</td></tr>\n";
                                }
                        } else {
                                foreach(@$sess_list) {
                                        $summary_start .=  "<tr><td>".$_->userName."</td><td>".$_->fullName."</td><td>".$_->loginTime."</td><td>".$_->lastActiveTime."</td></tr>\n";
                                }
                        }
                } else {
                        $summary_start .= "<tr><td>DEMO_MODE</td><td>DEMO_MODE</td><td>DEMO_MODE</td><td>DEMO_MODE</td></tr>\n";
                }

Let me know if this works and I'll go ahead an get this updated in the next release.

=========================================================================

William Lam

VMware vExpert 2009,2010

VMware scripts and resources at:

Twitter: @lamw

vGhetto Script Repository

Getting Started with the vMA (tips/tricks)

Getting Started with the vSphere SDK for Perl

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

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

hi william,

No luck with the new code and errors on the same line.

But your right when I use another username/password combo (my personal one which already has 1+ active sessions) the script works great. As soon as I use a domain based service account of sorts which I've setup only to run the script through vMA it fails but guess this is because it doesn't have an active session.

Cheers

Hi,

using version 4.1.3 I got the following error

Undefined subroutine &ClusterVmHostRuleInfo::vm called at .\vmwarevSphereHealthCheck\vmwarevSphereHealthCheck.pl line 3765

I start the script under Windows XP with VMware vSphere PowerCLI 4.1 installed.

The command line I use is vmwarevSphereHealthCheck.pl --server --type vcenter --config healthCheck.conf --passthroughauth --printerfriendly yes

The enviroment is a vSphere Center Server version 4.1 managing 10 vSphere ESX servers version 4.1 defined as a cluster. HA and DRS are enabled. Within DRS we are using VM and Host groups.

With versions 4.0.x I had no problems.

Any suggestions are welcome.

Markus

Version history
Revision #:
1 of 1
Last update:
‎04-21-2009 11:24 PM
Updated by: