I am trying to use the health script which is located at http://communities.vmware.com/docs/DOC-9420
Using health script version 0.9.4
VIMA 1.0
The below command runs perfectly for a ESX host and gives me a detailed html report
./vmwareHealthCheck.pl --server esx_server_ip --username esx_username --type host
However, when I run
./vmwareHealthCheck.pl --server vCenter_IP --username administrator --type vcenter
I get the error
No clusters found.
Does that mean that I need to create a cluster and then add hosts within it or I am missing something in the command syntax? All I need is a way to get report of all esx hosts which are being managed by my vCenter server.
Also, is there a script available which lists
1. the virtual machines that are part of DRS/HA enabled cluster
2. orphaned virtual machines in a vCenter.
A requirement for the script when passing the vCenter param is a single cluster, if you create a cluster object then the script will work.
1) I don't know of one, but its not too hard to write your own
2) Take a look at this script I wrote that removes Orphaned VM(s) you can modify to just print out the orphans
#!/usr/bin/perl -w
use strict;
use warnings;
use VMware::VILib;
use VMware::VIRuntime;
Opts::parse();
Opts::validate();
Util::connect();
my ($hosts, $host);
$hosts = Vim::find_entity_views(view_type => 'HostSystem');
unless (defined $hosts){
die "No hosts found.\n";
}
foreach $host(@{$hosts}) {
print "Searching Host: ", $host->name,"\n";
my $vm_views = Vim::get_views(mo_ref_array => $host->vm, properties => \['summary.config.name','summary.runtime.connectionState'\]);
foreach(sort {$a->{'summary.config.name'} cmp $b->{'summary.config.name'}} @$vm_views) {
if($_->{'summary.runtime.connectionState'}->val eq 'orphaned') {
print "\t",$_->{'summary.config.name'}, " is ", $_->{'summary.runtime.connectionState'}->val,"\n";
}
}
}
Util::disconnect();
=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at:
If you find this information useful, please award points for "correct" or "helpful".
Thanks for the very quick update! So there is no way I can run this script connecting to a VC server which has 2 esx hosts which are not under a cluster?
Btw this script is just superb!! thanks again for this one.