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
-
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:
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
For more details, please take a look at the following sample report: here
Please join the vSphereHealthCheck Group to post comments/discussions
vSphere SDK for Perl (formally VI Perl Toolkit) or VMware vMA 4.x/5.x+ (formally VIMA)
VMware vCenter 4.x/5.x+ and/or ESX(i) 4.x/5.x+
[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
-
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
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
-
./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
./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
./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
./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.
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
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
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
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
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
-
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
-
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.
##########################################################################
02-17-2013 - v5.1.0
Enhancements:
##########################################################################
12-29-2011 - v5.0.2
Enhancements:
Fixes:
Minor fixes in validation of output
##########################################################################
06-19-2011 - v5.0.0
Enhancements:
##########################################################################
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:
##########################################################################
01-03-11 - v4.1.5
Fixes:
##########################################################################
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:
Performance statistics may not display on certain runs due to known bug: http://communities.vmware.com/message/1498805#1498805
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:
The script has completely been re-written from the bottom up for better performance and modularity of the output. All categories that can be displayed is now configurable via a configuration file.
Ability to specify specific list of ESX/ESXi host to query via configuration file
Ability to specify specific list of Virtual Machines to query via configuration file
New html layout - Used the following references: http://www.sohtanaka.com/web-design/examples/tabs/#tab2 and http://webdevel.blogspot.com/2008/06/tabs-without-javascript.html
The new color scheme was inspired by VMware's homepage:
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)
Strange, so this has nothing to do with the service account ... unless it does not have the correct set of permissions? Can you double check that your account & the service account has the same level of privileges? I'm wondering if that's the real issue.
If the error was around what I initially thought, that snippet of code should have worked.
=========================================================================
William Lam
VMware vExpert 2009,2010
VMware scripts and resources at:
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
If you find this information useful, please award points for "correct" or "helpful".
Thanks again for the help and your stellar work with the script for the community, and yes you're absolutely correct! When I changed the role in our vCenter to give this service account the administrator roles it runs without a hitch. I had created a role previously which I had assigned very restrictive permisionns or rather permissions to only view and no modify/change. This was done in case the account was compromised.
That being said I wonder whats changed permission wise so may need to conduct some further testing and figure out what the basic rights are needed for this account
HI William,
Apologies for being too keen to try out w/o reading the doc. I have tried turn on the 3 perform switches and they worked good.
I wonder if future release would have the "Powered-on VMs to Hosts ratio" per cluster?
Would be nice to have:
1) VM-to-Host ratio added to the current Clusters Summary
2) Top 10 (confgurable) VMs with most CPU/RAM usages - per cluster (would be good), with average values listed (stat samples taken over last 7 days (configurable)
3) Top 10 (confgurable) Hosts with most CPU/RAM usages - per cluster (would be good), with average values listed (stat samples taken over last 7 days (configurable)
Can (1) be easily done ie, short "hot-fix" addition lines? With (1) in place would make the report almost perfect for me, for now.
thanks again.
I have used the script many times in the past. It is great. However, I have an issue.
I am using vCenter 4.1 on Windows 2008 R2 Standard in a VM with four ESXi 4.1 hosts. When I run the script, I get the error below. Thanks for the help!
Can't locate object method "group" via package "ClusterConfigInfoEx" at C:\temp\vmwarevSphereHealthCheck\vmwarevSphereHealthCheck.pl line 3784.
I have the same problem as sammyvm and would like to use a restricted readonly user for the vifp/vcenter stuff, but the script failed. With the administrator role it runs fine.
Thanks! Assigning these permissions resolved my issue.
@Altix,
Thanks for the feedback, I'll go ahead and update the script so it checks for these permissions before proceeding, this way the user knows what the issue is.
Thanks
=========================================================================
William Lam
VMware vExpert 2009,2010
VMware VCP3,4
VMware VCAP-DCA4
VMware scripts and resources at:
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
If you find this information useful, please award points for "correct" or "helpful".
@dgriffin@thinksis.com
I believe I've located the problem, we'll update in the next release and you should see a fix come out pretty soon.
Thanks
=========================================================================
William Lam
VMware vExpert 2009,2010
VMware VCP3,4
VMware VCAP-DCA4
VMware scripts and resources at:
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
If you find this information useful, please award points for "correct" or "helpful".
I'm running the script (which is wonderful, by the way) but things like the mem reservation, cpu reservation, etc. are all showing up as N/A. Now, a lot of our VM's do not have memory/CPU reservations, but we want to find out which ones do.
Is there something special I need to do to see real numbers here?
Thanks!
@truo1van,
I'll look into #1 as a possibility, though #2 and #3 is something that's beyond the scope of the report, I don't want to start adding all these custom reports which can make the overall report bloated. If you're interested in those statistics, you're more than welcome to add those changes but it will not be something I'll be doing.
Thanks
=========================================================================
William Lam
VMware vExpert 2009,2010
VMware VCP3,4
VMware VCAP-DCA4
VMware scripts and resources at:
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
If you find this information useful, please award points for "correct" or "helpful".
@benruset,
If there are memory/cpu reservations configured for a VM, you should see the field being populated, unless you turned off the reporting option which I believe is controlled by VM_RESOURCE_ALLOCATION. By default this information is enabled for reporting
=========================================================================
William Lam
VMware vExpert 2009,2010
VMware VCP3,4
VMware VCAP-DCA4
VMware scripts and resources at:
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
If you find this information useful, please award points for "correct" or "helpful".
Well, I definitely have reporting enabled (tried using the config file as well as omitting it) and came up with the same result each time. Is there anything on the VMware side that might be causing a problem? I'm running the script with the same credentials that I use to manage VMware so it shouldn't be a permissions thing.
Interesting discovery with 4.1.4 and RDMs
This all relates to the "VM tab"
The RDM count is "off" for a pair of Microsoft Cluster members in the
"VM Storage"
section (that gets the pretty color codes) - one shows 10 disks (correct) the other only 2. NOTE that all RDMsDO
display correctly in the "VM RDMs" sectionIs this possible because the RDMs are shared resources? (my guess) There are actually 12 RDMs between these two machines (which jives with the "total drive count" above), with 7 of them being fully shared resources
hostlist doesn't seem to work for me.
I am specifying --server and --hostlist hostlist.txt but it only queries the host under the --server parameter.
I could just run the script for each host, but would be nice to get it all under one report.
Any ideas?
The --hostlist is only valid when using in conjunction with vCenter server which is specified using --server parameter. If you to query individual ESX(i) host, you can run through a simple for loop on the vMA shell or wherever you're executing the script and just rename the output file to match the individual host
=========================================================================
William Lam
VMware vExpert 2009,2010
VMware VCP3,4
VMware VCAP4-DCA
VMware scripts and resources at:
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
If you find this information useful, please award points for "correct" or "helpful".
So when using --hostlist, it will create separate HTML files anyway? I just wanted a single report including all hosts. Is this possible? Thanks.
@eqj,
No, it's still a single HTML document but it'll only capture data based on the hostlist, this is used in case you only care about certain ESX(i) host and do not want all hosts in your vCenter server.
=========================================================================
William Lam
VMware vExpert 2009,2010
VMware VCP3,4
VMware VCAP4-DCA
VMware scripts and resources at:
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
If you find this information useful, please award points for "correct" or "helpful".
OK thanks for the info. I don't use vCenter so it there any way to gather data for several hosts in a single HTML file?
No, to aggregate the data for multiple hosts, you must be using vCenter. If you have individual hosts, you'll only be able to generate individual reports.
=========================================================================
William Lam
VMware vExpert 2009,2010
VMware VCP3,4
VMware VCAP4-DCA
VMware scripts and resources at:
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
If you find this information useful, please award points for "correct" or "helpful".
I'm using 4.1.4 an had the same problem as Markus Jaekel with line 3791, but only since I defined Host-VM DRS affinity rules.
I tried to change the line from:
my $listOfVMs = Vim::get_views(mo_ref_array => $_->vm, properties => );
to
my $listOfVMs = Vim::get_views(mo_ref_array => $_->{'vm'}, properties => );
The script now completes but I got 4 of the following warnings and no email:
Use of uninitialized value in concatenation (.) or string at /home/vi-admin/scripts/healthcheck2/vmwarevSphereHealthCheck.pl line 3798.
Scratch that with no mail, it just hung in some queue on the way orz.
Is there any way to force a refresh of the data on VSphere? For example when I run the health check, it reports the free space on the datastores as seen in VSphere and does not refresh the data. Problem is that VSphere does not automatically refresh this data.
You could probably modify the script to run an esxcfg-rescan on all HBAs - but one issue I could foresee is the time it takes to complete. By way of example the last 8 node, dual-HBA, 8 path cluster I canned took about 2 minutes for all nodes to complete.
It's a great idea, but may be hard to put into practice given the above and the requirements to pass the interface name (but default names would likely cover 99.99% of us)
Doesn't rescan scan for new storage? Do you know which CLI command VSphere uses to refresh the storage space data?
Is it possible for this script to send a separate email if any alarms are raised? Such as low disk space, high CPU/Mem usage etc?
Hello all,
I had some problems running this script as I was constantly getting the following output:
-
D:\scripts>D:\scripts\vmwarevSphereHealthCheck.pl -server IP_address -username
user -password passphrase -type datacenter -datacenter "Datacenter_name" -report D:\scripts\vmware_health_check.html
Generating VMware vSphere Health Report 4.1.4 "D:\scripts\vmware_health_check.html" ...
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 use an undefined value as an ARRAY reference at D:\scripts\vmwarevSphereHe
althCheck.pl line 468.
-
I have created new role for this script purpose giving the following permissions to it and a test account assign to this role:
Datastore.Browse
Global.Diagnostics
Global.Licenses
Sessions.ValidateSession
but I didn't help and i still got the same problem.
After changing credentials to admin account the script ran without any problem, generating report file. What's weird to me is that after i created a copy of admin role and assigned my test account to it, it still generates error on line 468. Have anyone encountered any similar issue ?
Also after generating report on my administrator account i did notice that tabs VMware/3rd Party Applications, Cluster, Host and Virtual Machines are blank is there any additional option needed to get content of that tabs?
VMware vCenter Server 4.0.0
vSphere 4 Enterprise esxEnterprise
ESXi 4 Single Server esxBasic
vCenter Server 4 Standard vc
script is run from machine with powerCLI and vSphere SDK for Pearl installed.
Hello,
Great script.
But I got the following error message the second time I execute the script :
$ ./vmwarevSphereHealthCheck.pl --server vcenter41.enneade.local --username xxxxxxxx --password xxxxxxxx --type vcenter --conf healthCheck.conf
Generating VMware vSphere Health Report 4.1.4 "vmware_health_report.html" ...
This can take a few minutes depending on environment size.
Get a cup of coffee/tea and check out http://www.virtuallyghetto.com
Wide character in print at ./vmwarevSphereHealthCheck.pl line 532.
Undefined subroutine &ClusterVmHostRuleInfo::vm called at ./vmwarevSphereHealthCheck.pl line 3791
From that moment it doesn't work anymore ...
Any idea ?
Thanks a lot
Regards
@fbroussey
I had the same problem please see my comment above how to resolve it with version 4.1.3.
I think it will work if you change the corresponding lines in version 4.1.4
yes Markus that works !
Thanks for you help
is there any indication available for why all VM affinity rules show as compliant : NO and colored red?
thanks
@fbroussey @Markus Jaekel
What change was made? I'll add this to the fixes for a future release.
Thanks
=========================================================================
William Lam
VMware vExpert 2009,2010
VMware VCP3,4
VMware VCAP4-DCA
VMware scripts and resources at:
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
If you find this information useful, please award points for "correct" or "helpful".
I'm not exactly sure what you mean by this? Can you provide a screenshot of the report with regards to affinity rules?
Thanks
=========================================================================
William Lam
VMware vExpert 2009,2010
VMware VCP3,4
VMware VCAP4-DCA
VMware scripts and resources at:
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
If you find this information useful, please award points for "correct" or "helpful".
All of our Affinity rules are marked as red and non-compliant.
The below example is configured to keep two VM's separated on a 3 host cluster, which they currently are.
!http://img687.imageshack.us/img687/9296/capturebb0.jpg|src=http://img687.imageshack.us/img687/9296/...
Uploaded with ImageShack.us
thanks
It looks like per the API documentation - http://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.cluster.RuleInfo.html the property inCompliance which is being used to generate the value is not actually being used by the server. This may just be a default value of false since it's not being used by the system and that is how the color is being generated.
You can ignore this as being false positive, looks like VMware introduced the property but may not be actively useing it.
=========================================================================
William Lam
VMware vExpert 2009,2010
VMware VCP3,4
VMware VCAP4-DCA
VMware scripts and resources at:
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
If you find this information useful, please award points for "correct" or "helpful".
understood, thanks again.
changed line 3765 from
my $listOfVMs = Vim::get_views(mo_ref_array => $_->vm, properties => );
to
my $listOfVMs = Vim::get_views(mo_ref_array => $_->{'vm'}, properties => );
Hello -
Thanks so much for this fantastic script. We had this running a month ago when our vCenter was running version 4.0 on a Windows 2003 machine. In this configuration, we were running the healthcheck from a Windows box with the necessary CLI\PERL components installed.
We have since built out a new vm with Windows 2008 R2 upon which vCenter 4.1 is now running. I have set up the VMA 4.1 and am trying to run the healthcheck against the new vCenter. I am getting the Can't locate object method "group" via package "ClusterConfigInfoEx" error and am at a loss as to how to correct this. Any help anyone could provide would be appreciated beyond words, as I am frustrated with myself and and am mentally exhausted.
Thanks so much in advance -
Steve
Thanks for the prompt feedback. I had been under the impression that the SDK install was only necessary if you were running the script from Windows. I had thought that the VMA had everything that was needed out the box. Is this not the case?
Thanks
@sfortuna74,
This is actually a bug that you're hitting in the script and it will be fixed in the next release. Sorry for the inconvience, you have not done anything wrong. As and FYI, if you download and install vMA 4.1, you will have the latest vSphere SDK for Perl 4.1 which is installed along side vCLI 4.1 as it is relied upon. If you wanted to run the script in a Windows platform, you just need to ensure you have the latest vCLI 4.1 installed which will include the vSphere SDK for Perl.
Keep an eye out for the minor release to resolve the bug. If you can not wait, please take a look at the reply from *fbroussey* on Dec 3, 2010 11:40 AM, you just need to make that minor edit and the script will proceed through
Thanks
@sfortuna74,
I just updated the script to the latest version which should be v4.1.5. Please download the latest version and let me know if you're still having issues
Thanks
Thank you so much! I am going to take a break for a couple hours but will definitely apply this tonite and let you know.
Hi -
I couldn't walk away, so downloaded the file from this page, went thru the config steps, and once again got the error. To confirm - the download should be pulled from the link on this page, correct? I tried looking at the properties of the .gz file but was not able to locate any 4.1.5 identifiers. Perhaps I've done something wrong on my end. Would it be wise to extract the file on a different directory on the VMA host? I am currently using \Home\vi-admin, where the previous version had already been extracted.
Thanks again so much for taking the time to help.
You can confirm the version by running the following:
[vi-admin@tancredi scripts]$ ./vmwarevSphereHealthCheck.pl --version
vSphere SDK for Perl version: 4.1
Script 'vmwarevSphereHealthCheck.pl' version: 4.1.5
You should see that the version of the script is at 4.1.5
rm
I did the version check and it is in fact 4.1.5. The exact language of the error is as follows:
Can't locate object method "group" via package "ClusterConfigInfoEx" at ./vmwarevSphereHealthCheck.pl line 3817.
@sfortuna74,
The support of this script on a Windows platform is more of a side effect than on purpose, support for the script will only be provided if you execut this on VMware vMA and/or Linux system with vCLI installed. Though in general, it should work just as well on Windows, I do not test nor qualify for that platform and YMMV. In the past users have had problems if their Windows system has older/newer version of Perl installed and probably something is not setup correctly.
Regarding the current issue your'e seeing, I have an idea where the problem lies. If you can download the latest version and re-run using vMA so I can track down the problem, that would help me try to identify the issue.
I left you a private message, let's see if we can get this resolved.
is am using powercli 4.1 on windows2008r2 with esx 4.1 and vc 4.1 but getting error on line 3785.
also when i turn the feature of in .conf file. i use the report.txt as mentioned in myvmland.com the error is
Can't locate object method "inCompliance" via package "ClusterAffinityRuleSpec"
at C:\scripts\vmwarevSphereHealthCheck.pl line 3785.
If you're using PowerCLI, then there's something very wrong , the script probaby would not even run.
I'm assuming you meant vCLI? Can you confirm it's in fact vCLI 4.1? This error can be pretty general and could be the case if you're running an older version of vCLI and you're trying to access a newer environment such as vSphere 4.1
yeah i am sorry, i am into powercli lately.
it is vcli 4.1 indeed so it should work.
I currently have limited access to my lab due to hardware failure on my home system. I'll have to take a look when I'm able to rebuild my system probably in the next week or so. I've seen this issue in the past and thought I had resolved it. Are you currently using any type of affinity rules in your vSphere Cluster? I also assume you're using the latest version of the script?