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)
I've noted that with the vMA on ESX3.5U4 I get an error with the .9.4 script you have also graced us with. Is it even worth an attempt to try this script (with the vMA) on older hosts?
I am assuming the it's a VIMA/.9.4/ESX3.5.x and vMA/1.2/vSphere kind of relationship....
If you look at the requirements in the documentation you'll see one is for pre-vSphere and the other is for vSphere.
The relationship is the following:
=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at: http://engineering.ucsb.edu/~duonglt/vmware/
VMware Code Central - Scripts/Sample code for Developers and Administrators
If you find this information useful, please award points for "correct" or "helpful".
How to scheduler this report on daily basis and email it automatically?
Thanks in advance.
If you're launching it from a Windows box I would guess that you could do it as a couple of scheduled tasks (1> generate 2> email).
If you're doing it from the vMA it would be a cron job.
Maybe someone with direct experience will chime in, but examples of both should be on the interwebs.
What an awesome script! If anyone knows how to schedule this as a Scheduled Task in Windows 2008 please post it. It would help greatly!
@IPF - I've seen other scripts here that do this, I just don't recall which off top of my head. I'm sure a search will get you an answer...
I've got as far as creating a .bat file with the following:
START "C:\Program Files\VMware\VMware vSphere CLI\Perl\bin\perl.exe" "C:\Scripts\vmwarevSphereHealthCheck.pl" --server SERVER --username USERNAME --password PASSWORD --type vcenter"
When I run the .bat file it runs great. As a scheduled task...nothing happens. I've tried just the command in the scheduled task as well...nothing.
There has to be someone who has created a scheduled task? Anyone?
I so have to learn to copy my comments into my paste buffer before trying to hit submit on these sh*t forums... I lost a much longer post
Anyway -
Remove the "START"
Pass a "-- report" option - your command just send the output to null space
Start your task or specify your file output path as required or you'll be hunting for the result.
William - I use the vMA mostly, but am getting wonky results
"Can't use an undefined value as an ARRAY reference at ./vmwarevSphereHealthCheck.pl line 1114."
- my licensing data is screwy (shows negatives)
- the "Features" section has headers on top and sides, but no actual table data at all (not even empty cells)
- my cluster hosts show up fine but my stand-alone host is ignored (I think this was a legacy known issue?)
Please provide the exact syntax you're using with all the command line flags to help me better understand your issue.
Are you using vMA 4.0? and what is your environment like both vCenter and ESX(i) systems? build/versions?
Regarding line #1114, this refers to the following:
my $luns = $host->config->storageDevice->scsiLun; foreach (sort {$a->canonicalName cmp $b->canonicalName} @$luns) {
If you don't have any LUN(s) or have only one LUN, it should still process. I'm not sure why it's not.
=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at: http://engineering.ucsb.edu/~duonglt/vmware/
VMware Code Central - Scripts/Sample code for Developers and Administrators
If you find this information useful, please award points for "correct" or "helpful".
Syntax (used on both my XP-based perl toolkit and the vMA):
vmwarevSphereHealthCheck.pl" --server 192.168.2.160 --username Administrator --password xxxxxx --type vcenter --report vCenter.html
The vMA:
- it is the 4.0 release
- there's a security patch I have yet to apply, but is otherwise up-to-date / current
Env:
(these are all "real" machines - no VMs / tomfoolery)
vSphere vCenter (also has FUNCTIONING legacy license server, it was an upgrade from 2.5)
Single vSphere ESXi host that is stand-alone
Pair of vSPhere hosts (one ESX, one ESXi) in a cluster
- all are current (patched)
All have single active GigE connection at present
All use a single NFS share (RHEL based server should it matter)
I have a couple of licenses at present and can detail if required.
I will send you a link to the output via PM
With the information you've provided, here is what I'm thinking:
Is the vCenter fully managing all ESX(i) 4.0 hosts? If so, then the licensing server from VI3.5 might be what's causing the issue since the licensing portion of the API has significantly changed between VI and vSphere ... which could explain why it's off. If you don't for see needing the license server, can you try uninstalling and re-running the report to see if license output is fixed? This was one of the main reason I had two separate health check scripts for VI 3.5 and vSphere 4.0 due to the differences in the APIs.
Regarding the stand alone host, if it's not part of a vCenter cluster, it will not be caught by the script and that is a requirement. How is your ESX(i) host connected to your vCenter? Can you provide me with the inventory breakdown (e.g. hosta/b are in cluster1 and hostc is in cluster/etc?)
=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at: http://engineering.ucsb.edu/~duonglt/vmware/
VMware Code Central - Scripts/Sample code for Developers and Administrators
If you find this information useful, please award points for "correct" or "helpful".
At present, yes, vCenter is managing 4.0 hosts only. Until only a couple days ago I maintained a 3.5 host. Customer requirement (I'm a working consultant by trade) will likely mean another 3.5 host sooner or later.
However, I can test with the licensing server off (is uninstalling really required?) I will say that I have a number of customers that will have both legacy and vSphere based licensing simply because of the upgrade process and internal requirement - I hope the script can be made happy by just killing the legacy service for a few ticks. I will test this tomorrow as time permits.
Yes - my one host is, at present, outside a cluster, and I thought I recalled that this was a limitation / requirement of the script. SO basically I have hast a & b in a cluster, and host c is "a loner". But again, this changes frequently as required.
William,
When I run the script with "--type host" and have SNMP enabled on the ESXi 4.0 Host, the script does not complete for me. :
C:\Program Files\VMware\VMware vSphere CLI\bin>vmwarevSphereHealthCheck.pl --ser
ver hq200-esx02 --username root --type host
Enter password:
Generating VMware vSphere Health Report 1.2 "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.engineering.ucsb.edu/~duonglt/v
mware/
Can't locate object method "commmunity" via package "HostSnmpDestination" at C:\
Program Files\VMware\VMware vSphere CLI\bin\vmwarevSphereHealthCheck.pl line 180
6, line 1.
End Disconnect
My workaround was to use vicfg-snmp.pl with "disable" to disable SNMP, run the script again and then I get a Report, then use "enable" to enable SNMP again.
I am not familiar with sciptin with Perl, so when I look at line 1806 of the script I don't see what to change. . Any suggestions?
The script's data collection and reporting capabilities are fantastic.
Thank you for developing and sharing it!
The issue ended up being a typo in one of the variables, I had an extra m in community which is why you saw the error message with not being able to locate the object. I did not have enough time to test SNMP section in VI3 version of the script: which was noted in the document and carried over to the vSphere version.
I've fixed the issue and actually re-did the output for the SNMP section and hopefully it'll be neater.
Thanks for the comments and try version 1.3 which has been uploaded and let me know if it resolves the issue.
=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at: http://engineering.ucsb.edu/~duonglt/vmware/
VMware Code Central - Scripts/Sample code for Developers and Administrators
If you find this information useful, please award points for "correct" or "helpful".
I try to check my vCenter and I get this:
"Generating VMware vSphere Health Report 1.3 "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.engineering.ucsb.edu/~duonglt/vmware/
Can't locate object method "licenses" via package "LicenseManager" at C:\Install\vmwarevSphereHealthCheck.pl line 2407.
End Disconnect"
What I doing wrong?
Are you running on vSphere? This script is only for vSphere 4.0 setup: vCenter or ESX(i) 4.0
If you're still running on VI 3.5, please take a look at this script:
=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at: http://engineering.ucsb.edu/~duonglt/vmware/
VMware Code Central - Scripts/Sample code for Developers and Administrators
If you find this information useful, please award points for "correct" or "helpful".
Yes, I run this script on vSphere 4 - vCenter! (it's was upgrade from 3.5)
Do you have any hosts that are on ESX 4 yet? or is it just vCenter that's upgraded to vSphere? As you know, if you're in this situation, your ESX(i) 3.5 hosts will continue pulling their licenses from the license server which might explain why it's erroring out since you may not have any ESX(i) 4.0 licenses setup, you may be in this hybrid state where it's part 3.5 and 4.0. I know for a fact that if you have vCenter on 4.0 and it's managing both ESX(i) 3.5 and 4.0 systems, the vSphere report works
=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at: http://engineering.ucsb.edu/~duonglt/vmware/
VMware Code Central - Scripts/Sample code for Developers and Administrators
If you find this information useful, please award points for "correct" or "helpful".
Yes, I have hosts on vCenter! All hosts under ESX 4. All systems work properly. I stopped service license server (even uninstalled it).
The same problem remains.
(sorry for my English).
Hi there,
first i congratulate for this great script.
therefore i would have a inquiry/comments on that.
i have a non-perl script based on Ivo Beerens. With a lot of privat modifications.
But now i'am interested to integrate them into this Perl script.
i'am not familiar with Perl so i finished only few Basic extentions:
ESX/ESXI Configurations:
- Scsi.ConflictRetries
ESX/ESXi hardware configuration:
- MODEL
ESX/ESXi LUN(s):
- MODEL
-
May you have hints for me how to integrate following into the available Labels?
ESX/ESXi Datastore(s):
- San Identifier (Target)
- Lun Id
ESX/ESXi LUN(s):
- Storage Name
- Lun Id
Virtual Machines:
- Performance Stats for CPU Usage (Average) %, CPU Usage in Mhz (Average), CPU Ready (Average), Memory Balloon (Average) KB, Memory Usage (Average) %, Memory Active (Average) KB
- Snapshot Creator
ESX/ESXi hardware configuration:
- Performance Stats for CPU Usage (Average) %, CPU Usage in Mhz (Average), Memory Active (Average), Memory Usage (Average) %
Cluster Statistics:
- Performance Stats for CPU Usage (Average) %, CPU Usage in Mhz (Average), Memory Active (Average), Memory Usage (Average) %
VMware vCenter:
- Permissions
The Performance Stats for Esx,Cluster,Vmware should be possible to set a amount of time. (or dayli, weekly, monthly)
i would be very grateful if i would get some hints
i think all could benefit on this features
Have many thx
Max
I can take a look to see if I can integrate some of this information into the report, but remember this report is meant to capture the environment at the time of execution and is not meant to be any type of performance monitoring report. Detail performance data should probably be generated in another type of custom report, so specifying a time interval will not be supported.
Regarding the actual requests, there are a few things I would like to clear up:
VirtualMachines:
snapshot creator
What do you mean by this? and how would you like the information to be displayed?
VMware vCenter:
Permissions
How would you like the information to be displayed?
If you want to retrieve performance stats and other properties using the vSphere API, please take a look at the following documents if you're new to the VMware API/SDKs:
For performance/hardware gathering take a look at:
=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at: http://engineering.ucsb.edu/~duonglt/vmware/
VMware Code Central - Scripts/Sample code for Developers and Administrators
If you find this information useful, please award points for "correct" or "helpful".
Take a look at the newest version of the script 1.4 which contains of the attributes you've requested. Note that this is not a performance gathering scripts and does increase execution time, especially when you look at the VM stats. Please take a look at the release notes for more information
=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at: http://engineering.ucsb.edu/~duonglt/vmware/
VMware Code Central - Scripts/Sample code for Developers and Administrators
If you find this information useful, please award points for "correct" or "helpful".
Hi William,
Sry for the delay.
Have many thx for your fast integrations
for the Snapshot Point (Creator) i ment the Owner of the Snapshot.
from time to time i make an analyze of available Snapshot and therefore i have the Owner Name in this field.
if you like to integrate this also i could deliver you the non-Perl Toolkit Code over PM.
Have many thx
Best regards
Max
Hey William,
Stellar script! Thanks for the hard work.
Its throwing an error form me, even with out the --vmperforamance fllag set.
C:\Downloads\VM>perl vmwarevspherehealthcheck.pl --server opusvrc1 --type cluste
r --cluster VMCluster1 --passthroughauth
Generating VMware vSphere Health Report 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.engineering.ucsb.edu/~duonglt/v
mware/
Error retrieving VMCluster1 performance:
SOAP Fault:
-
Fault string: A specified parameter was not correct.
metricId
Fault detail: InvalidArgumentFault
Start Time: 01-19-2010 13:31:42
End Time: 01-19-2010 13:32:22
Duration : 40 Seconds
Ken
I've got this set up on Windows Server 2008 with scheduled tasks and powershell scripts. The powershell script runs the .pl healthcheck script then emails the html output as an attachment to wherever you choose. I've got my powershell script below, and the details on the scheduled task beneath that.
Powershell Script:
report.ps1_________________________________________________________________
$dt = get-date -format yyyyMMdd
$pp = get-process powershell
D:\vmwarevSphereHealthCheck.pl --server VCENTERSERVER --username VCENTERUSER --password VCENTERUSERPASSWORD --type datacenter --datacenter DATACENTERNAME --report D:\vmware_health_check$dt.html
$pp = get-process perl
$pp.waitforexit()
Copy-Item D:\vmware_health_check$dt.html D:\emailed\vmware_daily_report.html
$file = "D:\vmware_daily_report.html"
$smtpServer = "SMTPSERVERNAME"
$msg = new-object Net.Mail.MailMessage
$att = new-object Net.Mail.Attachment($file)
$smtp = new-object Net.Mail.SmtpClient($smtpServer)
$msg.From = "vmwarereport@yourcompany.com"
$msg.To.Add("recipients@yourcompany.com")
$msg.Subject = "Today's VMWare Health Report"
$msg.Body = "Enjoy!"
$msg.Attachments.Add($att)
$smtp.Send($msg)
$att.Dispose()
Remove-Item D:\vmware_health_check$dt.html
Remove-Item D:\emailed\vmware_daily_report.html
_______________________________________________________________________
Scheduled Task:
Run: C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile "C:\Program Files\VMware\Infrastructure\vSphere PowerCLI\vim.psc1" & "D:\report.ps1"
Start in: C:\WINDOWS\system32\windowspowershell\v1.0
_______________________________________________________________________
Seems to work pretty flawlessly, thanks for all the hard work on this!
--vmperforamance flag is ONLY for performance stats for the VMs in the VM table. With the new version, it'll automatically report on Cluster and Host performance stats.
What you're seeing is most likely referring to Cluster performance since I do print out an error message Error retrieving VMCluster1 performance: which tells me where the fault is being generated from.
I've also gotten reports from others with various odd 'errors' regarding the performance stats but I've not had the time to narrow it down. I'm wondering if the way I'm extracting the performance is not correct and I'm using an identifier that only works in my environment.
I'll need to do some further research and get back to everyone. Please be patient and I'll have an update as soon as I get a chance.
Thanks for the feedback/comments
=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at: http://engineering.ucsb.edu/~duonglt/vmware/
VMware Code Central - Scripts/Sample code for Developers and Administrators
If you find this information useful, please award points for "correct" or "helpful".
Glad to hear and very cool way to automate the report ... though I personally prefer vMA (linux) over Windows
I also plan on adding email functionality into the script, so you can just setup your email info and it can deliver it to you when it's completed. That'll most likely make it out in the next update of the script. So all you would need to do is to schedule the execution of the script.
=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at: http://engineering.ucsb.edu/~duonglt/vmware/
VMware Code Central - Scripts/Sample code for Developers and Administrators
If you find this information useful, please award points for "correct" or "helpful".
I've just made some updates to the script regarding the performance issue, please download the latest version v1.4.1, the issue should be resolved
=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at: http://engineering.ucsb.edu/~duonglt/vmware/
VMware Code Central - Scripts/Sample code for Developers and Administrators
If you find this information useful, please award points for "correct" or "helpful".
Hi ,
There is a Typo Error on the VM Performance Stats Section of Supported Use Cases .
When i Run this report against a vCenter , I am able to see reports generated only for Hosts that are part of a Cluster ? Is there a way to run the Script against a vCenter and generate Similar reports for all Hosts that are part of them which are not in a clustered Environment ?
Thanks
Sudharsan
Thanks
Sudharsan
Which typo?
The script assumes that you will have at least 1 cluster to logically separate out your hosts, if you don't have a cluster in which hosts are under, they will not be discovered.
=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at: http://engineering.ucsb.edu/~duonglt/vmware/
VMware Code Central - Scripts/Sample code for Developers and Administrators
If you find this information useful, please award points for "correct" or "helpful".
Performance has been misspelled in the VM Performance Stats Section of Supported Use Cases .
Thanks . But Can you please connsider it as an request for feature so that this script can be even used by SMBs .
Also , On the Scheduled Task methodology HTML File is being copied into D:\emailed\vmware_daily_report.html but When consildering file for $file it is assumed as $file = "D:\vmware_daily_report.html" .
Thanks
Sudharsan
Thanks I'll get the typo fixed tonight.
Regarding the cluster setup, if you have vCenter ...you have the functionality of creating a cluster ... remember a cluster is a logical container. I don't expect or care if it has DRS/HA enabled and you don't need those to be enabled to have a valid cluster. For most setups, isolation/segregation is usually done at the cluster level, hence I decided to stick with that. You can easily just create a cluster object and move your hosts into it and the script will work. I'll keep it in mind in the future but as I mentioned, if you have vCenter ... you have cluster creation functionality and this has nothing to do with SMBs
Not sure what you're referring to with the scheduled task? Atm, you can schedule it via any means, so long as the input params are specified in the execution line.
=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at: http://engineering.ucsb.edu/~duonglt/vmware/
VMware Code Central - Scripts/Sample code for Developers and Administrators
If you find this information useful, please award points for "correct" or "helpful".
Hi Willian, thanks for the great script. I was using the 3.5 version flawlessy however after moving to the vSphere version (all of our hosts and vCenter are vsphere U1) it throws a few errors but does succeed. Wondering if you can shed any light?
Use of uninitialized value in concatenation (.) or string at ./vmwarevSphereHealthCheck.pl line 992.
Use of uninitialized value in print at ./vmwarevSphereHealthCheck.pl line 2471.
Cheers
If you're using the latest version of the script v1.4.1:
The errors are regarding the following:
Line 992: Something with the output of a dvPortgroup with dvs
Line: 2471: HA Failover level is not configured or unable to retrieve the value
Could you double check this within your environment and also for the dvPortgroup, see if this is listed out properly for all your VMs, I suspect there's some logic that's still being missed.
Thanks
=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at: http://engineering.ucsb.edu/~duonglt/vmware/
VMware Code Central - Scripts/Sample code for Developers and Administrators
If you find this information useful, please award points for "correct" or "helpful".
I am using v1.4.1 and did check the code that the errors referred too but still thought my settings looked good. After you suggestion I rechecked my HA cluster settings and they were set to reserve a percentage of resources for HA rather than dedicating the cluster failover to say 1. When I set it back to 1,2,3 etc... the error does not appear for 2471. The script doesn't pick up the percentage it seems.
For dvPortgroup error yes they do all appear correctly form what I can tell. What I do notice when I run the script againts vSphere vCeneters that still using VSS and have no vDS at all the error still appears
I've just found your script and ran it against an ESX4i host and got the performance error.
Command used: vmwarevSphereHealthCheck.pl --server myserver --username root --password mypassword --type host
Error retrieving myserver performance:
SOAP Fault:
-
Fault string: A specified parameter was not correct.
Fault detail: InvalidArgumentFault
Start Time: 01-28-2010 14:24:32
End Time: 01-28-2010 14:24:36
Duration : 4 Seconds
Thanks for nice script, I've got an error in 1.4.1 script like sammyvm:
Command: /home/vi-admin/vmwarevSphereHealthCheck.pl --server ps01 --username vcenter --password ************ --type vcenter --report /home/vi-admin/vmware_health_report.html
Generating VMware vSphere Health Report 1.4.1 "/home/vi-admin/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.engineering.ucsb.edu/~duonglt/vmware/
Use of uninitialized value in concatenation (.) or string at /home/vi-admin/vmwarevSphereHealthCheck.pl line 992.
I'll have to look into the performance stats again, I thought it was resolved in the latest version but looks like I might still have missed something. I'll post an update once I get a chance to investigate.
Thanks for your patience
=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at: http://engineering.ucsb.edu/~duonglt/vmware/
VMware Code Central - Scripts/Sample code for Developers and Administrators
If you find this information useful, please award points for "correct" or "helpful".
I'll need to investigate this issue, is the ESXi 4.0 host a standalone? or is it being managed by vCenter and using virtual distributed vSwitch?
=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at: http://engineering.ucsb.edu/~duonglt/vmware/
VMware Code Central - Scripts/Sample code for Developers and Administrators
If you find this information useful, please award points for "correct" or "helpful".
I use ESX 4.0 hosts (not "i") managed by vCenter with vds.
Okay, that's what I thought, it's most likely related to retrieving the vDS information. I'll update when I have something, too many things to do and not enough time
=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at: http://engineering.ucsb.edu/~duonglt/vmware/
VMware Code Central - Scripts/Sample code for Developers and Administrators
If you find this information useful, please award points for "correct" or "helpful".
I get the below error when I run the script..
D:\>vmwarevSphereHealthCheck.pl --type host --server esx26 --username root --report esx26.html
Enter password:
Generating VMware vSphere Health Report 1.4.1 "esx26.html" ...
..
..
Use of uninitialized value in concatenation (.) or string at D:\vmwarevSphereHealthCheck.pl line 424, line 1.
Also, the features frame is empty i.e. it does not show me expiration date etc for the ESX features.
What version of vSphere 4.0 license do you have for your ESX 4.0 host? The features should display....
=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at: http://engineering.ucsb.edu/~duonglt/vmware/
VMware Code Central - Scripts/Sample code for Developers and Administrators
If you find this information useful, please award points for "correct" or "helpful".
Hi,
This may be a tad too late but I just got my vma4.0 installed a couple of days so I was wanting to test out some useful scripts. Then I stumbled across this discussion by chance, which is great. Anyway, for the cron, here's what I did and got some output scripts with date.
1. System cron example.
vi /etc/crontab
*/5 * * * * root /home/vi-admin/scripts/vmwarevSphereHealthCheck.pl --server valerie --username chakrit --password 'XXX' --type vcenter --report=/home/vi-admin/reports/alcae_health_`date +\%m-\%d-\%y_\%H:\%M:\%S`.html
Here you specify the frequency (stars bit), then the user to execute the script follow by script parameters.
The last bit is the output filename with date/time stamp. Note that you'll need a backslash before the % symbol to enable it to be recognised by the cron.
2. User cron example.
crontab -e
*/5 * * * * /home/vi-admin/scripts/vmwarevSphereHealthCheck.pl --server valerie --username chakrit --password 'X' --type vcenter --report=/home/vi-admin/reports/health_`date +\%m-\%d-\%y_\%H:\%M:\%S`.html
Similar to the above but you don't specify the username to execute the script.
The other thing I had to do is to always use the full path to the location of the script and the output directory.
Thanks Chakrit - I'm still watching this thread
I scripted a collection for cron, in effect doing what you state, and I even added a bit for compression and FTP to a remote target, with local cleanup after.
I think the Windows folks have a tougher time, particularly looking for a mechanism to email the output. On the vMA I just get Sendmail working.
Cheers -
Don
In the next version, I'll include email functionality, it's actually been there for awhile in various scripts I've written but haven't had the time to port that back into other scripts. Keep an eye out for that update pretty soon ... just need to find the time
Also note, this script 'can' run on Windows so long as vCLI is installed ... I don't support it under Windows since I rather not deal with any 'window' issues that may be generated but I do know users have successfully executed this on Windows and it works perfectly fine. If you're more comfortable on Windows, you can just setup a schedule task and use the email capabilities on Windows. Though, do note that all my development is on vMA, so any issues that may come up, I won't be able to assist.
=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at: http://engineering.ucsb.edu/~duonglt/vmware/
VMware Code Central - Scripts/Sample code for Developers and Administrators
If you find this information useful, please award points for "correct" or "helpful".
Email for Windows isn't hard... Blat (www.blat.net) is freely available, and has been for years...
Learning how to write a batch file to blat the output of William's code and schedule it via Task Scheduler is an exercise left for the reader...
Cool.
I'm hoping the Perl email module will just 'work' in Windows, that way you don't need another utility. You can just pass in your mailserver/etc. and then a simple scheduled task will work. I unfortunately don't have a test mail server to verify, so I'll have to rely on users to confirm or deny for Windows.
=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at: http://engineering.ucsb.edu/~duonglt/vmware/
VMware Code Central - Scripts/Sample code for Developers and Administrators
If you find this information useful, please award points for "correct" or "helpful".
Hi, William:
After a number of months hiatus I'm back using the script. In all cases I'm running the script against single ESX/ESXi hosts (using it to check single hosts for various clients) from the vSphere CLI. In all cases I get weird listings for things like termpertare (eg 8400C rather than 80C) but the status is green OK. I'm assuming this is just some weirdness with formatting but I'm wondering if you have an idea how to fix it? Also, when I run against ESXi machines (but not ESX) I get a SOAP fault, Fault String: A specific parameter was not correct. Fault detail: InvalidArgumentFault but the script appears to run through to completion and I get a full report. Again, any ideas? All machines are patched to latest for ESX/ESXi4.
Thanks so much for your help and for a really superb tool!
Robert