[vi-admin@rafaeli ~]$ ./vmwarevSphereHealthCheck.pl
Required command option 'type' not specified.
Synopsis: ./vmwarevSphereHealthCheck.pl OPTIONS
Command-specific options:
--cluster
The name of a vCenter cluster
--datacenter
The name of a vCenter datacenter
--logcount
The number of lines to output from hostd logs
--report
The name of the report to output. Please add ".html" extension
--type (required)
Type: [vcenter|datacenter|cluster|host|detail-hosts]
Common VI options:
--config (variable VI_CONFIG)
Location of the VI Perl configuration file
--credstore (variable VI_CREDSTORE)
Name of the credential store file defaults to <HOME>/.vmware/credstore/vicredentials.xml on Linux and <APPDATA>/VMware/credstore/vicredentials.xml on Windows
--encoding (variable VI_ENCODING, default 'utf8')
Encoding: utf8, cp936 (Simplified Chinese), iso-8859-1 (German), shiftjis (Japanese)
--help
Display usage information for the script
--passthroughauth (variable VI_PASSTHROUGHAUTH)
Attempt to use pass-through authentication
--passthroughauthpackage (variable VI_PASSTHROUGHAUTHPACKAGE, default 'Negotiate')
Pass-through authentication negotiation package
--password (variable VI_PASSWORD)
Password
--portnumber (variable VI_PORTNUMBER)
Port used to connect to server
--protocol (variable VI_PROTOCOL, default 'https')
Protocol used to connect to server
--savesessionfile (variable VI_SAVESESSIONFILE)
File to save session ID/cookie to utilize
--server (variable VI_SERVER, default 'localhost')
VI server to connect to. Required if url is not present
--servicepath (variable VI_SERVICEPATH, default '/sdk/webService')
Service path used to connect to server
--sessionfile (variable VI_SESSIONFILE)
File containing session ID/cookie to utilize
--url (variable VI_URL)
VI SDK URL to connect to. Required if server is not present
--username (variable VI_USERNAME)
Username
--verbose (variable VI_VERBOSE)
Display additional debugging information
--version
Display version information for the script
./vmwarevSphereHealthCheck.pl --server VC_SERVER --username VC_USERNAME --password VC_PASSWORD --type vcenter
./vmwarevSphereHealthCheck.pl --server VC_SERVER --username VC_USERNAME --password VC_PASSWORD --type datacenter --datacenter DATACENTER_NAME
./vmwarevSphereHealthCheck.pl --server VC_SERVER --username VC_USERNAME --password VC_PASSWORD --type cluster --cluster CLUSTER_NAME
./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 detail-hosts
./vmwarevSphereHealthCheck.pl -server VC_SERVER --username VC_USERNAME --password VC_PASSWORD --type detail-hosts --logcount 20
If you look at the requirements in the documentation you'll see one is for pre-vSphere and the other is for vSphere.
The relationship is the following:
VIMA 1.0 + ESX(i) 3.5u2+ = VMware Health Check Report v0.9.4
vMA 4.0 + ESX(i) 4.0+ = VMware vSphere Health Check Report v1.2
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."
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) {
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:
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?)
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.
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....