diff --git a/perl/hostOperations.pl b/perl/hostOperations.pl index fe1be0f..34af8a8 100755 --- a/perl/hostOperations.pl +++ b/perl/hostOperations.pl @@ -53,7 +53,7 @@ print "Error: " . $@ . "\n\n"; } } -} elsif(Opts::get_option('operation') eq 'exi_maint' ) { +} elsif(Opts::get_option('operation') eq 'ext_maint' ) { foreach my $host_name( @host_list ) { chomp($host_name); diff --git a/perl/vmwarevSphereHealthCheck.pl b/perl/vmwarevSphereHealthCheck.pl index 4f0043a..0f86dd2 100755 --- a/perl/vmwarevSphereHealthCheck.pl +++ b/perl/vmwarevSphereHealthCheck.pl @@ -27,88 +27,88 @@ my %opts = ( cluster => { - type => "=s", - help => "The name of a vCenter cluster to query", - required => 0, - }, - datacenter => { - type => "=s", - help => "The name of a vCenter datacenter to query", - required => 0, - }, - hostlist => { - type => "=s", - help => "File containting list of ESX/ESXi host(s) to query", - required => 0, - }, - vmlist => { - type => "=s", - help => "File containting list of VM(s) to query", - required => 0, - }, - type => { - type => "=s", - help => "Type: [vcenter|datacenter|cluster|host]\n", - required => 1, - }, - report => { - type => "=s", - help => "The name of the report to output. Please add \".html\" extension", - required => 0, - default => "vmware_health_report.html", - }, - logcount => { - type => "=s", - help => "The number of lines to output from hostd logs", - required => 0, - default => 15, - }, - vmperformance => { - type => "=s", - help => "Enable VM Performance gathering [yes|no] (Can potentially double your runtime)", - required => 0, - default => "no", - }, - hostperformance => { - type => "=s", - help => "Enable Host Performance gathering [yes|no] (Can potentially increase your runtime)", - required => 0, - default => "no", - }, - clusterperformance => { - type => "=s", - help => "Enable Cluster Performance gathering [yes|no] (Can potentially increase your runtime)", - required => 0, - default => "no", - }, - email => { - type => "=s", - help => "[yes|no]", - required => 0, - default => "no", - }, - demo => { - type => "=s", - help => "[yes|no]", - required => 0, - default => "no", - }, - conf => { - type => "=s", - help => "File containing Host and VM specific configurations to output", - required => 0, - }, - printerfriendly => { - type => "=s", - help => "Whether the html output will be printer friendly [yes|no]", - required => 0, - default => "no", - }, - debug => { - type => "=s", - help => "Enable/Disable debugging to help William troubleshot [0|1]", - required => 0, - }, + type => "=s", + help => "The name of a vCenter cluster to query", + required => 0, + }, + datacenter => { + type => "=s", + help => "The name of a vCenter datacenter to query", + required => 0, + }, + hostlist => { + type => "=s", + help => "File containting list of ESX/ESXi host(s) to query", + required => 0, + }, + vmlist => { + type => "=s", + help => "File containting list of VM(s) to query", + required => 0, + }, + type => { + type => "=s", + help => "Type: [vcenter|datacenter|cluster|host]\n", + required => 1, + }, + report => { + type => "=s", + help => "The name of the report to output. Please add \".html\" extension", + required => 0, + default => "vmware_health_report.html", + }, + logcount => { + type => "=s", + help => "The number of lines to output from hostd logs", + required => 0, + default => 15, + }, + vmperformance => { + type => "=s", + help => "Enable VM Performance gathering [yes|no] (Can potentially double your runtime)", + required => 0, + default => "no", + }, + hostperformance => { + type => "=s", + help => "Enable Host Performance gathering [yes|no] (Can potentially increase your runtime)", + required => 0, + default => "no", + }, + clusterperformance => { + type => "=s", + help => "Enable Cluster Performance gathering [yes|no] (Can potentially increase your runtime)", + required => 0, + default => "no", + }, + email => { + type => "=s", + help => "[yes|no]", + required => 0, + default => "no", + }, + demo => { + type => "=s", + help => "[yes|no]", + required => 0, + default => "no", + }, + conf => { + type => "=s", + help => "File containing Host and VM specific configurations to output", + required => 0, + }, + printerfriendly => { + type => "=s", + help => "Whether the html output will be printer friendly [yes|no]", + required => 0, + default => "no", + }, + debug => { + type => "=s", + help => "Enable/Disable debugging to help William troubleshoot [0|1]", + required => 0, + }, ); # validate options, and connect to the server @@ -131,9 +131,9 @@ ############### -# PROPERTY filters +# PROPERTY filters ############### -my $datacenter_properties = [ 'name' ]; +my $datacenter_properties = [ 'name' ]; ############### # COLORS @@ -300,8 +300,8 @@ sub emailReport { my $smtp = Net::SMTP->new($EMAIL_HOST ,Hello => $EMAIL_DOMAIN,Timeout => 30,); unless($smtp) { - die "Error: Unable to setup connection with email server: \"" . $EMAIL_HOST . "\"!\n"; - } + die "Error: Unable to setup connection with email server: \"" . $EMAIL_HOST . "\"!\n"; + } open(DATA, $report) || die("Could not open the file"); my @report = ; @@ -311,27 +311,27 @@ sub emailReport { my $boundary = 'frontier'; - $smtp->mail($EMAIL_FROM); - $smtp->to(@EMAIL_TO); - $smtp->data(); - $smtp->datasend('From: '.$EMAIL_FROM."\n"); - $smtp->datasend('To: '.@EMAIL_TO."\n"); - $smtp->datasend('Subject: VMware vSphere Health Check Report Completed - '.giveMeDate('MDYHMS'). " (" . $system_name . ")\n"); - $smtp->datasend("MIME-Version: 1.0\n"); - $smtp->datasend("Content-type: multipart/mixed;\n\tboundary=\"$boundary\"\n"); - $smtp->datasend("\n"); - $smtp->datasend("--$boundary\n"); - $smtp->datasend("Content-type: text/plain\n"); - $smtp->datasend("Content-Disposition: quoted-printable\n"); - $smtp->datasend("\nReport $report is attached!\n"); - $smtp->datasend("--$boundary\n"); - $smtp->datasend("Content-Type: application/text; name=\"$report\"\n"); - $smtp->datasend("Content-Disposition: attachment; filename=\"$report\"\n"); - $smtp->datasend("\n"); - $smtp->datasend("@report\n"); - $smtp->datasend("--$boundary--\n"); - $smtp->dataend(); - $smtp->quit; + $smtp->mail($EMAIL_FROM); + $smtp->to(@EMAIL_TO); + $smtp->data(); + $smtp->datasend('From: '.$EMAIL_FROM."\n"); + $smtp->datasend('To: '.@EMAIL_TO."\n"); + $smtp->datasend('Subject: VMware vSphere Health Check Report Completed - '.giveMeDate('MDYHMS'). " (" . $system_name . ")\n"); + $smtp->datasend("MIME-Version: 1.0\n"); + $smtp->datasend("Content-type: multipart/mixed;\n\tboundary=\"$boundary\"\n"); + $smtp->datasend("\n"); + $smtp->datasend("--$boundary\n"); + $smtp->datasend("Content-type: text/plain\n"); + $smtp->datasend("Content-Disposition: quoted-printable\n"); + $smtp->datasend("\nReport $report is attached!\n"); + $smtp->datasend("--$boundary\n"); + $smtp->datasend("Content-Type: application/text; name=\"$report\"\n"); + $smtp->datasend("Content-Disposition: attachment; filename=\"$report\"\n"); + $smtp->datasend("\n"); + $smtp->datasend("@report\n"); + $smtp->datasend("--$boundary--\n"); + $smtp->dataend(); + $smtp->quit; } } @@ -382,7 +382,7 @@ sub getSystemSummary { my $licenses = $licenseMgr->licenses; foreach(@$licenses) { - if($demo eq "no") { + if($demo eq "no") { my $licenseName = $_->name; my $licenseEdition = $_->editionKey; my $licenseKey = $_->licenseKey; @@ -390,7 +390,7 @@ sub getSystemSummary { my $licenseUsed = int(($_->used ? $_->used : 0)); my $licenseTotal = $_->total; my $licenseConsumed = ($licenseTotal - $licenseUsed); - $summary_start .= "".$licenseName."".$licenseEdition."".$licenseKey."".$licenseCost."".$licenseTotal."".$licenseUsed."".$licenseConsumed."\n"; + $summary_start .= "".$licenseName."".$licenseEdition."".$licenseKey."".$licenseCost."".$licenseTotal."".$licenseUsed."".$licenseConsumed."\n"; my $licenseProperties = $_->properties; if($licenseProperties) { $feature_info_string .= "EDITION w/FEATURESEXPIRATION (HOURS)EXPIRATION (MINS)EXPIRATION DATE\n"; @@ -398,17 +398,17 @@ sub getSystemSummary { } foreach(@$licenseProperties) { if($_->key ne 'feature') { - if($_->key eq 'expirationHours' ) { $feature_info_string .= "".$_->value.""; } - if($_->key eq 'expirationMinutes' ) { $feature_info_string .= "".$_->value.""; } - if($_->key eq 'expirationDate' ) { $feature_info_string .= "".$_->value."\n"; } + if($_->key eq 'expirationHours' ) { $feature_info_string .= "".$_->value.""; } + if($_->key eq 'expirationMinutes' ) { $feature_info_string .= "".$_->value.""; } + if($_->key eq 'expirationDate' ) { $feature_info_string .= "".$_->value."\n"; } } else { my $feature = $_->value; $features .= "".$feature->value."\n"; } } } else { - $summary_start .= "DEMO_MODEDEMO_MODEDEMO_MODEDEMO_MODEDEMO_MODEDEMO_MODEDEMO_MODE\n"; - } + $summary_start .= "DEMO_MODEDEMO_MODEDEMO_MODEDEMO_MODEDEMO_MODEDEMO_MODEDEMO_MODE\n"; + } $feature_string .= $feature_info_string . $features; ($features,$feature_info_string) = ("",""); } @@ -441,9 +441,9 @@ sub getSystemSummary { my $authMgr = Vim::get_view (mo_ref => $sc->authorizationManager); my $roleLists = $authMgr->roleList; my %rolemapping; - foreach(@$roleLists) { - $rolemapping{$_->roleId} = $_->name; - } + foreach(@$roleLists) { + $rolemapping{$_->roleId} = $_->name; + } if($demo eq "no") { eval { @@ -470,7 +470,7 @@ sub getSystemSummary { if($demo eq "no") { my $sessionMgr = Vim::get_view (mo_ref => $sc->sessionManager); - my $sess_list = $sessionMgr->sessionList; + my $sess_list = $sessionMgr->sessionList; foreach(sort {$a->userName cmp $b->userName} @$sess_list) { $summary_start .= "".$_->userName."".$_->fullName."".$_->loginTime."".$_->lastActiveTime."\n"; } @@ -499,11 +499,11 @@ sub getSystemSummary { $profile_string .= "".$_->name."".$profileDescription."".$_->createdTime."".$_->modifiedTime."".(($_->config->enabled) ? "YES" : "NO")."".$_->complianceStatus."\n"; } if($hasProfile eq 1) { - $summary_start .= "

Host Profile(s):

\n"; - $summary_start .= "\n"; - $summary_start .= "\n"; + $summary_start .= "

Host Profile(s):

\n"; + $summary_start .= "
PROFILE NAMEDESCRIPTIONCREATION TIMELAST MODIFIEDENABLEDCOMPLIANCE STATUS
\n"; + $summary_start .= "\n"; $summary_start .= $profile_string; - } + } } $summary_start .= "
PROFILE NAMEDESCRIPTIONCREATION TIMELAST MODIFIEDENABLEDCOMPLIANCE STATUS
\n"; } @@ -546,7 +546,7 @@ sub getCluster { if($type eq 'cluster') { print REPORT_OUTPUT "
"; #please do not touch this, else the jump tags will break - print REPORT_OUTPUT "\n//\n"; + print REPORT_OUTPUT "\n//\n"; $cluster_count++; &printClusterSummary($cluster_view,$cluster_count,$atype,$aversion); print REPORT_OUTPUT "
\n"; @@ -555,25 +555,25 @@ sub getCluster { if($cluster_views) { print REPORT_OUTPUT "
"; #please do not touch this, else the jump tags will break - print REPORT_OUTPUT "\n//\n"; - foreach(sort {$a->name cmp $b->name} @$cluster_views) { - $cluster_count++; + print REPORT_OUTPUT "\n//\n"; + foreach(sort {$a->name cmp $b->name} @$cluster_views) { + $cluster_count++; if($_->isa("ClusterComputeResource")) { - &printClusterSummary($_,$cluster_count,$atype,$aversion); - } - } + &printClusterSummary($_,$cluster_count,$atype,$aversion); + } + } print REPORT_OUTPUT "
\n"; } }elsif($type eq 'vcenter') { if($cluster_views) { print REPORT_OUTPUT "
"; #please do not touch this, else the jump tags will break - print REPORT_OUTPUT "\n//\n"; + print REPORT_OUTPUT "\n//\n"; foreach(sort {$a->name cmp $b->name} @$cluster_views) { $cluster_count++; if($_->isa("ClusterComputeResource")) { - &printClusterSummary($_,$cluster_count,$atype,$aversion); - } + &printClusterSummary($_,$cluster_count,$atype,$aversion); + } } } print REPORT_OUTPUT "
\n"; @@ -594,14 +594,14 @@ sub getDatastoreCluster { $datastore_cluster_count++; &printDatacenterSummary($cluster_parent,$datastore_cluster_count,$atype,$aversion); print REPORT_OUTPUT "\n"; - } elsif($type eq 'datacenter' && ($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0'|| $aversion eq '6.5.0')) { + } elsif($type eq 'datacenter' && ($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0')) { print REPORT_OUTPUT "
"; - #please do not touch this, else the jump tags will break - print REPORT_OUTPUT "\n//\n"; + #please do not touch this, else the jump tags will break + print REPORT_OUTPUT "\n//\n"; $datastore_cluster_count++; - &printDatacenterSummary($datacenter_view,$datastore_cluster_count,$atype,$aversion); + &printDatacenterSummary($datacenter_view,$datastore_cluster_count,$atype,$aversion); print REPORT_OUTPUT "
\n"; - } elsif($type eq 'vcenter' && ($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0'|| $aversion eq '6.5.0')) { + } elsif($type eq 'vcenter' && ($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0')) { print REPORT_OUTPUT "
"; #please do not touch this, else the jump tags will break print REPORT_OUTPUT "\n//\n"; @@ -624,16 +624,16 @@ sub getHost { if($type eq 'host') { #please do not touch this, else the jump tags will break - print REPORT_OUTPUT "\n//\n"; + print REPORT_OUTPUT "\n//\n"; &printHostSummary($host_view,undef,$cluster_count,$type,$atype,$aversion,$sc); }elsif($type eq 'datacenter') { #please do not touch this, else the jump tags will break - print REPORT_OUTPUT "\n//\n"; + print REPORT_OUTPUT "\n//\n"; foreach my $cluster(sort {$a->name cmp $b->name} @$cluster_views) { $cluster_count++; my $clusterTag = "host-".$cluster->name."-$cluster_count"; my $clusterShortTag = $cluster->name; - push @host_jump_tags,"   Cluster: $clusterShortTag
\n"; + push @host_jump_tags,"   Cluster: $clusterShortTag
\n"; print REPORT_OUTPUT "
\n"; print REPORT_OUTPUT "

Cluster: $clusterShortTag

\n"; my $hosts = Vim::get_views (mo_ref_array => $cluster->host); @@ -644,56 +644,56 @@ sub getHost { #please do not touch this, else the jump tags will break print REPORT_OUTPUT "\n//\n"; my $clusterTag = "host-".$cluster_view->name."-$cluster_count"; - my $clusterShortTag = $cluster_view->name; - push @host_jump_tags,"   Cluster: $clusterShortTag
\n"; - print REPORT_OUTPUT "
\n"; + my $clusterShortTag = $cluster_view->name; + push @host_jump_tags,"   Cluster: $clusterShortTag
\n"; + print REPORT_OUTPUT "
\n"; print REPORT_OUTPUT "

Cluster: $clusterShortTag

\n"; my $hosts = Vim::get_views (mo_ref_array => $cluster_view->host); &printHostSummary($hosts,$cluster_view->name,$cluster_count,$type,$atype,$aversion,$sc); }elsif($type eq 'vcenter') { #please do not touch this, else the jump tags will break - print REPORT_OUTPUT "\n//\n"; + print REPORT_OUTPUT "\n//\n"; foreach my $cluster(sort {$a->name cmp $b->name} @$cluster_views) { $cluster_count++; my $clusterTag = "host-".$cluster->name."-$cluster_count"; - my $clusterShortTag = $cluster->name; - push @host_jump_tags,"   Cluster: $clusterShortTag
\n"; + my $clusterShortTag = $cluster->name; + push @host_jump_tags,"   Cluster: $clusterShortTag
\n"; print REPORT_OUTPUT "
\n"; - print REPORT_OUTPUT "

Cluster: $clusterShortTag

\n"; + print REPORT_OUTPUT "

Cluster: $clusterShortTag

\n"; my $hosts = Vim::get_views (mo_ref_array => $cluster->host); &printHostSummary($hosts,$cluster->name,$cluster_count,$type,$atype,$aversion,$sc); - } + } } print REPORT_OUTPUT "
\n"; } sub getVM { - my ($type,$atype,$aversion,$sc) = @_; - - print REPORT_OUTPUT "
\n"; - - my $cluster_count = 0; - - if($type eq 'host') { - #please do not touch this, else the jump tags will break - print REPORT_OUTPUT "\n//\n"; - &printVMSummary($host_view,undef,$cluster_count,$type,$atype,$aversion,$sc); - }elsif($type eq 'datacenter') { - #please do not touch this, else the jump tags will break - print REPORT_OUTPUT "\n//\n"; - foreach my $cluster(sort {$a->name cmp $b->name} @$cluster_views) { - $cluster_count++; - my $clusterTag = "vm-".$cluster->name."-$cluster_count"; - my $clusterShortTag = $cluster->name; - push @vm_jump_tags,"   Cluster: $clusterShortTag
\n"; - print REPORT_OUTPUT "
\n"; + my ($type,$atype,$aversion,$sc) = @_; + + print REPORT_OUTPUT "
\n"; + + my $cluster_count = 0; + + if($type eq 'host') { + #please do not touch this, else the jump tags will break + print REPORT_OUTPUT "\n//\n"; + &printVMSummary($host_view,undef,$cluster_count,$type,$atype,$aversion,$sc); + }elsif($type eq 'datacenter') { + #please do not touch this, else the jump tags will break + print REPORT_OUTPUT "\n//\n"; + foreach my $cluster(sort {$a->name cmp $b->name} @$cluster_views) { + $cluster_count++; + my $clusterTag = "vm-".$cluster->name."-$cluster_count"; + my $clusterShortTag = $cluster->name; + push @vm_jump_tags,"   Cluster: $clusterShortTag
\n"; + print REPORT_OUTPUT "
\n"; print REPORT_OUTPUT "

Cluster: $clusterShortTag

\n"; - my $hosts = Vim::get_views (mo_ref_array => $cluster->host); - &printVMSummary($hosts,$cluster->name,$cluster_count,$type,$atype,$aversion,$sc); - } - }elsif($type eq 'cluster') { - $cluster_count++; + my $hosts = Vim::get_views (mo_ref_array => $cluster->host); + &printVMSummary($hosts,$cluster->name,$cluster_count,$type,$atype,$aversion,$sc); + } + }elsif($type eq 'cluster') { + $cluster_count++; #please do not touch this, else the jump tags will break print REPORT_OUTPUT "\n//\n"; my $clusterTag = "vm-".$cluster_view->name."-$cluster_count"; @@ -702,71 +702,71 @@ sub getVM { print REPORT_OUTPUT "
\n"; print REPORT_OUTPUT "

Cluster: $clusterShortTag

\n"; my $hosts = Vim::get_views (mo_ref_array => $cluster_view->host); - &printVMSummary($hosts,$cluster_view->name,$cluster_count,$type,$atype,$aversion,$sc); - }elsif($type eq 'vcenter') { - #please do not touch this, else the jump tags will break - print REPORT_OUTPUT "\n//\n"; - foreach my $cluster(sort {$a->name cmp $b->name} @$cluster_views) { - $cluster_count++; - my $clusterTag = "vm-".$cluster->name."-$cluster_count"; - my $clusterShortTag = $cluster->name; - push @vm_jump_tags,"   Cluster: $clusterShortTag
\n"; - print REPORT_OUTPUT "
\n"; + &printVMSummary($hosts,$cluster_view->name,$cluster_count,$type,$atype,$aversion,$sc); + }elsif($type eq 'vcenter') { + #please do not touch this, else the jump tags will break + print REPORT_OUTPUT "\n//\n"; + foreach my $cluster(sort {$a->name cmp $b->name} @$cluster_views) { + $cluster_count++; + my $clusterTag = "vm-".$cluster->name."-$cluster_count"; + my $clusterShortTag = $cluster->name; + push @vm_jump_tags,"   Cluster: $clusterShortTag
\n"; + print REPORT_OUTPUT "
\n"; print REPORT_OUTPUT "

Cluster: $clusterShortTag

\n"; - my $hosts = Vim::get_views (mo_ref_array => $cluster->host); - &printVMSummary($hosts,$cluster->name,$cluster_count,$type,$atype,$aversion,$sc); - } - } + my $hosts = Vim::get_views (mo_ref_array => $cluster->host); + &printVMSummary($hosts,$cluster->name,$cluster_count,$type,$atype,$aversion,$sc); + } + } print REPORT_OUTPUT "
\n"; } sub getVPXSettings { - my ($vpxcheck,$atype,$sc) = @_; - - if($vpxcheck eq "yes" && $atype eq "VirtualCenter") { - my $setting = Vim::get_view(mo_ref => $sc->setting); - my $vpxSettings = $setting->setting; - - my $vpxString = ""; - if($vpxSettings) { - print REPORT_OUTPUT "
\n"; - print REPORT_OUTPUT "

vCenter VPX Configurations

\n"; - print REPORT_OUTPUT "\n"; - print REPORT_OUTPUT "\n"; - foreach(sort {$a->key cmp $b->key} @$vpxSettings) { - my $key = $_->key; - my $value = $_->value; - if($demo eq "yes" && ($key eq "VirtualCenter.InstanceName" || $key eq "VirtualCenter.DBPassword" || $key eq "VirtualCenter.LDAPAdminPrincipal" || $key eq "VirtualCenter.ManagedIP" || $key eq "VirtualCenter.VimApiUrl" || $key eq "VirtualCenter.VimWebServicesUrl" || $key eq "vpxd.motd" || $key =~ m/config.registry/ || $key =~ m/mail/ || $key =~ m/snmp/)) { - $value = "DEMO_MODE"; - } - $vpxString .= "\n"; - } - print REPORT_OUTPUT $vpxString; - print REPORT_OUTPUT "
KEYVALUE
".$key."".$value."
\n"; - print REPORT_OUTPUT "
\n"; - } - } + my ($vpxcheck,$atype,$sc) = @_; + + if($vpxcheck eq "yes" && $atype eq "VirtualCenter") { + my $setting = Vim::get_view(mo_ref => $sc->setting); + my $vpxSettings = $setting->setting; + + my $vpxString = ""; + if($vpxSettings) { + print REPORT_OUTPUT "
\n"; + print REPORT_OUTPUT "

vCenter VPX Configurations

\n"; + print REPORT_OUTPUT "\n"; + print REPORT_OUTPUT "\n"; + foreach(sort {$a->key cmp $b->key} @$vpxSettings) { + my $key = $_->key; + my $value = $_->value; + if($demo eq "yes" && ($key eq "VirtualCenter.InstanceName" || $key eq "VirtualCenter.DBPassword" || $key eq "VirtualCenter.LDAPAdminPrincipal" || $key eq "VirtualCenter.ManagedIP" || $key eq "VirtualCenter.VimApiUrl" || $key eq "VirtualCenter.VimWebServicesUrl" || $key eq "vpxd.motd" || $key =~ m/config.registry/ || $key =~ m/mail/ || $key =~ m/snmp/)) { + $value = "DEMO_MODE"; + } + $vpxString .= "\n"; + } + print REPORT_OUTPUT $vpxString; + print REPORT_OUTPUT "
KEYVALUE
".$key."".$value."
\n"; + print REPORT_OUTPUT "
\n"; + } + } } sub getVMwareApps { - my ($vmwcheck,$atype,$sc) = @_; - - if($vmwcheck eq "yes" && $atype eq "VirtualCenter") { - - my $vmwAppString = ""; - if(@vmw_apps) { - print REPORT_OUTPUT "
\n"; - print REPORT_OUTPUT "

VMware and 3rd Party Applications in a VM

\n"; - print REPORT_OUTPUT "\n"; - print REPORT_OUTPUT "\n"; - foreach(@vmw_apps) { - $vmwAppString .= $_; - } - print REPORT_OUTPUT $vmwAppString; - print REPORT_OUTPUT "
CLUSTERVM NAMEVMWARE/3RD PARTY APPLICATION
\n"; - print REPORT_OUTPUT "
\n"; - } - } + my ($vmwcheck,$atype,$sc) = @_; + + if($vmwcheck eq "yes" && $atype eq "VirtualCenter") { + + my $vmwAppString = ""; + if(@vmw_apps) { + print REPORT_OUTPUT "
\n"; + print REPORT_OUTPUT "

VMware and 3rd Party Applications in a VM

\n"; + print REPORT_OUTPUT "\n"; + print REPORT_OUTPUT "\n"; + foreach(@vmw_apps) { + $vmwAppString .= $_; + } + print REPORT_OUTPUT $vmwAppString; + print REPORT_OUTPUT "
CLUSTERVM NAMEVMWARE/3RD PARTY APPLICATION
\n"; + print REPORT_OUTPUT "
\n"; + } + } } sub printVMSummary { @@ -779,12 +779,12 @@ sub printVMSummary { } #skip if host is not accessible - next if($local_host->runtime->connectionState->val ne "connected"); + next if($local_host->runtime->connectionState->val ne "connected"); #skip if VM is not in valid list - if($hostlist) { - next if(!$hostlists{$local_host->name}); - } + if($hostlist) { + next if(!$hostlists{$local_host->name}); + } my $vms = Vim::get_views(mo_ref_array => $local_host->vm); foreach my $vm (sort {$a->name cmp $b->name} @$vms) { @@ -798,15 +798,15 @@ sub printVMSummary { } ###################### - # VM TAG - ###################### - if(defined($vm->tag)) { - my $vmTags = $vm->tag; - foreach(sort {$a->key cmp $b->key} @$vmTags) { - my $tagString = "".$cluster_name."".$vm->name."".$_->key."\n"; - push @vmw_apps, $tagString; - } - } + # VM TAG + ###################### + if(defined($vm->tag)) { + my $vmTags = $vm->tag; + foreach(sort {$a->key cmp $b->key} @$vmTags) { + my $tagString = "".$cluster_name."".$vm->name."".$_->key."\n"; + push @vmw_apps, $tagString; + } + } ###################### # VM STATE ###################### @@ -814,49 +814,49 @@ sub printVMSummary { $vmstateString .= ""; ## ESX/ESXi host ## - $vmstateString .= "".$host_name.""; + $vmstateString .= "".$host_name.""; - ## DISPLAY NAME ## - $vmstateString .= "".$vm->name.""; + ## DISPLAY NAME ## + $vmstateString .= "".$vm->name.""; ## BOOT TIME ## - $vmstateString .= "".($vm->runtime->bootTime ? $vm->runtime->bootTime : "N/A").""; + $vmstateString .= "".($vm->runtime->bootTime ? $vm->runtime->bootTime : "N/A").""; - if($aversion eq '4.1.0' || ($aversion eq '5.0.0' || $aversion eq '5.1.0')) { - ## UPTIME ## - $vmstateString .= "".($vm->summary->quickStats->uptimeSeconds ? &getUptime($vm->summary->quickStats->uptimeSeconds) : "N/A").""; - } + if($aversion eq '4.1.0' || ($aversion eq '5.0.0' || $aversion eq '5.1.0')) { + ## UPTIME ## + $vmstateString .= "".($vm->summary->quickStats->uptimeSeconds ? &getUptime($vm->summary->quickStats->uptimeSeconds) : "N/A").""; + } ## ANNOTATION ## $vmstateString .= "" . ($vm->config->annotation ? $vm->config->annotation : "N/A") . ""; ## OVERALL STATUS ## - my $vm_health = $vm->summary->overallStatus->val; - if ($vm_health eq 'green') { $vmstateString .= "VM is OK"; } - elsif ($vm_health eq 'red') { $vmstateString .= "VM has a problem"; } - elsif ($vm_health eq 'yellow') { $vmstateString .= "VM"; } - else { $vmstateString .="UNKNOWN"; } + my $vm_health = $vm->summary->overallStatus->val; + if ($vm_health eq 'green') { $vmstateString .= "VM is OK"; } + elsif ($vm_health eq 'red') { $vmstateString .= "VM has a problem"; } + elsif ($vm_health eq 'yellow') { $vmstateString .= "VM"; } + else { $vmstateString .="UNKNOWN"; } - if(($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0'|| $aversion eq '6.5.0')) { + if($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0') { ## HA PROTECTION ## if($vm->runtime->dasVmProtection) { $vmstateString .= "".($vm->runtime->dasVmProtection->dasProtected ? "YES" : "NO").""; } else { $vmstateString .= "N/A"; } } else { $vmstateString .= "N/A"; } - if($aversion eq '4.1.0' || ($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0'|| $aversion eq '6.5.0')) { - ## APP HEARTBEAT ## - $vmstateString .= "".($vm->guest->appHeartbeatStatus ? $vm->guest->appHeartbeatStatus : "N/A").""; - } + if($aversion eq '4.1.0' || $aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0') { + ## APP HEARTBEAT ## + $vmstateString .= "".($vm->guest->appHeartbeatStatus ? $vm->guest->appHeartbeatStatus : "N/A").""; + } - ## CONNECTION STATE ## - $vmstateString .= "".$vm->runtime->connectionState->val.""; + ## CONNECTION STATE ## + $vmstateString .= "".$vm->runtime->connectionState->val.""; - ## POWER STATE ## - $vmstateString .= "".$vm->runtime->powerState->val.""; + ## POWER STATE ## + $vmstateString .= "".$vm->runtime->powerState->val.""; ## CONSOLIDATION ## - if(($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0'|| $aversion eq '6.5.0')) { + if($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0') { $vmstateString .= "".($vm->runtime->consolidationNeeded ? "YES" : "NO").""; } else { $vmstateString .= "N/A"; } @@ -875,7 +875,7 @@ sub printVMSummary { $vmconfigString .= "".$vm->name.""; ## VIRTUAL HARDWARE VER ## - $vmconfigString .= "".$vm->config->version.""; + $vmconfigString .= "".$vm->config->version.""; ## GUEST HOSTNAME ## $vmconfigString .= "".($vm->guest->hostName ? $vm->guest->hostName : "N/A").""; @@ -884,7 +884,7 @@ sub printVMSummary { $vmconfigString .= "".($vm->summary->config->uuid ? $vm->summary->config->uuid : "N/A").""; ## FIRMWARE ## - if(($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0'|| $aversion eq '6.5.0')) { + if($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0') { $vmconfigString .= "".($vm->config->firmware ? $vm->config->firmware : "N/A").""; } else { $vmconfigString .= "N/A"; } @@ -897,7 +897,7 @@ sub printVMSummary { $vmconfigString .= "".($vm->summary->config->memorySizeMB ? &prettyPrintData($vm->summary->config->memorySizeMB,'M') : "N/A").""; ## vDISK ## - $vmconfigString .= "".($vm->summary->config->numVirtualDisks ? $vm->summary->config->numVirtualDisks : "N/A").""; + $vmconfigString .= "".($vm->summary->config->numVirtualDisks ? $vm->summary->config->numVirtualDisks : "N/A").""; ## DISK CAPACITY ## if($vm->summary->storage) { @@ -936,10 +936,10 @@ sub printVMSummary { $vmstatString .= ""; ## ESX/ESXi host ## - $vmstatString .= "".$host_name.""; + $vmstatString .= "".$host_name.""; - ## DISPLAY NAME ## - $vmstatString .= "".$vm->name.""; + ## DISPLAY NAME ## + $vmstatString .= "".$vm->name.""; ## CPU USAGE ## $vmstatString .= "".($vm->summary->quickStats->overallCpuUsage ? &prettyPrintData($vm->summary->quickStats->overallCpuUsage,'MHZ') : "N/A" ).""; @@ -960,7 +960,7 @@ sub printVMSummary { $vmstatString .= "".($vm->summary->quickStats->hostMemoryUsage ? &prettyPrintData($vm->summary->quickStats->hostMemoryUsage,'M') : "N/A").""; ## INITIAL MEM RESV OVERHEAD + INITIAL MEM SWAP RESV OVERHEAD ## - if(($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0'|| $aversion eq '6.5.0') && $vm->config->initialOverhead) { + if(($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0') && $vm->config->initialOverhead) { $vmstatString .= "".($vm->config->initialOverhead->initialMemoryReservation ? &prettyPrintData($vm->config->initialOverhead->initialMemoryReservation,'B') : "N/A").""; $vmstatString .= "".($vm->config->initialOverhead->initialSwapReservation ? &prettyPrintData($vm->config->initialOverhead->initialSwapReservation,'B') : "N/A").""; } else { $vmstatString .= "N/AN/A"; } @@ -971,7 +971,7 @@ sub printVMSummary { ## MEM BALLON ## $vmstatString .= "".($vm->summary->quickStats->balloonedMemory ? &prettyPrintData($vm->summary->quickStats->balloonedMemory,'M') : "N/A").""; - if($aversion eq '4.1.0' || ($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0'|| $aversion eq '6.5.0')) { + if($aversion eq '4.1.0' || $aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0') { ## COMPRESSED MEM ## if(defined($vm->summary->quickStats->compressedMemory)) { if($debug) { print "---DEBUG compressedMemory for " . $vm->name . ": \"" . $vm->summary->quickStats->compressedMemory . "\" ---DEBUG\n"; } @@ -1030,49 +1030,49 @@ sub printVMSummary { #mem ## RESERVATION ## - $vmrscString .= "".($memAllocation->reservation ? &prettyPrintData($memAllocation->reservation,'M') : "N/A").""; + $vmrscString .= "".($memAllocation->reservation ? &prettyPrintData($memAllocation->reservation,'M') : "N/A").""; - ## LIMIT ## - $vmrscString .= "".($memAllocation->limit ? &prettyPrintData($memAllocation->limit,'M') : "N/A").""; + ## LIMIT ## + $vmrscString .= "".($memAllocation->limit ? &prettyPrintData($memAllocation->limit,'M') : "N/A").""; - ## SHARES ## + ## SHARES ## - # SHARES VALUE - $vmrscString .= "".($memAllocation->shares->shares ? $memAllocation->shares->shares : "N/A").""; + # SHARES VALUE + $vmrscString .= "".($memAllocation->shares->shares ? $memAllocation->shares->shares : "N/A").""; - # SHARES LEVEL - $vmrscString .= "".($memAllocation->shares->level->val ? $memAllocation->shares->level->val : "N/A").""; + # SHARES LEVEL + $vmrscString .= "".($memAllocation->shares->level->val ? $memAllocation->shares->level->val : "N/A").""; - ## EXPAND RESERVATION ## - $vmrscString .= "".($memAllocation->expandableReservation ? "YES" : "NO").""; + ## EXPAND RESERVATION ## + $vmrscString .= "".($memAllocation->expandableReservation ? "YES" : "NO").""; - ## OVERHEAD LIMIT ## - $vmrscString .= "".($memAllocation->overheadLimit ? &prettyPrintData($memAllocation->overheadLimit,'M') : "N/A").""; + ## OVERHEAD LIMIT ## + $vmrscString .= "".($memAllocation->overheadLimit ? &prettyPrintData($memAllocation->overheadLimit,'M') : "N/A").""; $vmrscString .= "\n"; } } ###################### - # VM PERFORMANCE - ###################### + # VM PERFORMANCE + ###################### if($VM_PERFORMANCE eq "yes" || $vmperformance eq "yes") { if($vm->runtime->powerState->val eq 'poweredOn') { - my $vmperf = &getCpuAndMemPerf($vm); - $vmPerfString .= $vmperf; + my $vmperf = &getCpuAndMemPerf($vm); + $vmPerfString .= $vmperf; } } ###################### # FT ###################### if($VM_FT eq "yes") { - if(!$vm->config->template && defined($vm->summary->config->ftInfo)) { + if(!$vm->config->template && defined($vm->summary->config->ftInfo)) { $vmftString .= ""; ## ESX/ESXi host ## - $vmftString .= "".$host_name.""; + $vmftString .= "".$host_name.""; - ## DISPLAY NAME ## - $vmftString .= "".$vm->name.""; + ## DISPLAY NAME ## + $vmftString .= "".$vm->name.""; ## FT STATE ## $vmftString .= "".$vm->runtime->faultToleranceState->val.""; @@ -1093,62 +1093,62 @@ sub printVMSummary { $vmftString .= "".$instanceuuids.""; ## FT SECONDARY LATENCY ## - $vmftString .= "".($vm->summary->quickStats->ftSecondaryLatency ? $vm->summary->quickStats->ftSecondaryLatency : "N/A").""; + $vmftString .= "".($vm->summary->quickStats->ftSecondaryLatency ? $vm->summary->quickStats->ftSecondaryLatency : "N/A").""; ## FT BW ## - $vmftString .= "".($vm->summary->quickStats->ftLogBandwidth ? $vm->summary->quickStats->ftLogBandwidth : "N/A").""; + $vmftString .= "".($vm->summary->quickStats->ftLogBandwidth ? $vm->summary->quickStats->ftLogBandwidth : "N/A").""; $vmftString .= "\n"; } } ###################### - # EZT - ###################### - if($VM_EZT eq "yes" && ($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0'|| $aversion eq '6.5.0')) { - if(!$vm->config->template) { - my $devices = $vm->config->hardware->device; - my ($ezt_disk_string,$ezt_size_string,$ezt_label_string) = ("","",""); - my $hasEZT = 0; - foreach(@$devices) { - if($_->isa('VirtualDisk') && $_->backing->isa('VirtualDiskFlatVer2BackingInfo')) { - my $diskName = $_->backing->fileName; - my $label = ($_->deviceInfo->label ? $_->deviceInfo->label : "N/A"); - if(!$_->backing->thinProvisioned && defined($_->backing->eagerlyScrub)) { + # EZT + ###################### + if($VM_EZT eq "yes" && ($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0')) { + if(!$vm->config->template) { + my $devices = $vm->config->hardware->device; + my ($ezt_disk_string,$ezt_size_string,$ezt_label_string) = ("","",""); + my $hasEZT = 0; + foreach(@$devices) { + if($_->isa('VirtualDisk') && $_->backing->isa('VirtualDiskFlatVer2BackingInfo')) { + my $diskName = $_->backing->fileName; + my $label = ($_->deviceInfo->label ? $_->deviceInfo->label : "N/A"); + if(!$_->backing->thinProvisioned && defined($_->backing->eagerlyScrub)) { if($_->backing->eagerlyScrub) { - $hasEZT = 1; - $ezt_label_string .= $label."
"; - $ezt_disk_string .= $diskName."
"; - $ezt_size_string .= &prettyPrintData($_->capacityInKB,'K')."
"; + $hasEZT = 1; + $ezt_label_string .= $label."
"; + $ezt_disk_string .= $diskName."
"; + $ezt_size_string .= &prettyPrintData($_->capacityInKB,'K')."
"; } - } - } - } - if($hasEZT eq 1) { - $vmeztString .= ""; + } + } + } + if($hasEZT eq 1) { + $vmeztString .= ""; - ## ESX/ESXi host ## - $vmeztString .= "".$host_name.""; + ## ESX/ESXi host ## + $vmeztString .= "".$host_name.""; - ## DISPLAY NAME ## - $vmeztString .= "".$vm->name.""; + ## DISPLAY NAME ## + $vmeztString .= "".$vm->name.""; - ## EZT LABEL ## - $vmeztString .= "".$ezt_label_string.""; + ## EZT LABEL ## + $vmeztString .= "".$ezt_label_string.""; - ## EZT DISKS ## - $vmeztString .= "".$ezt_disk_string.""; + ## EZT DISKS ## + $vmeztString .= "".$ezt_disk_string.""; - ## EZT DISKS SIZE ## - $vmeztString .= "".$ezt_size_string.""; + ## EZT DISKS SIZE ## + $vmeztString .= "".$ezt_size_string.""; - $vmeztString .= "\n"; - } - } - } + $vmeztString .= "\n"; + } + } + } ###################### # THIN ###################### if($VM_THIN eq "yes") { - if(!$vm->config->template) { + if(!$vm->config->template) { my $devices = $vm->config->hardware->device; my ($thin_disk_string,$thin_size_string,$thin_label_string) = ("","",""); my $hasThin = 0; @@ -1168,7 +1168,7 @@ sub printVMSummary { $vmthinString .= ""; ## ESX/ESXi host ## - $vmthinString .= "".$host_name.""; + $vmthinString .= "".$host_name.""; ## DISPLAY NAME ## $vmthinString .= "".$vm->name.""; @@ -1184,8 +1184,8 @@ sub printVMSummary { $vmthinString .= "\n"; } - } - } + } + } ###################### # DEVICE ###################### @@ -1193,11 +1193,11 @@ sub printVMSummary { if(!$vm->config->template) { $vmdeviceString .= ""; - ## ESX/ESXi host ## - $vmdeviceString .= "".$host_name.""; + ## ESX/ESXi host ## + $vmdeviceString .= "".$host_name.""; - ## DISPLAY NAME ## - $vmdeviceString .= "".$vm->name.""; + ## DISPLAY NAME ## + $vmdeviceString .= "".$vm->name.""; my %deviceMapper = (); @@ -1265,21 +1265,21 @@ sub printVMSummary { $pointingdevice++; }elsif($device->isa('VirtualSCSIPassthrough')) { $scsipassthrough++; - }elsif($device->isa('VirtualSerialPort')) { + }elsif($device->isa('VirtualSerialPort')) { $serialport++; - }elsif($device->isa('VirtualSoundCard')) { + }elsif($device->isa('VirtualSoundCard')) { if($device->isa('VirtualEnsoniq1371')) { $ensoniqsoundcard++; }elsif($device->isa('VirtualSoundBlaster16')) { $blastersoundcard++; } - }elsif($device->isa('VirtualUSB')) { + }elsif($device->isa('VirtualUSB')) { $usb++; } } ## OS ## - $vmdeviceString .= "".($vm->config->guestFullName ? $vm->config->guestFullName : "N/A").""; + $vmdeviceString .= "".($vm->config->guestFullName ? $vm->config->guestFullName : "N/A").""; ## CDROM ## $vmdeviceString .= "".$cdrom.""; @@ -1290,29 +1290,29 @@ sub printVMSummary { $controllerString .= $idecontroller . " x IDE Controller
"; } if($pcicontroller != 0) { - $controllerString .= $pcicontroller . " x PCI Controller
"; + $controllerString .= $pcicontroller . " x PCI Controller
"; } if($ps2controller != 0) { - $controllerString .= $ps2controller . " x PS2 Controller
"; - } + $controllerString .= $ps2controller . " x PS2 Controller
"; + } if($paracontroller != 0) { - $controllerString .= $paracontroller . " x PARA-VIRT Controller
"; - } + $controllerString .= $paracontroller . " x PARA-VIRT Controller
"; + } if($buscontroller != 0) { - $controllerString .= $buscontroller . " x BUS Controller
"; - } + $controllerString .= $buscontroller . " x BUS Controller
"; + } if($lsicontroller != 0) { - $controllerString .= $lsicontroller . " x LSI LOGIC Controller
"; - } + $controllerString .= $lsicontroller . " x LSI LOGIC Controller
"; + } if($lsilogiccontroller != 0) { - $controllerString .= $lsilogiccontroller . " x LSI LOGIC SAS Controller
"; - } + $controllerString .= $lsilogiccontroller . " x LSI LOGIC SAS Controller
"; + } if($siocontroller != 0) { - $controllerString .= $siocontroller . " x SIO Controller
"; - } + $controllerString .= $siocontroller . " x SIO Controller
"; + } if($usbcontroller != 0) { - $controllerString .= $usbcontroller . " x USB Controller
"; - } + $controllerString .= $usbcontroller . " x USB Controller
"; + } if($controllerString eq "") { $controllerString = "N/A"; } $vmdeviceString .= "".$controllerString.""; @@ -1326,13 +1326,13 @@ sub printVMSummary { } if($pcnet32ethernet != 0) { $ethString .= $pcnet32ethernet . " x PCNET32
"; - } + } if($vmxnet2ethernet != 0) { $ethString .= $vmxnet2ethernet . " x VMXNET2
"; - } + } if($vmxnet3ethernet != 0) { $ethString .= $vmxnet3ethernet . " x VMXNET3
"; - } + } if($ethString eq "") { $ethString = "N/A"; } $vmdeviceString .= "".$ethString.""; @@ -1373,7 +1373,7 @@ sub printVMSummary { } if($blastersoundcard != 0) { $soundString .= $blastersoundcard . " x Soundblaster Sound Card
"; - } + } if($soundString eq "") { $soundString = "N/A"; } $vmdeviceString .= "".$soundString.""; @@ -1387,14 +1387,14 @@ sub printVMSummary { # VM STORAGE ###################### if($VM_STORAGE eq "yes") { - if(!$vm->config->template && $vm->guest->disk) { - $vmstorageString .= ""; + if(!$vm->config->template && $vm->guest->disk) { + $vmstorageString .= ""; - ## ESX/ESXi host ## - $vmstorageString .= "".$host_name.""; + ## ESX/ESXi host ## + $vmstorageString .= "".$host_name.""; - ## DISPLAY NAME ## - $vmstorageString .= "".$vm->name.""; + ## DISPLAY NAME ## + $vmstorageString .= "".$vm->name.""; my $vdisks = $vm->guest->disk; my $disk_string = ""; @@ -1407,36 +1407,36 @@ sub printVMSummary { $disk_string .= "$perc_string
$vm_disk_path$vm_disk_free$vm_disk_cap
"; } $vmstorageString .= $disk_string; - $vmstorageString .= "\n"; - } - } + $vmstorageString .= "\n"; + } + } + ###################### + # VM NETWORK ###################### - # VM NETWORK - ###################### if($VM_NETWORK eq "yes" && $vm->guest->net) { - if(!$vm->config->template) { - $vmnetworkString .= ""; + if(!$vm->config->template) { + $vmnetworkString .= ""; - ## ESX/ESXi host ## - $vmnetworkString .= "".$host_name.""; + ## ESX/ESXi host ## + $vmnetworkString .= "".$host_name.""; - ## DISPLAY NAME ## - $vmnetworkString .= "".$vm->name.""; + ## DISPLAY NAME ## + $vmnetworkString .= "".$vm->name.""; my ($vm_ip_string,$vm_mac_string,$vm_pg_string,$vm_connect_string) = ("","","",""); my $vnics = $vm->guest->net; foreach(@$vnics) { ## IP ADDRESS ## - if($aversion eq '4.1.0' || ($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0'|| $aversion eq '6.5.0')) { + if($aversion eq '4.1.0' || $aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0') { if($_->ipConfig) { my $ips = $_->ipConfig->ipAddress; foreach(@$ips) { if($demo eq "no") { - $vm_ip_string .= $_->ipAddress."
"; - } else { - $vm_ip_string .= "demo_mode
"; - } + $vm_ip_string .= $_->ipAddress."
"; + } else { + $vm_ip_string .= "demo_mode
"; + } } } else { $vm_ip_string .= "N/A
"; } } else { @@ -1459,8 +1459,8 @@ sub printVMSummary { if($demo eq "no") { $vm_mac_string .= $_->macAddress."
"; } else { - $vm_mac_string .= "demo_mode
"; - } + $vm_mac_string .= "demo_mode
"; + } } else { $vm_mac_string .= "N/A
"; } @@ -1470,8 +1470,8 @@ sub printVMSummary { if($demo eq "no") { $vm_pg_string .= $_->network."
"; } else { - $vm_pg_string .= "demo_mode
"; - } + $vm_pg_string .= "demo_mode
"; + } } else { $vm_pg_string .= "N/A
"; } @@ -1480,14 +1480,14 @@ sub printVMSummary { $vm_connect_string .= ($_->connected ? "YES
" : "NO
"); } $vmnetworkString .= "".$vm_ip_string."".$vm_mac_string."".$vm_pg_string."".$vm_connect_string.""; - $vmnetworkString .= "\n"; - } - } + $vmnetworkString .= "\n"; + } + } ###################### # SNAPSHOT ###################### if($VM_SNAPSHOT eq "yes") { - if(!$vm->config->template) { + if(!$vm->config->template) { if($vm->snapshot) { &getSnapshotTree($host_name,$vm->name,$vm->snapshot->currentSnapshot,$vm->snapshot->rootSnapshotList); foreach(@vmsnapshots) { @@ -1495,98 +1495,98 @@ sub printVMSummary { } @vmsnapshots = (); } - } - } + } + } ###################### # CDROM ###################### if($VM_CDROM eq "yes") { - if(!$vm->config->template) { + if(!$vm->config->template) { my $devices = $vm->config->hardware->device; - my ($cd_string) = (""); - my $hasCD = 0; - foreach(@$devices) { - if($_->isa('VirtualCdrom') && $_->connectable->connected) { + my ($cd_string) = (""); + my $hasCD = 0; + foreach(@$devices) { + if($_->isa('VirtualCdrom') && $_->connectable->connected) { $hasCD = 1; if($_->deviceInfo->summary) { $cd_string .= $_->deviceInfo->summary."
"; } else { $cd_string .= "N/A"; } - } - } - if($hasCD eq 1) { - $vmcdString .= ""; + } + } + if($hasCD eq 1) { + $vmcdString .= ""; - ## ESX/ESXi host ## - $vmcdString .= "".$host_name.""; + ## ESX/ESXi host ## + $vmcdString .= "".$host_name.""; - ## DISPLAY NAME ## - $vmcdString .= "".$vm->name.""; + ## DISPLAY NAME ## + $vmcdString .= "".$vm->name.""; ## ISO ## $vmcdString .= "".$cd_string.""; - $vmcdString .= "\n"; - } + $vmcdString .= "\n"; + } - } - } + } + } ###################### # FLOPPY ###################### if($VM_FLOPPY eq "yes") { - if(!$vm->config->template) { + if(!$vm->config->template) { my $devices = $vm->config->hardware->device; - my ($flp_string) = (""); - my $hasFLP = 0; - foreach(@$devices) { - if($_->isa('VirtualFloppy') && $_->connectable->connected) { - $hasFLP = 1; - if($_->deviceInfo->summary) { - $flp_string .= $_->deviceInfo->summary."
"; - } else { - $flp_string .= "N/A"; - } - } - } - if($hasFLP eq 1) { - $vmflpString .= ""; - - ## ESX/ESXi host ## - $vmflpString .= "".$host_name.""; - - ## DISPLAY NAME ## - $vmflpString .= "".$vm->name.""; - - ## FLP ## - $vmflpString .= "".$flp_string.""; - - $vmflpString .= "\n"; - } - } - } + my ($flp_string) = (""); + my $hasFLP = 0; + foreach(@$devices) { + if($_->isa('VirtualFloppy') && $_->connectable->connected) { + $hasFLP = 1; + if($_->deviceInfo->summary) { + $flp_string .= $_->deviceInfo->summary."
"; + } else { + $flp_string .= "N/A"; + } + } + } + if($hasFLP eq 1) { + $vmflpString .= ""; + + ## ESX/ESXi host ## + $vmflpString .= "".$host_name.""; + + ## DISPLAY NAME ## + $vmflpString .= "".$vm->name.""; + + ## FLP ## + $vmflpString .= "".$flp_string.""; + + $vmflpString .= "\n"; + } + } + } + ###################### + # TOOLS ###################### - # TOOLS - ###################### if($VM_TOOL eq "yes") { - if(!$vm->config->template) { + if(!$vm->config->template) { $vmtoolString .= ""; ## ESX/ESXi host ## - $vmtoolString .= "".$host_name.""; + $vmtoolString .= "".$host_name.""; - ## DISPLAY NAME ## - $vmtoolString .= "".$vm->name.""; + ## DISPLAY NAME ## + $vmtoolString .= "".$vm->name.""; if($vm->guest) { ## TOOLS VERSION ## - $vmtoolString .= "".($vm->guest->toolsVersion ? $vm->guest->toolsVersion : "N/A").""; + $vmtoolString .= "".($vm->guest->toolsVersion ? $vm->guest->toolsVersion : "N/A").""; ## TOOLS RUNNING STATUS ## $vmtoolString .= "".($vm->guest->toolsRunningStatus ? $vm->guest->toolsRunningStatus : "N/A").""; ## TOOLS VERSION STATUS ## - if(($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0'|| $aversion eq '6.5.0')) { + if($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0') { $vmtoolString .= "".($vm->guest->toolsVersionStatus2 ? $vm->guest->toolsVersionStatus2 : "N/A").""; } else { $vmtoolString .= "".($vm->guest->toolsVersionStatus ? $vm->guest->toolsVersionStatus : "N/A").""; @@ -1602,61 +1602,61 @@ sub printVMSummary { ## SYNC TIME ## $vmtoolString .= "".($vm->config->tools->syncTimeWithHost ? "YES" : "NO").""; - } else { + } else { $vmtoolString .= "N/A"; $vmtoolString .= "N/A"; } $vmtoolString .= "\n"; - } - } + } + } ###################### # RDM ###################### if($VM_RDM eq "yes") { - if(!$vm->config->template) { + if(!$vm->config->template) { my $devices = $vm->config->hardware->device; - my $hasRDM = 0; - foreach(@$devices) { + my $hasRDM = 0; + foreach(@$devices) { my ($rdm_string) = (""); - if($_->isa('VirtualDisk') && ($_->backing->isa('VirtualDiskRawDiskVer2BackingInfo') || $_->backing->isa('VirtualDiskRawDiskMappingVer1BackingInfo'))) { - $hasRDM = 1; + if($_->isa('VirtualDisk') && ($_->backing->isa('VirtualDiskRawDiskVer2BackingInfo') || $_->backing->isa('VirtualDiskRawDiskMappingVer1BackingInfo'))) { + $hasRDM = 1; my $compat_mode = ($_->backing->compatibilityMode ? $_->backing->compatibilityMode : "N/A"); my $vmhba = ($_->backing->deviceName ? $_->backing->deviceName : "N/A"); - my $disk_mode = ($_->backing->diskMode ? $_->backing->diskMode : "N/A"); - my $lun_uuid = ($_->backing->lunUuid ? $_->backing->lunUuid : "N/A"); - my $vm_uuid = ($_->backing->uuid ? $_->backing->uuid : "N/A"); - $rdm_string .= "".$compat_mode."".$vmhba."".$disk_mode."".$lun_uuid."".$vm_uuid.""; + my $disk_mode = ($_->backing->diskMode ? $_->backing->diskMode : "N/A"); + my $lun_uuid = ($_->backing->lunUuid ? $_->backing->lunUuid : "N/A"); + my $vm_uuid = ($_->backing->uuid ? $_->backing->uuid : "N/A"); + $rdm_string .= "".$compat_mode."".$vmhba."".$disk_mode."".$lun_uuid."".$vm_uuid.""; - #} - #if($hasRDM eq 1) { - $vmrdmString .= ""; + #} + #if($hasRDM eq 1) { + $vmrdmString .= ""; - ## ESX/ESXi host ## - $vmrdmString .= "".$host_name.""; + ## ESX/ESXi host ## + $vmrdmString .= "".$host_name.""; - ## DISPLAY NAME ## - $vmrdmString .= "".$vm->name.""; + ## DISPLAY NAME ## + $vmrdmString .= "".$vm->name.""; - ## RDM ## - $vmrdmString .= $rdm_string; + ## RDM ## + $vmrdmString .= $rdm_string; - $vmrdmString .= "\n"; - }} - } - } + $vmrdmString .= "\n"; + }} + } + } ###################### # NPIV ###################### if($VM_NPIV eq "yes") { - if(!$vm->config->template) { + if(!$vm->config->template) { if($vm->config->npivNodeWorldWideName && $vm->config->npivPortWorldWideName) { - $vmnpivString .= ""; + $vmnpivString .= ""; - ## ESX/ESXi host ## - $vmnpivString .= "".$host_name.""; + ## ESX/ESXi host ## + $vmnpivString .= "".$host_name.""; - ## DISPLAY NAME ## - $vmnpivString .= "".$vm->name.""; + ## DISPLAY NAME ## + $vmnpivString .= "".$vm->name.""; my $nwwns = $vm->config->npivNodeWorldWideName; my $pwwns = $vm->config->npivPortWorldWideName; @@ -1677,14 +1677,14 @@ sub printVMSummary { $npiv_string .= ""; foreach(@$pwwns) { my $pwwn = (Math::BigInt->new($_))->as_hex(); - $pwwn =~ s/^..//; - $pwwn = join(':', unpack('A2' x 8, $pwwn)); + $pwwn =~ s/^..//; + $pwwn = join(':', unpack('A2' x 8, $pwwn)); if($demo eq "no") { - $npiv_string .= "$pwwn
"; - } else { + $npiv_string .= "$pwwn
"; + } else { $npiv_string .= "XX:XX:XX:XX:XX:XX:XX:XX
"; } - } + } my $npivtype = ""; if($type eq "vc") { $npivtype = "Virtual Center"; } elsif($type eq "external") { $npivtype = "External Source"; } @@ -1692,40 +1692,40 @@ sub printVMSummary { $npiv_string .= "".$npivtype."".$desirednwwn."".$desiredpwwn.""; $vmnpivString .= $npiv_string; - $vmnpivString .= "\n"; + $vmnpivString .= "\n"; } - } - } + } + } if($VM_STATS eq "yesaaaaa") { - if(!$vm->config->template) { + if(!$vm->config->template) { $vmstatString .= ""; ## ESX/ESXi host ## - $vmstatString .= "".$host_name.""; + $vmstatString .= "".$host_name.""; - ## DISPLAY NAME ## - $vmstatString .= "".$vm->name.""; + ## DISPLAY NAME ## + $vmstatString .= "".$vm->name.""; $vmstatString .= "\n"; - } - } + } + } ## STOP ### } } ###################### - # DLETA - ###################### - if($VM_DELTA eq "yes") { + # DLETA + ###################### + if($VM_DELTA eq "yes") { foreach(@vmdeltas) { $vmdeltaString .= "".$_."\n"; } @vmdeltas = (); - } + } &buildVMReport($cluster_name,$cluster_count,$type,$atype,$aversion); } } @@ -1743,9 +1743,9 @@ sub printHostSummary { next if($local_host->runtime->connectionState->val ne "connected"); #skip if VM is not in valid list - if($hostlist) { - next if(!$hostlists{$local_host->name}); - } + if($hostlist) { + next if(!$hostlists{$local_host->name}); + } #capture unique hosts for later use push @hosts_seen,$host_name; @@ -1764,17 +1764,17 @@ sub printHostSummary { my $additional_vendor_info = ""; if($local_host->summary->hardware->otherIdentifyingInfo) { my $add_info = $local_host->summary->hardware->otherIdentifyingInfo; - foreach (@$add_info) { - $additional_vendor_info .= $_->identifierType->key.": ".$_->identifierValue." "; - } - if($additional_vendor_info eq '') { - $additional_vendor_info = "UNKNOWN"; - } + foreach (@$add_info) { + $additional_vendor_info .= $_->identifierType->key.": ".$_->identifierValue." "; + } + if($additional_vendor_info eq '') { + $additional_vendor_info = "UNKNOWN"; + } } $hardwareConfigurationString .= "".$additional_vendor_info.""; $hardwareConfigurationString .= "".$local_host->summary->hardware->model.""; $hardwareConfigurationString .= "".$local_host->summary->hardware->cpuModel.""; - if(($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0'|| $aversion eq '6.5.0')) { + if($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0') { $hardwareConfigurationString .= "".(($local_host->hardware->smcPresent) ? "YES" : "NO").""; } else { $hardwareConfigurationString .= "N/A"; } $hardwareConfigurationString .= "".(($local_host->config->hyperThread->available) ? "YES" : "NO").""; @@ -1823,14 +1823,14 @@ sub printHostSummary { $mgmtString .= "".$mgmtIp.""; if($atype eq "VirtualCenter") { - if($local_host->summary->config->product) { - $mgmtString .= "".($local_host->config->adminDisabled ? "YES" : "NO").""; - } - } else { + if($local_host->summary->config->product) { + $mgmtString .= "".($local_host->config->adminDisabled ? "YES" : "NO").""; + } + } else { $mgmtString .= "UNKNOWN"; } - if($aversion eq '4.1.0' || ($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0'|| $aversion eq '6.5.0')) { + if($aversion eq '4.1.0' || $aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0') { if($hostAPIVersion eq '4.1.0' || $hostAPIVersion eq '5.0.0' || $hostAPIVersion eq '5.1.0' || $hostAPIVersion eq '5.5.0') { my $systemFile = ""; if($local_host->config->systemFile) { @@ -1861,29 +1861,29 @@ sub printHostSummary { ###################### if($HOST_STATE eq "yes") { $stateString .= ""; - $stateString .= "".$host_name.""; + $stateString .= "".$host_name.""; my $host_health .= $local_host->overallStatus->val; if ($host_health eq 'green') { $stateString .= "HOST is OK"; } - elsif ($host_health eq 'red') { $stateString .= "HOST has a problem"; } - elsif ($host_health eq 'yellow') { $stateString .= "HOST might have a problem"; } - else { $stateString .= "UNKNOWN"; } + elsif ($host_health eq 'red') { $stateString .= "HOST has a problem"; } + elsif ($host_health eq 'yellow') { $stateString .= "HOST might have a problem"; } + else { $stateString .= "UNKNOWN"; } $stateString .= "".$local_host->runtime->powerState->val.""; if($local_host->runtime->bootTime) { $stateString .= "".$local_host->runtime->bootTime.""; } else { $stateString .= "UNKNOWN"; } - if($aversion eq '4.1.0' || ($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0'|| $aversion eq '6.5.0')) { - if($hostAPIVersion eq '4.1.0' || $hostAPIVersion eq '5.0.0' || $hostAPIVersion eq '5.1.0' || $hostAPIVersion eq '5.5.0') { + if($aversion eq '4.1.0' || $aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0') { + if($hostAPIVersion eq '4.1.0' || $hostAPIVersion eq '5.0.0' || $hostAPIVersion eq '5.1.0' || $hostAPIVersion eq '5.5.0') { if($local_host->summary->quickStats->uptime) { my $uptime = $local_host->summary->quickStats->uptime; $stateString .= "".&getUptime($uptime).""; } - else { $stateString .= "UNKNOWN"; } + else { $stateString .= "UNKNOWN"; } } else { $stateString .= "N/A"; } } - if(($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0'|| $aversion eq '6.5.0') && $atype eq "VirtualCenter") { + if(($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0') && $atype eq "VirtualCenter") { if($local_host->runtime->dasHostState) { $stateString .= "".$local_host->runtime->dasHostState->state.""; } else { @@ -1896,8 +1896,8 @@ sub printHostSummary { $stateString .= "".$local_host->runtime->connectionState->val.""; $stateString .= "".(($local_host->summary->runtime->inMaintenanceMode) ? "YES" : "NO").""; - if($aversion eq '4.1.0' || ($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0'|| $aversion eq '6.5.0')) { - if($hostAPIVersion eq '4.1.0' || $hostAPIVersion eq '5.0.0' || $hostAPIVersion eq '5.1.0' || $hostAPIVersion eq '5.5.0') { + if($aversion eq '4.1.0' || $aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0') { + if($hostAPIVersion eq '4.1.0' || $hostAPIVersion eq '5.0.0' || $hostAPIVersion eq '5.1.0' || $hostAPIVersion eq '5.5.0') { $stateString .= "".(($local_host->runtime->standbyMode) ? $local_host->runtime->standbyMode : "N/A").""; } else { $stateString .= "N/A"; @@ -1925,8 +1925,8 @@ sub printHostSummary { $sensor_health = $_->status->key; if ($sensor_health =~ m/green/i) { $sensor_health_color="OK"; } elsif ($sensor_health_color =~ m/red/i) { $sensor_health_color="PROBLEM"; } - elsif ($sensor_health_color =~ m/yellow/i) { $sensor_health_color="WARNING"; } - else { $sensor_health_color="UNKNOWN"; } + elsif ($sensor_health_color =~ m/yellow/i) { $sensor_health_color="WARNING"; } + else { $sensor_health_color="UNKNOWN"; } $healthHardwareString .= "".$_->name."".$sensor_health_color."\n"; } } @@ -1934,22 +1934,22 @@ sub printHostSummary { $memInfo = $hardwareStatusInfo->memoryStatusInfo; foreach(@$memInfo) { $sensor_health = $_->status->key; - if ($sensor_health =~ m/green/i) { $sensor_health_color="OK"; } - elsif ($sensor_health_color =~ m/red/i) { $sensor_health_color="PROBLEM"; } - elsif ($sensor_health_color =~ m/yellow/i) { $sensor_health_color="WARNING"; } - else { $sensor_health_color="UNKNOWN"; } - $healthHardwareString .= "".$_->name."".$sensor_health_color."\n"; + if ($sensor_health =~ m/green/i) { $sensor_health_color="OK"; } + elsif ($sensor_health_color =~ m/red/i) { $sensor_health_color="PROBLEM"; } + elsif ($sensor_health_color =~ m/yellow/i) { $sensor_health_color="WARNING"; } + else { $sensor_health_color="UNKNOWN"; } + $healthHardwareString .= "".$_->name."".$sensor_health_color."\n"; } } if($hardwareStatusInfo->storageStatusInfo) { $storageInfo = $hardwareStatusInfo->storageStatusInfo; foreach(@$storageInfo) { $sensor_health = $_->status->key; - if ($sensor_health =~ m/green/i) { $sensor_health_color="OK"; } - elsif ($sensor_health_color =~ m/red/i) { $sensor_health_color="PROBLEM"; } - elsif ($sensor_health_color =~ m/yellow/i) { $sensor_health_color="WARNING"; } - else { $sensor_health_color="UNKNOWN"; } - $healthHardwareString .= "".$_->name."".$sensor_health_color."\n"; + if ($sensor_health =~ m/green/i) { $sensor_health_color="OK"; } + elsif ($sensor_health_color =~ m/red/i) { $sensor_health_color="PROBLEM"; } + elsif ($sensor_health_color =~ m/yellow/i) { $sensor_health_color="WARNING"; } + else { $sensor_health_color="UNKNOWN"; } + $healthHardwareString .= "".$_->name."".$sensor_health_color."\n"; } } } @@ -2002,7 +2002,7 @@ sub printHostSummary { $nicString .= "demo_mode\n"; } } - } + } ###################### # HBA ###################### @@ -2015,7 +2015,7 @@ sub printHostSummary { if($hba->isa("HostFibreChannelHba")) { my $hbaType = "FC"; my ($fcfMac,$vnportMac) = ("",""); - if(($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0'|| $aversion eq '6.5.0')) { + if($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0') { if($hba->isa("HostFibreChannelOverEthernetHba")) { $hbaType = "FCoE"; $fcfMac = $hba->linkInfo->fcfMac; @@ -2031,12 +2031,12 @@ sub printHostSummary { if($demo eq "yes") { $nwwn = "XX:XX:XX:XX:XX:XX:XX:XX"; - $pwwn = "XX:XX:XX:XX:XX:XX:XX:XX"; - $fcfMac = "XX:XX:XX:XX:XX:XX"; - $vnportMac = "XX:XX:XX:XX:XX:XX"; + $pwwn = "XX:XX:XX:XX:XX:XX:XX:XX"; + $fcfMac = "XX:XX:XX:XX:XX:XX"; + $vnportMac = "XX:XX:XX:XX:XX:XX"; } $hbaString .= "".$hbaType."".$hba->device."".$hba->pci."".$hba->model."".$hba->driver."".$hba->status."NWWN ".$nwwn."PWWN ".$pwwn.""; - if(($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0'|| $aversion eq '6.5.0') && $hbaType eq "FCoE") { + if(($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0') && $hbaType eq "FCoE") { $hbaString .= " ".$fcfMac."VNPORTMAC ".$vnportMac.""; } $hbaString .= "PORT TYPE ".$hba->portType->val."SPEED ".$hba->speed.""; @@ -2054,7 +2054,7 @@ sub printHostSummary { ###################### # iSCSI ###################### - if($HOST_ISCSI eq "yes" && ($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0'|| $aversion eq '6.5.0')) { + if($HOST_ISCSI eq "yes" && ($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0')) { my $hbas; eval { $hbas = $local_host->config->storageDevice->hostBusAdapter; }; if(!$@) { @@ -2079,17 +2079,17 @@ sub printHostSummary { $iscsiString .= "".$iscsiPort->vnic->spec->ip->ipAddress.""; } else { $iscsiString .= "N/A"; } if($iscsiPort->vnic->spec->ip->subnetMask) { - $iscsiString .= "".$iscsiPort->vnic->spec->ip->subnetMask.""; - } else { $iscsiString .= "N/A"; } + $iscsiString .= "".$iscsiPort->vnic->spec->ip->subnetMask.""; + } else { $iscsiString .= "N/A"; } if($iscsiPort->vnic->spec->mac) { - $iscsiString .= "".$iscsiPort->vnic->spec->mac.""; - } else { $iscsiString .= "N/A"; } + $iscsiString .= "".$iscsiPort->vnic->spec->mac.""; + } else { $iscsiString .= "N/A"; } if($iscsiPort->vnic->spec->mtu) { - $iscsiString .= "".$iscsiPort->vnic->spec->mtu.""; - } else { $iscsiString .= "N/A"; } + $iscsiString .= "".$iscsiPort->vnic->spec->mtu.""; + } else { $iscsiString .= "N/A"; } if(defined($iscsiPort->vnic->spec->tsoEnabled)) { $iscsiString .= "".($iscsiPort->vnic->spec->tsoEnabled ? "YES" : "NO").""; - } else { $iscsiString .= "N/A"; } + } else { $iscsiString .= "N/A"; } if($iscsiPort->pnic) { $iscsiString .= "".$iscsiPort->pnic->linkSpeed->speedMb . " (" . ($iscsiPort->pnic->linkSpeed->duplex ? "FULL-DUPLEX" : "HALF-DUPLEX") . ")".""; } else { $iscsiString .= "N/A"; } @@ -2111,9 +2111,9 @@ sub printHostSummary { if($HOST_CAPABILITY eq "yes") { if($local_host->capability) { $capString .= ""; - $capString .= "".$host_name.""; + $capString .= "".$host_name.""; - if(($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0'|| $aversion eq '6.5.0')) { + if($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0') { ## MAX VMS ## if($local_host->capability->maxHostRunningVms) { $capString .= "".$local_host->capability->maxHostRunningVms.""; @@ -2121,8 +2121,8 @@ sub printHostSummary { ## MAX VCPU ## if($local_host->capability->maxHostSupportedVcpus) { - $capString .= "".$local_host->capability->maxHostSupportedVcpus.""; - } else { $capString .= "N/A"; } + $capString .= "".$local_host->capability->maxHostSupportedVcpus.""; + } else { $capString .= "N/A"; } ## VMFS VERSION ## if($local_host->capability->supportedVmfsMajorVersion) { @@ -2146,8 +2146,8 @@ sub printHostSummary { ## HV ## $capString .= "".($local_host->capability->virtualExecUsageSupported ? "YES" : "NO").""; - if($aversion eq '4.1.0' || ($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0'|| $aversion eq '6.5.0')) { - if($hostAPIVersion eq '4.1.0' || $hostAPIVersion eq '5.0.0' || $hostAPIVersion eq '5.1.0' || $hostAPIVersion eq '5.5.0') { + if($aversion eq '4.1.0' || $aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0') { + if($hostAPIVersion eq '4.1.0' || $hostAPIVersion eq '5.0.0' || $hostAPIVersion eq '5.1.0' || $hostAPIVersion eq '5.5.0') { ## STORAGE IORM ## $capString .= "".($local_host->capability->storageIORMSupported ? "YES" : "NO").""; @@ -2167,8 +2167,8 @@ sub printHostSummary { if($local_host->capability->loginBySSLThumbprintSupported) { $capString .= "".($local_host->capability->loginBySSLThumbprintSupported ? "YES" : "NO").""; } else { - $capString .= "N/A"; - } + $capString .= "N/A"; + } $capString .= "\n"; } @@ -2351,14 +2351,14 @@ sub printHostSummary { my $serviceString = ""; foreach(@$services) { $serviceString .= "".$_->label.""; - if(($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0'|| $aversion eq '6.5.0')) { + if($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0') { if($_->sourcePackage) { $serviceString .= "".$_->sourcePackage->sourcePackageName.""; } else { $serviceString .= "N/A"; } } $serviceString .= "".$_->policy."".(($_->running) ? "YES" : "NO").""; } - if(($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0'|| $aversion eq '6.5.0')) { + if($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0') { $configString .= "SERVICE(s)".$serviceString."
NAMESOURCE PACKAGEPOLICY TYPERUNNING
\n"; } else { $configString .= "SERVICE(s)".$serviceString."
NAMEPOLICY TYPERUNNING
\n"; @@ -2375,11 +2375,11 @@ sub printHostSummary { eval { $ntps = $local_host->config->dateTimeInfo->ntpConfig->server; }; if(!$@) { my $ntpString = ""; - if($ntps) { - foreach (@$ntps) { - $ntpString .= "$_
"; - } - } else { $ntpString = "NONE CONFIGURED"; } + if($ntps) { + foreach (@$ntps) { + $ntpString .= "$_
"; + } + } else { $ntpString = "NONE CONFIGURED"; } $ntpString = "".$ntpString.""; $ntpString .= "".$local_host->config->dateTimeInfo->timeZone->description."".$local_host->config->dateTimeInfo->timeZone->gmtOffset."".$local_host->config->dateTimeInfo->timeZone->name.""; $configString .= "NTP".$ntpString."
NTP SERVERSTIME ZONEGMT OFFSETLOCATION
\n"; @@ -2432,27 +2432,27 @@ sub printHostSummary { my $vswitches = $local_host->config->network->vswitch; my $vswitchString = ""; - foreach my $vSwitch(@$vswitches) { + foreach my $vSwitch(@$vswitches) { my ($pNicName,$mtu,$cdp_vswitch,$pNicKey) = ("","","",""); - my $vswitch_name = $vSwitch->name; + my $vswitch_name = $vSwitch->name; my $pNics = $vSwitch->pnic; foreach (@$pNics) { - $pNicKey = $_; - if ($pNicKey ne "") { - $pNics = $netMgr->networkInfo->pnic; - foreach my $pNic (@$pNics) { - if ($pNic->key eq $pNicKey) { - $pNicName = $pNicName ? ("$pNicName," . $pNic->device) : $pNic->device; - if($cdp_enabled{$pNic->device}) { - $cdp_vswitch = $cdp_enabled{$pNic->device}; - } else { - $cdp_vswitch = "N/A"; - } - } - } - } - } + $pNicKey = $_; + if ($pNicKey ne "") { + $pNics = $netMgr->networkInfo->pnic; + foreach my $pNic (@$pNics) { + if ($pNic->key eq $pNicKey) { + $pNicName = $pNicName ? ("$pNicName," . $pNic->device) : $pNic->device; + if($cdp_enabled{$pNic->device}) { + $cdp_vswitch = $cdp_enabled{$pNic->device}; + } else { + $cdp_vswitch = "N/A"; + } + } + } + } + } $mtu = $vSwitch->{mtu} if defined($vSwitch->{mtu}); $vswitchString .= "VSWITCH NAMENUM OF PORTSUSED PORTSMTUUPLINKSCDP ENABLED".$vSwitch->name."".$vSwitch->numPorts."".($vSwitch->numPorts - $vSwitch->numPortsAvailable)."".$mtu."".$pNicName."".$cdp_vswitch."\n"; $vswitchString .= "PORTGROUP NAMEVLAN IDUSED PORTSUPLINKS\n"; @@ -2466,9 +2466,9 @@ sub printHostSummary { } else { $vswitchString .= "demo_modedemo_mode".$usedPorts."".$pNicName."\n"; } - $vswitch_portgroup_mappping{$pg->spec->name} = $vswitch_name; - } - } + $vswitch_portgroup_mappping{$pg->spec->name} = $vswitch_name; + } + } $configString .= "VSWITCH(s)".$vswitchString."
\n"; my $networks = Vim::get_views(mo_ref_array => $local_host->network); @@ -2505,7 +2505,7 @@ sub printHostSummary { $snmpString .= ""; my $trap_targets = $snmp_system->configuration->trapTargets; foreach(@$trap_targets) { - $snmpString .= "Community: " . $_->community . " Hostname: " . $_->hostName . " Port: " . $_->port . "
\n"; + $snmpString .= "Community: " . $_->community . " Hostname: " . $_->hostName . " Port: " . $_->port . "
\n"; } $snmpString .= ""; $configString .= "SNMP".$snmpString."
SNMP PORTRO COMMUNITIESTRAP TARGETS
\n"; @@ -2521,12 +2521,12 @@ sub printHostSummary { if($local_host->config->firewall) { my $fw_sys = $local_host->config->firewall; my $fw_rules = $fw_sys->ruleset; - my $fw_known_string = ""; - my $fw_rule_string = ""; - foreach my $rule ( sort{$a->label cmp $b->label}@$fw_rules) { - if($rule->enabled) { + my $fw_known_string = ""; + my $fw_rule_string = ""; + foreach my $rule ( sort{$a->label cmp $b->label}@$fw_rules) { + if($rule->enabled) { my ($allowedIPs) = (""); - if(($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0'|| $aversion eq '6.5.0')) { + if($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0') { if(defined($rule->allowedHosts)) { if($rule->allowedHosts->allIp) { $allowedIPs = "all"; @@ -2546,14 +2546,14 @@ sub printHostSummary { if($_->endPort) { $fwPort .= "-" . $_->endPort; } - if(($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq ' 6.0.0'|| $aversion eq '6.5.0')) { + if($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0') { $fwPortType = $_->portType ? uc($_->portType->val) : "N/A"; } $fwProto = $_->protocol; $fw_known_string .= "".$rule->label."".$fwDirection."".$fwPortType."".$fwPort."".$fwProto."".$allowedIPs."\n"; } - } - } + } + } $configString .= "FIREWALL
KNOWN SERVICES ENABLED".$fw_known_string."
LABELDIRECTIONPORT TYPEPORTPROTOCOLALLOWED IPS
\n"; my $defaultPolicy = "".($fw_sys->defaultPolicy->incomingBlocked ? "YES" : "NO")."".($fw_sys->defaultPolicy->outgoingBlocked ? "YES" : "NO")."\n"; @@ -2573,9 +2573,9 @@ sub printHostSummary { } ###################### - # FEATURE VERSION - ###################### - if($HOST_FEATURE_VERSION eq "yes" && $hostAPIVersion eq '4.1.0' || $hostAPIVersion eq '5.0.0' || $hostAPIVersion eq '5.1.0' || $hostAPIVersion eq '5.5.0') { + # FEATURE VERSION + ###################### + if($HOST_FEATURE_VERSION eq "yes" && $hostAPIVersion eq '4.1.0' || $hostAPIVersion eq '5.0.0' || $hostAPIVersion eq '5.1.0' || $hostAPIVersion eq '5.5.0') { if($local_host->summary->config->featureVersion) { my $featurever = $local_host->summary->config->featureVersion; my $featureString = ""; @@ -2584,7 +2584,7 @@ sub printHostSummary { } $configString .= "FEATURE VERSION".$featureString."
FEATUREVERSION
\n"; } - } + } $configString .= "\n"; } @@ -2614,8 +2614,8 @@ sub printHostSummary { if($key eq "NFS.HeartbeatMaxFailures") { $nfsHMF = $value; } if($key eq "VMkernel.Boot.techSupportMode") { $vmkernelBSM = $value; } if($key eq "VMFS3.HardwareAcceleratedLocking") { $vmfs3HAL = $value; } - if($key eq "DataMover.HardwareAcceleratedMove") { $dataMHAM = $value; } - if($key eq "DataMover.HardwareAcceleratedInit") { $dataMHAI = $value; } + if($key eq "DataMover.HardwareAcceleratedMove") { $dataMHAM = $value; } + if($key eq "DataMover.HardwareAcceleratedInit") { $dataMHAI = $value; } } $advString .= ""; $advString .= "".$host_name.""; @@ -2632,8 +2632,8 @@ sub printHostSummary { $advString .= "".$nfsHMF.""; $advString .= "".$vmkernelBSM.""; $advString .= "".$vmfs3HAL.""; - $advString .= "".$dataMHAM.""; - $advString .= "".$dataMHAI.""; + $advString .= "".$dataMHAM.""; + $advString .= "".$dataMHAI.""; $advString .= "\n"; } ###################### @@ -2649,9 +2649,9 @@ sub printHostSummary { $agentDSName = $agentDSNameTmp->{'name'}; } if($hostAgentMgr->configInfo->agentVmNetwork) { - my $agentNetNameTmp = Vim::get_view(mo_ref => $hostAgentMgr->configInfo->agentVmNetwork, properties => ['name']); + my $agentNetNameTmp = Vim::get_view(mo_ref => $hostAgentMgr->configInfo->agentVmNetwork, properties => ['name']); $agentNetName = $agentNetNameTmp->{'name'}; - } + } if($agentDSName ne "N/A" && $agentNetName ne "N/A") { $agentString .= ""; @@ -2773,8 +2773,8 @@ sub printHostSummary { } } ###################### - # LUN - ###################### + # LUN + ###################### if($HOST_LUN eq "yes") { my $ss = Vim::get_view(mo_ref => $local_host->configManager->storageSystem); my $fsmount = $ss->fileSystemVolumeInfo->mountInfo; @@ -2797,13 +2797,13 @@ sub printHostSummary { $vendor = $lun->vendor; $model = $lun->model; $queuedepth = $lun->queueDepth; - if($aversion eq '4.1.0' || ($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq ' 6.0.0'|| $aversion eq '6.5.0')) { - if($hostAPIVersion eq '4.1.0' || $hostAPIVersion eq '5.0.0' || $hostAPIVersion eq '5.1.0' || $hostAPIVersion eq '5.5.0') { - $vStorageSupport = ($lun->vStorageSupport ? $lun->vStorageSupport : "N/A"); - } else { - $vStorageSupport = "N/A" - } - } + if($aversion eq '4.1.0' || $aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0') { + if($hostAPIVersion eq '4.1.0' || $hostAPIVersion eq '5.0.0' || $hostAPIVersion eq '5.1.0' || $hostAPIVersion eq '5.5.0') { + $vStorageSupport = ($lun->vStorageSupport ? $lun->vStorageSupport : "N/A"); + } else { + $vStorageSupport = "N/A" + } + } $states = $lun->operationalState; last; } @@ -2818,8 +2818,8 @@ sub printHostSummary { foreach (@$states) { $state_string .= $_." "; } - if($aversion eq '4.1.0' || ($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq ' 6.0.0'|| $aversion eq '6.5.0')) { - if($hostAPIVersion eq '4.1.0' || $hostAPIVersion eq '5.0.0' || $hostAPIVersion eq '5.1.0' || $hostAPIVersion eq '5.5.0') { + if($aversion eq '4.1.0' || $aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0') { + if($hostAPIVersion eq '4.1.0' || $hostAPIVersion eq '5.0.0' || $hostAPIVersion eq '5.1.0' || $hostAPIVersion eq '5.5.0') { $lun_row .= "".$vStorageSupport.""; } else { $lun_row .= "N/A"; @@ -2832,8 +2832,8 @@ sub printHostSummary { } } ###################### - # DATASTORE - ###################### + # DATASTORE + ###################### if($HOST_DATASTORE eq "yes") { my $ds_views = Vim::get_views (mo_ref_array => $local_host->datastore); my $ctr = 0; @@ -2860,9 +2860,9 @@ sub printHostSummary { my $vmsInDS = Vim::get_views(mo_ref_array => $ds->vm,properties => ['name']); - if($aversion eq '4.1.0' || ($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq ' 6.0.0'|| $aversion eq '6.5.0')) { + if($aversion eq '4.1.0' || $aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0') { my ($iormEnable,$iormThres,$dsMaintMode,$iormAggDisable,$iormStatsCollEnable) = ("N/A","N/A","N/A","N/A","N/A"); - if(($hostAPIVersion eq '4.1.0' || $hostAPIVersion eq '5.0.0' || $hostAPIVersion eq '5.1.0' || $hostAPIVersion eq '5.5.0') && $ds->summary->type eq 'VMFS') { + if(($hostAPIVersion eq '4.1.0' || $hostAPIVersion eq '5.0.0' || $hostAPIVersion eq '5.1.0' || $hostAPIVersion eq '5.5.0') && $ds->summary->type eq 'VMFS') { $iormEnable = ($ds->iormConfiguration->enabled ? "YES" : "NO"); $iormThres = ($ds->iormConfiguration->congestionThreshold ? $ds->iormConfiguration->congestionThreshold . " ms" : "N/A"); if($hostAPIVersion eq '5.0.0' || $hostAPIVersion eq '5.1.0' || $hostAPIVersion eq '5.5.0') { @@ -2883,8 +2883,8 @@ sub printHostSummary { } } ###################### - # PORTGROUP - ###################### + # PORTGROUP + ###################### if($HOST_PORTGROUP eq "yes") { my $portgroup_views = Vim::get_views (mo_ref_array => $local_host->network); foreach my $portgroup (sort {$a->summary->name cmp $b->summary->name} @$portgroup_views) { @@ -2893,13 +2893,13 @@ sub printHostSummary { push @hosts_in_portgroups,$host_name; #logic to figure out which hosts can not see this portgroup - my @intersection = (); - my @difference = (); - my %count = (); - foreach my $element (@hosts_in_portgroups, @hosts_seen) { $count{$element}++ } - foreach my $element (keys %count) { - push @{ $count{$element} > 1 ? \@intersection : \@difference }, $element; - } + my @intersection = (); + my @difference = (); + my %count = (); + foreach my $element (@hosts_in_portgroups, @hosts_seen) { $count{$element}++ } + foreach my $element (keys %count) { + push @{ $count{$element} > 1 ? \@intersection : \@difference }, $element; + } if(@difference) { my $hosts_not_accessible = ""; foreach (@difference) { @@ -2920,7 +2920,7 @@ sub printHostSummary { ###################### # CACHE ###################### - if($HOST_CACHE eq "yes" && ($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq ' 6.0.0'|| $aversion eq '6.5.0')) { + if($HOST_CACHE eq "yes" && ($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0')) { my $cacheMgr; eval { $cacheMgr = Vim::get_view (mo_ref => $local_host->configManager->cacheConfigurationManager); }; if(!$@) { @@ -2938,15 +2938,15 @@ sub printHostSummary { } } ###################### - # MULTIPATH - ###################### + # MULTIPATH + ###################### if($HOST_MULTIPATH eq "yes") { my $storageSys; eval { $storageSys = Vim::get_view (mo_ref => $local_host->configManager->storageSystem); }; if(!$@) { - my $luns = $storageSys->storageDeviceInfo->scsiLun; - my $hbas = $storageSys->storageDeviceInfo->hostBusAdapter; - my $mpLuns = $storageSys->storageDeviceInfo->multipathInfo->lun; + my $luns = $storageSys->storageDeviceInfo->scsiLun; + my $hbas = $storageSys->storageDeviceInfo->hostBusAdapter; + my $mpLuns = $storageSys->storageDeviceInfo->multipathInfo->lun; $multipathString .= "\n"; @@ -2991,9 +2991,9 @@ sub printHostSummary { } } ###################### - # LOG - ###################### - if($HOST_LOG eq "yes") { + # LOG + ###################### + if($HOST_LOG eq "yes") { my $logKey = "hostd"; my ($diagMgr,$logData); eval { $diagMgr = Vim::get_view(mo_ref => $sc->diagnosticManager); }; @@ -3039,7 +3039,7 @@ sub printHostSummary { #logic to check which hosts can see all luns while ( my ($uuid, $value) = each(%luns) ) { my @pairs = split(',',$value); - my $pair_count = @pairs; + my $pair_count = @pairs; my @hosts_to_luns = (); for (my $x=0;$x < $pair_count;$x++) { (my $hostname,my $vmhba) = split('_',$pairs[$x],2); @@ -3070,9 +3070,9 @@ sub printHostSummary { } foreach my $lun ( sort keys %lun_row_info ) { - my $value = $lun_row_info{$lun}; - $lunString .= "".$value."\n"; - } + my $value = $lun_row_info{$lun}; + $lunString .= "".$value."\n"; + } (%luns,%lun_row_info) = (); } if($HOST_DATASTORE eq "yes") { @@ -3103,7 +3103,7 @@ sub printHostSummary { if($print_string eq '') { $print_string = ""; } else { - $print_string = ""; + $print_string = ""; } $datastore_row_info{$ds} .= $print_string; @hosts_to_datastores = (); @@ -3130,22 +3130,22 @@ sub printHostSummary { ## Executed outside of the hosts ## ###################### - # TASK - ###################### - if($HOST_TASK eq "yes") { - my $taskMgr; - eval { $taskMgr = Vim::get_view(mo_ref => $sc->taskManager); }; - if(!$@) { - my $tasks = Vim::get_views(mo_ref_array => $taskMgr->recentTask); - foreach(@$tasks) { - my $progress = $_->info->progress; - if(!defined($progress)) { - $progress = "COMPLETED"; - } - $taskString .= "\n"; - } - } - } + # TASK + ###################### + if($HOST_TASK eq "yes") { + my $taskMgr; + eval { $taskMgr = Vim::get_view(mo_ref => $sc->taskManager); }; + if(!$@) { + my $tasks = Vim::get_views(mo_ref_array => $taskMgr->recentTask); + foreach(@$tasks) { + my $progress = $_->info->progress; + if(!defined($progress)) { + $progress = "COMPLETED"; + } + $taskString .= "\n"; + } + } + } @hosts_seen = (); @datastores_seen = (); @@ -3155,181 +3155,181 @@ sub printHostSummary { } sub buildHostReport { - my ($cluster_name,$cluster_count,$type,$atype,$aversion) = @_; + my ($cluster_name,$cluster_count,$type,$atype,$aversion) = @_; - my ($hostTag,$hostTagShort,$table_host_conf) = ("","",""); + my ($hostTag,$hostTagShort,$table_host_conf) = ("","",""); if($HOST_STATE eq "yes" && $stateString ne "") { - $hostTag = "ESX/ESXi State-$cluster_count"; - $hostTagShort = "ESX/ESXi State"; - - push @host_jump_tags,"            $hostTagShort
\n"; - - $table_host_conf .= "\n"; - $table_host_conf .= "

$hostTagShort:

\n"; - $table_host_conf .= "
".$local_host->name."
".$lun."
".$lun."
Accessible by all hosts in this cluster".$print_string."".$print_string."
".$_->info->descriptionId."".$_->info->queueTime."".($_->info->startTime ? $_->info->startTime : "N/A")."".($_->info->completeTime ? $_->info->completeTime : "N/A")."".$progress."".$_->info->state->val."
".$_->info->descriptionId."".$_->info->queueTime."".($_->info->startTime ? $_->info->startTime : "N/A")."".($_->info->completeTime ? $_->info->completeTime : "N/A")."".$progress."".$_->info->state->val."
\n"; - - if($aversion eq '4.1.0' || ($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq ' 6.0.0'|| $aversion eq '6.5.0')) { - $table_host_conf .= "\n"; - } else { - $table_host_conf .= "\n"; - } - - $table_host_conf .= $stateString; - $table_host_conf .= "
HOSTNAMEOVERALL STATUSPOWER STATEBOOT TIMEUPTIMEHA STATECONNECTION STATEMAINTENANCE MODESTANDBY MODEVMOTION ENABLEDVERSION
HOSTNAMEOVERALL STATUSPOWER STATEBOOT TIMECONNECTION STATEMAINTENANCE MODEVMOTION ENABLEDVERSION
\n"; - $hostString .= "
".$table_host_conf; - ($table_host_conf,$stateString) = ("",""); - } + $hostTag = "ESX/ESXi State-$cluster_count"; + $hostTagShort = "ESX/ESXi State"; + + push @host_jump_tags,"            $hostTagShort
\n"; + + $table_host_conf .= "\n"; + $table_host_conf .= "

$hostTagShort:

\n"; + $table_host_conf .= "\n"; + + if($aversion eq '4.1.0' || $aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0') { + $table_host_conf .= "\n"; + } else { + $table_host_conf .= "\n"; + } + + $table_host_conf .= $stateString; + $table_host_conf .= "
HOSTNAMEOVERALL STATUSPOWER STATEBOOT TIMEUPTIMEHA STATECONNECTION STATEMAINTENANCE MODESTANDBY MODEVMOTION ENABLEDVERSION
HOSTNAMEOVERALL STATUSPOWER STATEBOOT TIMECONNECTION STATEMAINTENANCE MODEVMOTION ENABLEDVERSION
\n"; + $hostString .= "
".$table_host_conf; + ($table_host_conf,$stateString) = ("",""); + } if($HOST_MGMT eq "yes" && $mgmtString ne "") { - $hostTag = "ESX/ESXi Management Info-$cluster_count"; - $hostTagShort = "ESX/ESXi Management Info"; - - push @host_jump_tags,"            $hostTagShort
\n"; - - $table_host_conf .= "\n"; - $table_host_conf .= "

$hostTagShort:

\n"; - $table_host_conf .= "\n"; - if($aversion eq '4.1.0' || ($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq ' 6.0.0'|| $aversion eq '6.5.0')) { - $table_host_conf .= "\n"; - } else { - $table_host_conf .= "\n"; - } - - $table_host_conf .= $mgmtString; - $table_host_conf .= "
HOSTNAMEvCenterLOCKDOWN MODE ENABLEDCOS VMDKUUIDSERVICE CONSOLE MEM
HOSTNAMEvCenterLOCKDOWN MODE ENABLEDUUIDSERVICE CONSOLE MEM
\n"; - $hostString .= "
".$table_host_conf; - ($table_host_conf,$mgmtString) = ("",""); - } - if($HOST_HARDWARE_CONFIGURATION eq "yes" && $hardwareConfigurationString ne "") { + $hostTag = "ESX/ESXi Management Info-$cluster_count"; + $hostTagShort = "ESX/ESXi Management Info"; + + push @host_jump_tags,"            $hostTagShort
\n"; + + $table_host_conf .= "\n"; + $table_host_conf .= "

$hostTagShort:

\n"; + $table_host_conf .= "\n"; + if($aversion eq '4.1.0' || $aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0') { + $table_host_conf .= "\n"; + } else { + $table_host_conf .= "\n"; + } + + $table_host_conf .= $mgmtString; + $table_host_conf .= "
HOSTNAMEvCenterLOCKDOWN MODE ENABLEDCOS VMDKUUIDSERVICE CONSOLE MEM
HOSTNAMEvCenterLOCKDOWN MODE ENABLEDUUIDSERVICE CONSOLE MEM
\n"; + $hostString .= "
".$table_host_conf; + ($table_host_conf,$mgmtString) = ("",""); + } + if($HOST_HARDWARE_CONFIGURATION eq "yes" && $hardwareConfigurationString ne "") { $hostTag = "ESX/ESXi Hardware Configuration-$cluster_count"; - $hostTagShort = "ESX/ESXi Hardware Configuration"; + $hostTagShort = "ESX/ESXi Hardware Configuration"; push @host_jump_tags,"            $hostTagShort
\n"; - $table_host_conf .= "\n"; - $table_host_conf .= "

$hostTagShort:

\n"; - $table_host_conf .= "\n"; - if(($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq ' 6.0.0'|| $aversion eq '6.5.0')) { + $table_host_conf .= "\n"; + $table_host_conf .= "

$hostTagShort:

\n"; + $table_host_conf .= "
\n"; + if($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0') { $table_host_conf .= "\n"; } else { - $table_host_conf .= "\n"; + $table_host_conf .= "\n"; } $table_host_conf .= $hardwareConfigurationString; $table_host_conf .= "
HOSTNAMEVENDORADDITIONAL VENDOR INFOMODELCPU INFOSMC PRESENTHT AVAILABLECPU SPEEDCPU USAGEPROCESSOR SOCKETSCORES PER SOCKETLOGICAL CORESMEMORYMEMORY USAGENIC(s)HBA(s)
HOSTNAMEVENDORADDITIONAL VENDOR INFOMODELCPU INFOHT AVAILABLECPU SPEEDCPU USAGEPROCESSOR SOCKETSCORES PER SOCKETLOGICAL CORESMEMORYMEMORY USAGENIC(s)HBA(s)
HOSTNAMEVENDORADDITIONAL VENDOR INFOMODELCPU INFOHT AVAILABLECPU SPEEDCPU USAGEPROCESSOR SOCKETSCORES PER SOCKETLOGICAL CORESMEMORYMEMORY USAGENIC(s)HBA(s)
\n"; - $hostString .= "
".$table_host_conf; - ($table_host_conf,$hardwareConfigurationString) = ("",""); + $hostString .= "
".$table_host_conf; + ($table_host_conf,$hardwareConfigurationString) = ("",""); } if($HOST_HEALTH eq "yes" && $healthHardwareString ne "") { $hostTag = "ESX/ESXi Health Hardware Status-$cluster_count"; - $hostTagShort = "ESX/ESXi Health Hardware Status"; + $hostTagShort = "ESX/ESXi Health Hardware Status"; - push @host_jump_tags,"            $hostTagShort
\n"; + push @host_jump_tags,"            $hostTagShort
\n"; - $table_host_conf .= "\n"; - $table_host_conf .= "

$hostTagShort:

\n"; - $table_host_conf .= "\n"; - $table_host_conf .= "\n"; + $table_host_conf .= "\n"; + $table_host_conf .= "

$hostTagShort:

\n"; + $table_host_conf .= "
COMPONENTSTATUS
\n"; + $table_host_conf .= "\n"; $table_host_conf .= $healthHardwareString; $table_host_conf .= "
COMPONENTSTATUS
\n"; - $hostString .= "
".$table_host_conf; - ($table_host_conf,$healthHardwareString) = ("",""); + $hostString .= "
".$table_host_conf; + ($table_host_conf,$healthHardwareString) = ("",""); } if($HOST_HEALTH eq "yes" && $healthSoftwareString ne "") { $hostTag = "ESX/ESXi Health Software Status-$cluster_count"; - $hostTagShort = "ESX/ESXi Health Software Status"; + $hostTagShort = "ESX/ESXi Health Software Status"; - push @host_jump_tags,"            $hostTagShort
\n"; + push @host_jump_tags,"            $hostTagShort
\n"; - $table_host_conf .= "\n"; - $table_host_conf .= "

$hostTagShort:

\n"; - $table_host_conf .= "Click here for more detail info\n"; - $table_host_conf .= "
\n"; - $table_host_conf .= "\n"; - $table_host_conf .= "\n"; + $table_host_conf .= "\n"; + $table_host_conf .= "

$hostTagShort:

\n"; + $table_host_conf .= "Click here for more detail info\n"; + $table_host_conf .= "
\n"; + $table_host_conf .= "
SENSOR NAMEREADINGSTATUS
\n"; + $table_host_conf .= "\n"; $table_host_conf .= $healthSoftwareString; $table_host_conf .= "
SENSOR NAMEREADINGSTATUS
\n"; $table_host_conf .= "
\n"; - $hostString .= "
".$table_host_conf; - ($table_host_conf,$healthSoftwareString) = ("",""); + $hostString .= "
".$table_host_conf; + ($table_host_conf,$healthSoftwareString) = ("",""); } if($HOST_PERFORMANCE eq "yes" || $hostperformance eq "yes" && $hostPerfString ne "") { $hostTag = "ESX/ESXi Performance-$cluster_count"; - $hostTagShort = "ESX/ESXi Performance"; + $hostTagShort = "ESX/ESXi Performance"; - push @host_jump_tags,"            $hostTagShort
\n"; + push @host_jump_tags,"            $hostTagShort
\n"; - $table_host_conf .= "\n"; - $table_host_conf .= "

$hostTagShort:

\n"; - $table_host_conf .= "\n"; - $table_host_conf .= "\n"; + $table_host_conf .= "\n"; + $table_host_conf .= "

$hostTagShort:

\n"; + $table_host_conf .= "
HOSTcpu.usagemhz.averagecpu.usage.averagemem.active.averagemem.usage.average
\n"; + $table_host_conf .= "\n"; $table_host_conf .= $hostPerfString; $table_host_conf .= "
HOSTcpu.usagemhz.averagecpu.usage.averagemem.active.averagemem.usage.average
\n"; - $hostString .= "
".$table_host_conf; - ($table_host_conf,$hostPerfString) = ("",""); + $hostString .= "
".$table_host_conf; + ($table_host_conf,$hostPerfString) = ("",""); } if($HOST_NIC eq "yes" && $nicString ne "") { - $hostTag = "ESX/ESXi NIC(s)-$cluster_count"; - $hostTagShort = "ESX/ESXi NIC(s)"; + $hostTag = "ESX/ESXi NIC(s)-$cluster_count"; + $hostTagShort = "ESX/ESXi NIC(s)"; - push @host_jump_tags,"            $hostTagShort
\n"; + push @host_jump_tags,"            $hostTagShort
\n"; - $table_host_conf .= "\n"; - $table_host_conf .= "

$hostTagShort:

\n"; - $table_host_conf .= "\n"; - $table_host_conf .= "\n"; + $table_host_conf .= "\n"; + $table_host_conf .= "

$hostTagShort:

\n"; + $table_host_conf .= "
HOSTDEVICEPCIDRIVERDUPLEXSPEEDWOL ENABLEDMAC
\n"; + $table_host_conf .= "\n"; $table_host_conf .= $nicString; $table_host_conf .= "
HOSTDEVICEPCIDRIVERDUPLEXSPEEDWOL ENABLEDMAC
\n"; - $hostString .= "
".$table_host_conf; - ($table_host_conf,$nicString) = ("",""); - } + $hostString .= "
".$table_host_conf; + ($table_host_conf,$nicString) = ("",""); + } if($HOST_HBA eq "yes" && $hbaString ne "") { - $hostTag = "ESX/ESXi HBA(s)-$cluster_count"; - $hostTagShort = "ESX/ESXi HBA(s)"; + $hostTag = "ESX/ESXi HBA(s)-$cluster_count"; + $hostTagShort = "ESX/ESXi HBA(s)"; - push @host_jump_tags,"            $hostTagShort
\n"; + push @host_jump_tags,"            $hostTagShort
\n"; - $table_host_conf .= "\n"; - $table_host_conf .= "

$hostTagShort:

\n"; - $table_host_conf .= "\n"; - $table_host_conf .= "\n"; + $table_host_conf .= "\n"; + $table_host_conf .= "

$hostTagShort:

\n"; + $table_host_conf .= "
HOSTHBA TYPEDEVICEPCIMODELDRIVERSTATUSADDITIONAL INFO
\n"; + $table_host_conf .= "\n"; $table_host_conf .= $hbaString; $table_host_conf .= "
HOSTHBA TYPEDEVICEPCIMODELDRIVERSTATUSADDITIONAL INFO
\n"; - $hostString .= "
".$table_host_conf; - ($table_host_conf,$hbaString) = ("",""); - } - if($HOST_ISCSI eq "yes" && $iscsiString ne "" && ($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq ' 6.0.0'|| $aversion eq '6.5.0')) { - $hostTag = "ESX/ESXi iSCSI-$cluster_count"; - $hostTagShort = "ESX/ESXi iSCSI"; - - push @host_jump_tags,"            $hostTagShort
\n"; - - $table_host_conf .= "\n"; - $table_host_conf .= "

$hostTagShort:

\n"; - $table_host_conf .= "\n"; - $table_host_conf .= "\n"; - - $table_host_conf .= $iscsiString; - $table_host_conf .= "
HOSTVNICIP ADDRESSNETMASKMAC ADDRESSMTUTSO ENABLEDSPEEDPNICPORTGROUPVSWITCHSWITCH UUIDPATH STATUS
\n"; - $hostString .= "
".$table_host_conf; - ($table_host_conf,$iscsiString) = ("",""); - } + $hostString .= "
".$table_host_conf; + ($table_host_conf,$hbaString) = ("",""); + } + if($HOST_ISCSI eq "yes" && $iscsiString ne "" && ($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0')) { + $hostTag = "ESX/ESXi iSCSI-$cluster_count"; + $hostTagShort = "ESX/ESXi iSCSI"; + + push @host_jump_tags,"            $hostTagShort
\n"; + + $table_host_conf .= "\n"; + $table_host_conf .= "

$hostTagShort:

\n"; + $table_host_conf .= "\n"; + $table_host_conf .= "\n"; + + $table_host_conf .= $iscsiString; + $table_host_conf .= "
HOSTVNICIP ADDRESSNETMASKMAC ADDRESSMTUTSO ENABLEDSPEEDPNICPORTGROUPVSWITCHSWITCH UUIDPATH STATUS
\n"; + $hostString .= "
".$table_host_conf; + ($table_host_conf,$iscsiString) = ("",""); + } if($HOST_CAPABILITY eq "yes" && $capString ne "") { $hostTag = "ESX/ESXi Capabilitie(s)-$cluster_count"; - $hostTagShort = "ESX/ESXi Capabilitie(s)"; + $hostTagShort = "ESX/ESXi Capabilitie(s)"; - push @host_jump_tags,"            $hostTagShort
\n"; + push @host_jump_tags,"            $hostTagShort
\n"; - $table_host_conf .= "\n"; - $table_host_conf .= "

$hostTagShort:

\n"; + $table_host_conf .= "\n"; + $table_host_conf .= "

$hostTagShort:

\n"; $table_host_conf .= "\n"; - if(($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq ' 6.0.0'|| $aversion eq '6.5.0')) { + if($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0') { $table_host_conf .= "\n"; } elsif($aversion eq '4.1.0') { $table_host_conf .= "\n"; @@ -3337,278 +3337,278 @@ sub buildHostReport { $table_host_conf .= "\n"; } - $table_host_conf .= $capString; - $table_host_conf .= "
HOSTMAX RUNNING VMS SUPPORTMAX VCPUS SUPPORTVMFS VERSIONS SUPPORTFT SUPPORTIPMI SUPPORTTPM SUPPORTHV SUPPORTIORM SUPPORTDIRECTPATH G2 SUPPORTSTORAGE HW ACCELERATION SUPPORTSSL THUMBPRINT AUTH SUPPORT
HOSTFT SUPPORTIPMI SUPPORTTPM SUPPORTHV SUPPORTIORM SUPPORTDIRECTPATH G2 SUPPORTSTORAGE HW ACCELERATION SUPPORTSSL THUMBPRINT AUTH SUPPORT
HOSTFT SUPPORTIPMI SUPPORTTPM SUPPORTHV SUPPORTSSL THUMBPRINT AUTH SUPPORT
\n"; - $hostString .= "
".$table_host_conf; - ($table_host_conf,$capString) = ("",""); + $table_host_conf .= $capString; + $table_host_conf .= "\n"; + $hostString .= "
".$table_host_conf; + ($table_host_conf,$capString) = ("",""); } if($HOST_CONFIGURATION eq "yes" && $configString ne "") { $hostTag = "ESX/ESXi Configuration(s)-$cluster_count"; - $hostTagShort = "ESX/ESXi Configuration(s)"; + $hostTagShort = "ESX/ESXi Configuration(s)"; - push @host_jump_tags,"            $hostTagShort
\n"; + push @host_jump_tags,"            $hostTagShort
\n"; - $table_host_conf .= "\n"; - $table_host_conf .= "

$hostTagShort:

\n"; + $table_host_conf .= "\n"; + $table_host_conf .= "

$hostTagShort:

\n"; $table_host_conf .= $configString; #$table_host_conf .= "\n"; - $hostString .= "
".$table_host_conf; - ($table_host_conf,$configString) = ("",""); + $hostString .= "
".$table_host_conf; + ($table_host_conf,$configString) = ("",""); } if($HOST_ADVOPT eq "yes" && $advString ne "") { $hostTag = "ESX/ESXi Advanced Options-$cluster_count"; - $hostTagShort = "ESX/ESXi Advanced Options"; + $hostTagShort = "ESX/ESXi Advanced Options"; - push @host_jump_tags,"            $hostTagShort
\n"; + push @host_jump_tags,"            $hostTagShort
\n"; - $table_host_conf .= "\n"; - $table_host_conf .= "

$hostTagShort:

\n"; - $table_host_conf .= "\n"; + $table_host_conf .= "\n"; + $table_host_conf .= "

$hostTagShort:

\n"; + $table_host_conf .= "
\n"; - if($aversion eq '4.1.0' || ($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq ' 6.0.0'|| $aversion eq '6.5.0') ) { - $table_host_conf .= "\n"; - } else { - $table_host_conf .= "\n"; - } + } - $table_host_conf .= $advString; - $table_host_conf .= "
HOSTDisk.UseDeviceResetDisk.UseLunResetDisk.SchedNumReqOutstandingSc + if($aversion eq '4.1.0' || $aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0') { + $table_host_conf .= "
HOSTDisk.UseDeviceResetDisk.UseLunResetDisk.SchedNumReqOutstandingSc si.ConflictRetriesNFS.MaxVolumesSendBufferSizeReceiveBufferSizeNet.TcpipHeapSizeNFS.HeartbeatFrequencyN FS.HeartbeatTimeoutNFS.HeartbeatMaxFailuresVMkernel.Boot.techSupportModeVMFS3.HardwareAcceleratedLockingDataMover.Hardwar eAcceleratedMoveDataMover.HardwareAcceleratedInit
HOSTDisk.UseDeviceResetDisk.UseLunResetDisk.SchedNumReqOutstandingSc + } else { + $table_host_conf .= "
HOSTDisk.UseDeviceResetDisk.UseLunResetDisk.SchedNumReqOutstandingSc si.ConflictRetriesNFS.MaxVolumesSendBufferSizeReceiveBufferSizeNet.TcpipHeapSizeNFS.HeartbeatFrequencyN FS.HeartbeatTimeoutNFS.HeartbeatMaxFailuresVMkernel.Boot.techSupportMode
\n"; - $hostString .= "
".$table_host_conf; - ($table_host_conf,$advString) = ("",""); + $table_host_conf .= $advString; + $table_host_conf .= "\n"; + $hostString .= "
".$table_host_conf; + ($table_host_conf,$advString) = ("",""); } - if($HOST_ADVOPT eq "yes" && $agentString ne "" && $atype eq "VirtualCenter" && ($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq ' 6.0.0'|| $aversion eq '6.5.0')) { - $hostTag = "ESX/ESXi Host Agent Settings-$cluster_count"; - $hostTagShort = "ESX/ESXi Host Agent Settings"; + if($HOST_ADVOPT eq "yes" && $agentString ne "" && $atype eq "VirtualCenter" && ($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0')) { + $hostTag = "ESX/ESXi Host Agent Settings-$cluster_count"; + $hostTagShort = "ESX/ESXi Host Agent Settings"; - push @host_jump_tags,"            $hostTagShort
\n"; + push @host_jump_tags,"            $hostTagShort
\n"; - $table_host_conf .= "\n"; - $table_host_conf .= "

$hostTagShort:

\n"; - $table_host_conf .= "\n"; + $table_host_conf .= "\n"; + $table_host_conf .= "

$hostTagShort:

\n"; + $table_host_conf .= "
\n"; $table_host_conf .= "\n"; - $table_host_conf .= $agentString; - $table_host_conf .= "
HOSTAGENT VM DATASTOREAGENT VM NETWORK
\n"; - $hostString .= "
".$table_host_conf; - ($table_host_conf,$agentString) = ("",""); - } + $table_host_conf .= $agentString; + $table_host_conf .= "\n"; + $hostString .= "
".$table_host_conf; + ($table_host_conf,$agentString) = ("",""); + } if($HOST_NUMA eq "yes" && $numaString ne "") { $hostTag = "ESX/ESXi NUMA-$cluster_count"; - $hostTagShort = "ESX/ESXi NUMA"; + $hostTagShort = "ESX/ESXi NUMA"; - push @host_jump_tags,"            $hostTagShort
\n"; + push @host_jump_tags,"            $hostTagShort
\n"; - $table_host_conf .= "\n"; - $table_host_conf .= "

$hostTagShort:

\n"; - $table_host_conf .= "\n"; - $table_host_conf .= "\n"; + $table_host_conf .= "\n"; + $table_host_conf .= "

$hostTagShort:

\n"; + $table_host_conf .= "
HOST# NODESTYPENUMA NODE INFO
\n"; + $table_host_conf .= "\n"; $table_host_conf .= $numaString; $table_host_conf .= "
HOST# NODESTYPENUMA NODE INFO
\n"; - $hostString .= "
".$table_host_conf; - ($table_host_conf,$numaString) = ("",""); + $hostString .= "
".$table_host_conf; + ($table_host_conf,$numaString) = ("",""); } if($HOST_CDP eq "yes" && $cdpString ne "") { - $hostTag = "ESX/ESXi CDP-$cluster_count"; - $hostTagShort = "ESX/ESXi CDP"; + $hostTag = "ESX/ESXi CDP-$cluster_count"; + $hostTagShort = "ESX/ESXi CDP"; - push @host_jump_tags,"            $hostTagShort
\n"; + push @host_jump_tags,"            $hostTagShort
\n"; - $table_host_conf .= "\n"; - $table_host_conf .= "

$hostTagShort:

\n"; - $table_host_conf .= "\n"; - $table_host_conf .= "\n"; + $table_host_conf .= "\n"; + $table_host_conf .= "

$hostTagShort:

\n"; + $table_host_conf .= "
HOSTDEVICEMGMT ADDRESSDEVICE ADDRESSIP PREFIXLOCATIONSYSTEM NAMESYSTEM VERSIONSYSTEM OIDPLATFORMDEVICE IDCDP VERFULL DUPLEXMTUTIMEOUTTTLVLAN IDSAMPLES
\n"; + $table_host_conf .= "\n"; $table_host_conf .= $cdpString; $table_host_conf .= "
HOSTDEVICEMGMT ADDRESSDEVICE ADDRESSIP PREFIXLOCATIONSYSTEM NAMESYSTEM VERSIONSYSTEM OIDPLATFORMDEVICE IDCDP VERFULL DUPLEXMTUTIMEOUTTTLVLAN IDSAMPLES
\n"; - $hostString .= "
".$table_host_conf; - ($table_host_conf,$cdpString) = ("",""); - } - if($HOST_DVS eq "yes" && $atype eq "VirtualCenter" && $dvsString ne "") { - $hostTag = "ESX/ESXi Distributed vSwitch-$cluster_count"; - $hostTagShort = "ESX/ESXi Distributed vSwitch"; - - push @host_jump_tags,"            $hostTagShort
\n"; - - $table_host_conf .= "\n"; - $table_host_conf .= "

$hostTagShort:

\n"; - $table_host_conf .= "\n"; - $table_host_conf .= "
NAMEDESCRIPTIONCONTACT INFOVENDORVERSIONUUIDBUILD + $hostString .= "
".$table_host_conf; + ($table_host_conf,$cdpString) = ("",""); + } + if($HOST_DVS eq "yes" && $atype eq "VirtualCenter" && $dvsString ne "") { + $hostTag = "ESX/ESXi Distributed vSwitch-$cluster_count"; + $hostTagShort = "ESX/ESXi Distributed vSwitch"; + + push @host_jump_tags,"            $hostTagShort
\n"; + + $table_host_conf .= "\n"; + $table_host_conf .= "

$hostTagShort:

\n"; + $table_host_conf .= "\n"; + $table_host_conf .= "\n"; $table_host_conf .= $dvsString; $table_host_conf .= "
NAMEDESCRIPTIONCONTACT INFOVENDORVERSIONUUIDBUILD BUNDLE IDBUNDLE BUILDBUNDLE URLFORWARDING CLASSPORTS
\n"; - $hostString .= "
".$table_host_conf; - ($table_host_conf,$numaString) = ("",""); - } - if($HOST_LUN eq "yes" && $lunString) { - $hostTag = "ESX/ESXi LUN(s)-$cluster_count"; - $hostTagShort = "ESX/ESXi LUN(s)"; + $hostString .= "
".$table_host_conf; + ($table_host_conf,$numaString) = ("",""); + } + if($HOST_LUN eq "yes" && $lunString) { + $hostTag = "ESX/ESXi LUN(s)-$cluster_count"; + $hostTagShort = "ESX/ESXi LUN(s)"; - push @host_jump_tags,"            $hostTagShort
\n"; + push @host_jump_tags,"            $hostTagShort
\n"; - $table_host_conf .= "\n"; - $table_host_conf .= "

$hostTagShort:

\n"; - $table_host_conf .= "\n"; + $table_host_conf .= "\n"; + $table_host_conf .= "

$hostTagShort:

\n"; + $table_host_conf .= "
\n"; - if($aversion eq '4.1.0' || ($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq ' 6.0.0'|| $aversion eq '6.5.0')) { + if($aversion eq '4.1.0' || $aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0') { $table_host_conf .= "\n"; } else { - $table_host_conf .= "\n"; + $table_host_conf .= "\n"; } $table_host_conf .= $lunString; $table_host_conf .= "
VOLUME UUIDDATASTOREDISK_NAMEDEVICE_NAMEQUEUE DEPTHvSTORAGE SUPPORTSTATUSVENDORMODELHOST(s) NOT ACCESSIBLE TO LUN
VOLUME UUIDDATASTOREDISK_NAMEDEVICE_NAMEQUEUE DEPTHSTATUSVENDORMODELHOST(s) NOT ACCESSIBLE TO LUN
VOLUME UUIDDATASTOREDISK_NAMEDEVICE_NAMEQUEUE DEPTHSTATUSVENDORMODELHOST(s) NOT ACCESSIBLE TO LUN
\n"; - $hostString .= "
".$table_host_conf; - ($table_host_conf,$lunString) = ("",""); - } + $hostString .= "
".$table_host_conf; + ($table_host_conf,$lunString) = ("",""); + } if($HOST_DATASTORE eq "yes" && $datastoreString ne "") { - $hostTag = "ESX/ESXi Datastore(s)-$cluster_count"; - $hostTagShort = "ESX/ESXi Datastore(s)"; + $hostTag = "ESX/ESXi Datastore(s)-$cluster_count"; + $hostTagShort = "ESX/ESXi Datastore(s)"; - push @host_jump_tags,"            $hostTagShort
\n"; + push @host_jump_tags,"            $hostTagShort
\n"; - $table_host_conf .= "\n"; - $table_host_conf .= "

$hostTagShort:

\n"; - $table_host_conf .= "
COLOR LEGENDYELLOW < $YELLOW_WARN %ORANGE < $ORANGE_WARN %RED < $RED_WARN %
\n"; - $table_host_conf .= "\n"; + $table_host_conf .= "\n"; + $table_host_conf .= "

$hostTagShort:

\n"; + $table_host_conf .= "
COLOR LEGENDYELLOW < $YELLOW_WARN %ORANGE < $ORANGE_WARN %RED < $RED_WARN %
\n"; + $table_host_conf .= "\n"; - if($aversion eq '4.1.0' || ($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq ' 6.0.0'|| $aversion eq '6.5.0')) { + if($aversion eq '4.1.0' || $aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0') { $table_host_conf .= "\n"; } else { - $table_host_conf .= "\n"; + $table_host_conf .= "\n"; } $table_host_conf .= $datastoreString; $table_host_conf .= "
DATASTORE# OF VMSCAPACITYCONSUMEDFREE% FREEBLOCK SIZEVERSIONDS TYPEMAINTENANCE MODEIORM ENABLEDCONGESTION THRESHOLDSTATS AGGREGATION DIABLEDSTATS COLLECTION ENABLEDHOST(s) NOT ACCESSIBLE TO DATASTORE
DATASTORE# OF VMSCAPACITYCONSUMEDFREE% FREEBLOCK SIZEVERSIONDS TYPEHOST(s) NOT ACCESSIBLE TO DATASTORE
DATASTORE# OF VMSCAPACITYCONSUMEDFREE% FREEBLOCK SIZEVERSIONDS TYPEHOST(s) NOT ACCESSIBLE TO DATASTORE
\n"; - $hostString .= "
".$table_host_conf; - ($table_host_conf,$datastoreString) = ("",""); - } - if($HOST_CACHE eq "yes" && ($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq ' 6.0.0'|| $aversion eq '6.5.0')) { - $hostTag = "ESX/ESXi Cache Configuration-$cluster_count"; - $hostTagShort = "ESX/ESXi Cache Configuration"; - - push @host_jump_tags,"            $hostTagShort
\n"; - - $table_host_conf .= "\n"; - $table_host_conf .= "

$hostTagShort:

\n"; - $table_host_conf .= "\n"; - $table_host_conf .= "\n"; - - $table_host_conf .= $cacheString; - $table_host_conf .= "
HOSTCACHE DATASTORESWAPSIZE
\n"; - $hostString .= "
".$table_host_conf; - ($table_host_conf,$cacheString) = ("",""); - } - if($HOST_PORTGROUP eq "yes" && $portgroupString ne "") { - $hostTag = "ESX/ESXi Portgroup(s)-$cluster_count"; - $hostTagShort = "ESX/ESXi Portgroup(s)"; - - push @host_jump_tags,"            $hostTagShort
\n"; - - $table_host_conf .= "\n"; - $table_host_conf .= "

$hostTagShort:

\n"; - $table_host_conf .= "\n"; - $table_host_conf .= "\n"; + $hostString .= "
".$table_host_conf; + ($table_host_conf,$datastoreString) = ("",""); + } + if($HOST_CACHE eq "yes" && ($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0')) { + $hostTag = "ESX/ESXi Cache Configuration-$cluster_count"; + $hostTagShort = "ESX/ESXi Cache Configuration"; + + push @host_jump_tags,"            $hostTagShort
\n"; + + $table_host_conf .= "\n"; + $table_host_conf .= "

$hostTagShort:

\n"; + $table_host_conf .= "
PORTGROUPHOST(s) NOT ACCESSIBLE TO PORTGROUP
\n"; + $table_host_conf .= "\n"; + + $table_host_conf .= $cacheString; + $table_host_conf .= "
HOSTCACHE DATASTORESWAPSIZE
\n"; + $hostString .= "
".$table_host_conf; + ($table_host_conf,$cacheString) = ("",""); + } + if($HOST_PORTGROUP eq "yes" && $portgroupString ne "") { + $hostTag = "ESX/ESXi Portgroup(s)-$cluster_count"; + $hostTagShort = "ESX/ESXi Portgroup(s)"; + + push @host_jump_tags,"            $hostTagShort
\n"; + + $table_host_conf .= "\n"; + $table_host_conf .= "

$hostTagShort:

\n"; + $table_host_conf .= "\n"; + $table_host_conf .= "\n"; $table_host_conf .= $portgroupString; $table_host_conf .= "
PORTGROUPHOST(s) NOT ACCESSIBLE TO PORTGROUP
\n"; - $hostString .= "
".$table_host_conf; - ($table_host_conf,$portgroupString) = ("",""); - } - if($HOST_MULTIPATH eq "yes" && $multipathString ne "") { - $hostTag = "ESX/ESXi Multipathing-$cluster_count"; - $hostTagShort = "ESX/ESXi Multipathing"; + $hostString .= "
".$table_host_conf; + ($table_host_conf,$portgroupString) = ("",""); + } + if($HOST_MULTIPATH eq "yes" && $multipathString ne "") { + $hostTag = "ESX/ESXi Multipathing-$cluster_count"; + $hostTagShort = "ESX/ESXi Multipathing"; - push @host_jump_tags,"            $hostTagShort
\n"; + push @host_jump_tags,"            $hostTagShort
\n"; - $table_host_conf .= "\n"; - $table_host_conf .= "

$hostTagShort:

\n"; + $table_host_conf .= "\n"; + $table_host_conf .= "

$hostTagShort:

\n"; ###DEBUG - #$table_host_conf .= "\n"; + #$table_host_conf .= "
\n"; $table_host_conf .= $multipathString; $table_host_conf .= "
\n"; - $hostString .= "
".$table_host_conf; - ($table_host_conf,$multipathString) = ("",""); - } - if($HOST_LOG eq "yes" && $logString ne "") { - $hostTag = "ESX/ESXi Hostd Logs-$cluster_count - Last $logcount lines"; - $hostTagShort = "ESX/ESXi Hostd Logs - Last $logcount lines"; + $hostString .= "
".$table_host_conf; + ($table_host_conf,$multipathString) = ("",""); + } + if($HOST_LOG eq "yes" && $logString ne "") { + $hostTag = "ESX/ESXi Hostd Logs-$cluster_count - Last $logcount lines"; + $hostTagShort = "ESX/ESXi Hostd Logs - Last $logcount lines"; - push @host_jump_tags,"            $hostTagShort
\n"; + push @host_jump_tags,"            $hostTagShort
\n"; - $table_host_conf .= "\n"; - $table_host_conf .= "

$hostTagShort:

\n"; - $table_host_conf .= "\n"; + $table_host_conf .= "\n"; + $table_host_conf .= "

$hostTagShort:

\n"; + $table_host_conf .= "
\n"; $table_host_conf .= $logString; $table_host_conf .= "
\n"; - $hostString .= "
".$table_host_conf; - ($table_host_conf,$logString) = ("",""); - } + $hostString .= "
".$table_host_conf; + ($table_host_conf,$logString) = ("",""); + } if($HOST_TASK eq "yes" && $taskString ne "") { - $hostTag = "ESX/ESXi Recent Tasks-$cluster_count"; - $hostTagShort = "ESX/ESXi Recent Tasks"; + $hostTag = "ESX/ESXi Recent Tasks-$cluster_count"; + $hostTagShort = "ESX/ESXi Recent Tasks"; - push @host_jump_tags,"            $hostTagShort
\n"; + push @host_jump_tags,"            $hostTagShort
\n"; - $table_host_conf .= "\n"; - $table_host_conf .= "

$hostTagShort:

\n"; - $table_host_conf .= "\n"; - $table_host_conf .= "\n"; + $table_host_conf .= "\n"; + $table_host_conf .= "

$hostTagShort:

\n"; + $table_host_conf .= "
DESCRIPTIONQUEUE TIMESTART TIMECOMPLETION TIMEPROGRESSSTATE
\n"; + $table_host_conf .= "\n"; $table_host_conf .= $taskString; $table_host_conf .= "
DESCRIPTIONQUEUE TIMESTART TIMECOMPLETION TIMEPROGRESSSTATE
\n"; - $hostString .= "
".$table_host_conf; - ($table_host_conf,$numaString) = ("",""); - } + $hostString .= "
".$table_host_conf; + ($table_host_conf,$numaString) = ("",""); + } print REPORT_OUTPUT $hostString; - $hostString = ""; + $hostString = ""; } sub buildVMReport { - my ($cluster_name,$cluster_count,$type,$atype,$aversion) = @_; - my ($hostTag,$hostTagShort,$table_vm_conf) = ("","",""); + my ($cluster_name,$cluster_count,$type,$atype,$aversion) = @_; + my ($hostTag,$hostTagShort,$table_vm_conf) = ("","",""); if($VM_STATE eq "yes" && $vmstateString ne "") { - $hostTag = "VM State-$cluster_count"; - $hostTagShort = "VM State"; - - push @vm_jump_tags,"            $hostTagShort
\n"; - - $table_vm_conf .= "\n"; - $table_vm_conf .= "

$hostTagShort:

\n"; - $table_vm_conf .= "\n"; - - if($aversion eq '4.1.0' || ($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq ' 6.0.0'|| $aversion eq '6.5.0')) { - $table_vm_conf .= "\n"; - } else { - $table_vm_conf .= "\n"; - } - - $table_vm_conf .= $vmstateString; - $table_vm_conf .= "
HOSTVMBOOTTIMEUPTIMENOTESOVERALL STATUSHA PROTECTEDAPP HEARTBEATCONNECTION STATEPOWER STATECONSOLIDATION NEEDED
HOSTVMNOTESBOOTTIMEOVERALL STATUSCONNECTION STATEPOWER STATE
\n"; - $vmString .= "
".$table_vm_conf; - ($table_vm_conf,$vmstateString) = ("",""); - } + $hostTag = "VM State-$cluster_count"; + $hostTagShort = "VM State"; + + push @vm_jump_tags,"            $hostTagShort
\n"; + + $table_vm_conf .= "\n"; + $table_vm_conf .= "

$hostTagShort:

\n"; + $table_vm_conf .= "\n"; + + if($aversion eq '4.1.0' || $aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0') { + $table_vm_conf .= "\n"; + } else { + $table_vm_conf .= "\n"; + } + + $table_vm_conf .= $vmstateString; + $table_vm_conf .= "
HOSTVMBOOTTIMEUPTIMENOTESOVERALL STATUSHA PROTECTEDAPP HEARTBEATCONNECTION STATEPOWER STATECONSOLIDATION NEEDED
HOSTVMNOTESBOOTTIMEOVERALL STATUSCONNECTION STATEPOWER STATE
\n"; + $vmString .= "
".$table_vm_conf; + ($table_vm_conf,$vmstateString) = ("",""); + } if($VM_CONFIG eq "yes" && $vmconfigString ne "") { - $hostTag = "VM Configuration-$cluster_count"; - $hostTagShort = "VM Configuration"; + $hostTag = "VM Configuration-$cluster_count"; + $hostTagShort = "VM Configuration"; - push @vm_jump_tags,"            $hostTagShort
\n"; + push @vm_jump_tags,"            $hostTagShort
\n"; - $table_vm_conf .= "\n"; - $table_vm_conf .= "

$hostTagShort:

\n"; - $table_vm_conf .= "\n"; + $table_vm_conf .= "\n"; + $table_vm_conf .= "

$hostTagShort:

\n"; + $table_vm_conf .= "
\n"; - if($aversion eq '4.1.0' || ($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq ' 6.0.0'|| $aversion eq '6.5.0')) { + if($aversion eq '4.1.0' || $aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0') { $table_vm_conf .= "\n"; } else { $table_vm_conf .= "\n"; @@ -3616,20 +3616,20 @@ sub buildVMReport { $table_vm_conf .= $vmconfigString; $table_vm_conf .= "
HOSTVMvHWHOSTNAMEUUIDFIRMWAREOS# of vCPUvMEM# of vDISKvDISK# of vNICCPU RESERVMEM RESERVIS TEMPLATE
HOSTVMvHWHOSTNAMEUUIDOS# of vCPUvMEM# of vDISKvDISK# of vNICCPU RESERVMEM RESERVIS TEMPLATE
\n"; - $vmString .= "
".$table_vm_conf; - ($table_vm_conf,$vmconfigString) = ("",""); - } + $vmString .= "
".$table_vm_conf; + ($table_vm_conf,$vmconfigString) = ("",""); + } if($VM_STATS eq "yes" && $vmstatString ne "") { $hostTag = "VM Statistics-$cluster_count"; - $hostTagShort = "VM Statistics"; + $hostTagShort = "VM Statistics"; - push @vm_jump_tags,"            $hostTagShort
\n"; + push @vm_jump_tags,"            $hostTagShort
\n"; - $table_vm_conf .= "\n"; - $table_vm_conf .= "

$hostTagShort:

\n"; - $table_vm_conf .= "\n"; + $table_vm_conf .= "\n"; + $table_vm_conf .= "

$hostTagShort:

\n"; + $table_vm_conf .= "
\n"; - if($aversion eq '4.1.0' || ($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq ' 6.0.0'|| $aversion eq '6.5.0')) { + if($aversion eq '4.1.0' || $aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0') { $table_vm_conf .= "\n"; } else { $table_vm_conf .= "\n"; @@ -3637,274 +3637,290 @@ sub buildVMReport { $table_vm_conf .= $vmstatString; $table_vm_conf .= "
HOSTVMCPU USAGEMEM USAGEMAX CPU USAGEMAX MEM USAGEACTIVE MEMHOST CONSUMED MEMINITIAL MEM RESV OVERHEADINITIAL MEM SWAP RESV OVERHEADMEM OVERHEADMEM BALLONCOMPRESSED MEM
HOSTVMCPU USAGEMEM USAGEMAX CPU USAGEMAX MEM USAGEACTIVE MEMHOST CONSUMED MEMMEM OVERHEADMEM BALLON
\n"; - $vmString .= "
".$table_vm_conf; - ($table_vm_conf,$vmstatString) = ("",""); + $vmString .= "
".$table_vm_conf; + ($table_vm_conf,$vmstatString) = ("",""); } if($VM_RESOURCE_ALLOCATION eq "yes" && $vmrscString ne "") { $hostTag = "VM Resource Allocation-$cluster_count"; - $hostTagShort = "VM Resource Allocation"; + $hostTagShort = "VM Resource Allocation"; - push @vm_jump_tags,"            $hostTagShort
\n"; + push @vm_jump_tags,"            $hostTagShort
\n"; - $table_vm_conf .= "\n"; - $table_vm_conf .= "

$hostTagShort:

\n"; - $table_vm_conf .= "\n"; - $table_vm_conf .= "\n"; + $table_vm_conf .= "\n"; + $table_vm_conf .= "

$hostTagShort:

\n"; + $table_vm_conf .= "
HOSTVMLAST MODIFIEDCPU RESERVATIONCPU LIMITSCPU SHARECPU SHARE LEVELCPU EXPANDABLE RESERVATIONCPU OVERHEAD LIMITMEM RESERVATIONMEM LIMITSMEM SHAREMEM SHARE LEVELMEM EXPANDABLE RESERVATIONMEM OVERHEAD LIMIT
\n"; + $table_vm_conf .= "\n"; - $table_vm_conf .= $vmrscString; - $table_vm_conf .= "
HOSTVMLAST MODIFIEDCPU RESERVATIONCPU LIMITSCPU SHARECPU SHARE LEVELCPU EXPANDABLE RESERVATIONCPU OVERHEAD LIMITMEM RESERVATIONMEM LIMITSMEM SHAREMEM SHARE LEVELMEM EXPANDABLE RESERVATIONMEM OVERHEAD LIMIT
\n"; - $vmString .= "
".$table_vm_conf; - ($table_vm_conf,$vmrscString) = ("",""); + $table_vm_conf .= $vmrscString; + $table_vm_conf .= "
\n"; + $vmString .= "
".$table_vm_conf; + ($table_vm_conf,$vmrscString) = ("",""); } if($VM_PERFORMANCE eq "yes" || $vmperformance eq "yes" && $vmPerfString ne "") { $hostTag = "VM Performance-$cluster_count"; - $hostTagShort = "VM Performance"; + $hostTagShort = "VM Performance"; - push @vm_jump_tags,"            $hostTagShort
\n"; + push @vm_jump_tags,"            $hostTagShort
\n"; - $table_vm_conf .= "\n"; - $table_vm_conf .= "

$hostTagShort:

\n"; - $table_vm_conf .= "\n"; - $table_vm_conf .= "
VMcpu.usagemhz.averagecpu.usage.averagecpu.ready.summationmem.active.averagemem.usage.averagecpu.vmmemctl.average\n"; + $table_vm_conf .= "\n"; + $table_vm_conf .= "

$hostTagShort:

\n"; + $table_vm_conf .= "\n"; + $table_vm_conf .= "
VMcpu.usagemhz.averagecpu.usage.averagecpu.ready.summationmem.active.averagemem.usage.averagecpu.vmmemctl.average\n"; $table_vm_conf .= $vmPerfString; $table_vm_conf .= "
\n"; - $vmString .= "
".$table_vm_conf; - ($table_vm_conf,$vmPerfString) = ("",""); + $vmString .= "
".$table_vm_conf; + ($table_vm_conf,$vmPerfString) = ("",""); } if($VM_FT eq "yes" && $vmftString ne "") { $hostTag = "VM Fault Tolerance-$cluster_count"; - $hostTagShort = "VM Fault Tolerance"; + $hostTagShort = "VM Fault Tolerance"; push @vm_jump_tags,"            $hostTagShort
\n"; - $table_vm_conf .= "\n"; - $table_vm_conf .= "

$hostTagShort:

\n"; - $table_vm_conf .= "\n"; + $table_vm_conf .= "\n"; + $table_vm_conf .= "

$hostTagShort:

\n"; + $table_vm_conf .= "
\n"; $table_vm_conf .= "\n"; $table_vm_conf .= $vmftString; $table_vm_conf .= "
HOSTVMFT STATEROLEINSTANCE UUIDSFT SECONDARY LATENCYFT BANDWIDTH
\n"; - $vmString .= "
".$table_vm_conf; - ($table_vm_conf,$vmftString) = ("",""); + $vmString .= "
".$table_vm_conf; + ($table_vm_conf,$vmftString) = ("",""); + } + if($VM_EZT eq "yes" && $vmeztString ne "" && ($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0')) { + $hostTag = "VM Eagerzeroed Thick (EZT) Provisioned-$cluster_count"; + $hostTagShort = "VM Eagerzeroed Thick (EZT) Provisioned"; + + push @vm_jump_tags,"            $hostTagShort
\n"; + + $table_vm_conf .= "\n"; + $table_vm_conf .= "

$hostTagShort:

\n"; + $table_vm_conf .= "\n"; + $table_vm_conf .= "\n"; + + $table_vm_conf .= $vmeztString; + $table_vm_conf .= "
HOSTVMLABELEZT VMDK(s)CAPACITY
\n"; + $vmString .= "
".$table_vm_conf; + ($table_vm_conf,$vmeztString) = ("",""); + } + if($VM_EZT eq "yes" && $vmeztString ne "" && ($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0')) { + $hostTag = "VM Eagerzeroed Thick (EZT) Provisioned-$cluster_count"; + $hostTagShort = "VM Eagerzeroed Thick (EZT) Provisioned"; + + push @vm_jump_tags,"            $hostTagShort
\n"; + + $table_vm_conf .= "\n"; + $table_vm_conf .= "

$hostTagShort:

\n"; + $table_vm_conf .= "\n"; + $table_vm_conf .= "\n"; + + $table_vm_conf .= $vmeztString; + $table_vm_conf .= "
HOSTVMLABELEZT VMDK(s)CAPACITY
\n"; + $vmString .= "
".$table_vm_conf; + ($table_vm_conf,$vmeztString) = ("",""); } - if($VM_EZT eq "yes" && $vmeztString ne "" && ($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq ' 6.0.0'|| $aversion eq '6.5.0')) { - $hostTag = "VM Eagerzeroed Thick (EZT) Provisioned-$cluster_count"; - $hostTagShort = "VM Eagerzeroed Thick (EZT) Provisioned"; - - push @vm_jump_tags,"            $hostTagShort
\n"; - - $table_vm_conf .= "\n"; - $table_vm_conf .= "

$hostTagShort:

\n"; - $table_vm_conf .= "\n"; - $table_vm_conf .= "\n"; - - $table_vm_conf .= $vmeztString; - $table_vm_conf .= "
HOSTVMLABELEZT VMDK(s)CAPACITY
\n"; - $vmString .= "
".$table_vm_conf; - ($table_vm_conf,$vmeztString) = ("",""); - } if($VM_THIN eq "yes" && $vmthinString ne "") { - $hostTag = "VM Thin Provisioned-$cluster_count"; - $hostTagShort = "VM Thin Provisioned"; + $hostTag = "VM Thin Provisioned-$cluster_count"; + $hostTagShort = "VM Thin Provisioned"; - push @vm_jump_tags,"            $hostTagShort
\n"; + push @vm_jump_tags,"            $hostTagShort
\n"; - $table_vm_conf .= "\n"; - $table_vm_conf .= "

$hostTagShort:

\n"; - $table_vm_conf .= "\n"; - $table_vm_conf .= "\n"; + $table_vm_conf .= "\n"; + $table_vm_conf .= "

$hostTagShort:

\n"; + $table_vm_conf .= "
HOSTVMLABELTHIN VMDK(s)CAPACITY
\n"; + $table_vm_conf .= "\n"; $table_vm_conf .= $vmthinString; $table_vm_conf .= "
HOSTVMLABELTHIN VMDK(s)CAPACITY
\n"; - $vmString .= "
".$table_vm_conf; - ($table_vm_conf,$vmthinString) = ("",""); - } + $vmString .= "
".$table_vm_conf; + ($table_vm_conf,$vmthinString) = ("",""); + } if($VM_DEVICE eq "yes" && $vmdeviceString ne "") { - $hostTag = "VM Device(s)-$cluster_count"; - $hostTagShort = "VM Device(s)"; + $hostTag = "VM Device(s)-$cluster_count"; + $hostTagShort = "VM Device(s)"; - push @vm_jump_tags,"            $hostTagShort
\n"; + push @vm_jump_tags,"            $hostTagShort
\n"; - $table_vm_conf .= "\n"; - $table_vm_conf .= "

$hostTagShort:

\n"; - $table_vm_conf .= "\n"; - $table_vm_conf .= "\n"; + $table_vm_conf .= "\n"; + $table_vm_conf .= "

$hostTagShort:

\n"; + $table_vm_conf .= "
HOSTVMOSCDROMCONTROLLERDISKETHERNET CARDFLOPPYKEYBOARDVIDEO CARDVMCIVMIROMPARALLEL PORTPCI PASSTHROUGHPOINTING DEVICESCSI PASSTHROUGHSERIAL PORTSOUND CARDUSB
\n"; + $table_vm_conf .= "\n"; - $table_vm_conf .= $vmdeviceString; - $table_vm_conf .= "
HOSTVMOSCDROMCONTROLLERDISKETHERNET CARDFLOPPYKEYBOARDVIDEO CARDVMCIVMIROMPARALLEL PORTPCI PASSTHROUGHPOINTING DEVICESCSI PASSTHROUGHSERIAL PORTSOUND CARDUSB
\n"; - $vmString .= "
".$table_vm_conf; - ($table_vm_conf,$vmdeviceString) = ("",""); - } + $table_vm_conf .= $vmdeviceString; + $table_vm_conf .= "
\n"; + $vmString .= "
".$table_vm_conf; + ($table_vm_conf,$vmdeviceString) = ("",""); + } if($VM_STORAGE eq "yes" && $vmstorageString ne "") { $hostTag = "VM Storage-$cluster_count"; - $hostTagShort = "VM Storage"; + $hostTagShort = "VM Storage"; - push @vm_jump_tags,"            $hostTagShort
\n"; + push @vm_jump_tags,"            $hostTagShort
\n"; - $table_vm_conf .= "\n"; - $table_vm_conf .= "

$hostTagShort:

\n"; + $table_vm_conf .= "\n"; + $table_vm_conf .= "

$hostTagShort:

\n"; $table_vm_conf .= "
COLOR LEGENDYELLOW < $YELLOW_WARN %ORANGE < $ORANGE_WARN %RED < $RED_WARN %
\n"; - $table_vm_conf .= "\n"; + $table_vm_conf .= "
\n"; $table_vm_conf .= "\n"; $table_vm_conf .= $vmstorageString; $table_vm_conf .= "
HOSTVM
DISK INFOFREE SPACECAPACITY% FREE
\n"; - $vmString .= "
".$table_vm_conf; - ($table_vm_conf,$vmstorageString) = ("",""); - } - if($VM_NETWORK eq "yes" && $vmnetworkString ne "") { + $vmString .= "
".$table_vm_conf; + ($table_vm_conf,$vmstorageString) = ("",""); + } + if($VM_NETWORK eq "yes" && $vmnetworkString ne "") { $hostTag = "VM Network-$cluster_count"; - $hostTagShort = "VM Network"; + $hostTagShort = "VM Network"; - push @vm_jump_tags,"            $hostTagShort
\n"; + push @vm_jump_tags,"            $hostTagShort
\n"; - $table_vm_conf .= "\n"; - $table_vm_conf .= "

$hostTagShort:

\n"; - $table_vm_conf .= "\n"; + $table_vm_conf .= "\n"; + $table_vm_conf .= "

$hostTagShort:

\n"; + $table_vm_conf .= "
\n"; $table_vm_conf .= "\n"; $table_vm_conf .= $vmnetworkString; $table_vm_conf .= "
HOSTVMIP ADDRESS(s)MAC ADDRESS(s)PORTGROUP(s)CONNECTED
\n"; - $vmString .= "
".$table_vm_conf; - ($table_vm_conf,$vmnetworkString) = ("",""); - } + $vmString .= "
".$table_vm_conf; + ($table_vm_conf,$vmnetworkString) = ("",""); + } if($VM_SNAPSHOT eq "yes" && $vmsnapString ne "") { - $hostTag = "VM Snapshots-$cluster_count"; - $hostTagShort = "VM Snapshots"; + $hostTag = "VM Snapshots-$cluster_count"; + $hostTagShort = "VM Snapshots"; - push @vm_jump_tags,"            $hostTagShort
\n"; + push @vm_jump_tags,"            $hostTagShort
\n"; - $table_vm_conf .= "\n"; - $table_vm_conf .= "

$hostTagShort:

\n"; - $table_vm_conf .= "\n"; - $table_vm_conf .= "\n"; + $table_vm_conf .= "\n"; + $table_vm_conf .= "

$hostTagShort:

\n"; + $table_vm_conf .= "
HOSTVMSNAPSHOT NAMESNAPSHOT DESCCREATEDSTATEQUIESCED
\n"; + $table_vm_conf .= "\n"; $table_vm_conf .= $vmsnapString; $table_vm_conf .= "
HOSTVMSNAPSHOT NAMESNAPSHOT DESCCREATEDSTATEQUIESCED
\n"; - $vmString .= "
".$table_vm_conf; - ($table_vm_conf,$vmsnapString) = ("",""); - } + $vmString .= "
".$table_vm_conf; + ($table_vm_conf,$vmsnapString) = ("",""); + } if($VM_DELTA eq "yes" && $vmdeltaString ne "") { $hostTag = "VM Deltas-$cluster_count"; - $hostTagShort = "VM Deltas"; + $hostTagShort = "VM Deltas"; - push @vm_jump_tags,"            $hostTagShort
\n"; + push @vm_jump_tags,"            $hostTagShort
\n"; - $table_vm_conf .= "\n"; - $table_vm_conf .= "

$hostTagShort:

\n"; + $table_vm_conf .= "\n"; + $table_vm_conf .= "

$hostTagShort:

\n"; $table_vm_conf .= "
COLOR LEGENDYELLOW > $SNAPSHOT_YELLOW_WARN daysORANGE > $SNAPSHOT_ORANGE_WARN daysRED > $SNAPSHOT_RED_WARN days
\n"; - $table_vm_conf .= "\n"; + $table_vm_conf .= "
\n"; $table_vm_conf .= "\n"; $table_vm_conf .= $vmdeltaString; $table_vm_conf .= "
DATASTOREVM DELTAAGESIZECREATED
\n"; - $vmString .= "
".$table_vm_conf; - ($table_vm_conf,$vmdeltaString) = ("",""); + $vmString .= "
".$table_vm_conf; + ($table_vm_conf,$vmdeltaString) = ("",""); } if($VM_CDROM eq "yes" && $vmcdString ne "") { - $hostTag = "VM Mounted CD-ROM-$cluster_count"; - $hostTagShort = "VM Mounted CD-ROM"; + $hostTag = "VM Mounted CD-ROM-$cluster_count"; + $hostTagShort = "VM Mounted CD-ROM"; - push @vm_jump_tags,"            $hostTagShort
\n"; + push @vm_jump_tags,"            $hostTagShort
\n"; - $table_vm_conf .= "\n"; - $table_vm_conf .= "

$hostTagShort:

\n"; - $table_vm_conf .= "\n"; - $table_vm_conf .= "\n"; + $table_vm_conf .= "\n"; + $table_vm_conf .= "

$hostTagShort:

\n"; + $table_vm_conf .= "
HOSTVMISO
\n"; + $table_vm_conf .= "\n"; $table_vm_conf .= $vmcdString; $table_vm_conf .= "
HOSTVMISO
\n"; - $vmString .= "
".$table_vm_conf; - ($table_vm_conf,$vmcdString) = ("",""); - } + $vmString .= "
".$table_vm_conf; + ($table_vm_conf,$vmcdString) = ("",""); + } if($VM_FLOPPY eq "yes" && $vmflpString ne "") { - $hostTag = "VM Mounted Floppy-$cluster_count"; - $hostTagShort = "VM Mounted Floppy"; + $hostTag = "VM Mounted Floppy-$cluster_count"; + $hostTagShort = "VM Mounted Floppy"; - push @vm_jump_tags,"            $hostTagShort
\n"; + push @vm_jump_tags,"            $hostTagShort
\n"; - $table_vm_conf .= "\n"; - $table_vm_conf .= "

$hostTagShort:

\n"; - $table_vm_conf .= "\n"; - $table_vm_conf .= "\n"; + $table_vm_conf .= "\n"; + $table_vm_conf .= "

$hostTagShort:

\n"; + $table_vm_conf .= "
HOSTVMIMG
\n"; + $table_vm_conf .= "\n"; $table_vm_conf .= $vmflpString; $table_vm_conf .= "
HOSTVMIMG
\n"; - $vmString .= "
".$table_vm_conf; - ($table_vm_conf,$vmflpString) = ("",""); - } + $vmString .= "
".$table_vm_conf; + ($table_vm_conf,$vmflpString) = ("",""); + } if($VM_TOOL eq "yes" && $vmtoolString) { - $hostTag = "VM VMware Tools-$cluster_count"; - $hostTagShort = "VM VMware Tools"; + $hostTag = "VM VMware Tools-$cluster_count"; + $hostTagShort = "VM VMware Tools"; - push @vm_jump_tags,"            $hostTagShort
\n"; + push @vm_jump_tags,"            $hostTagShort
\n"; - $table_vm_conf .= "\n"; - $table_vm_conf .= "

$hostTagShort:

\n"; - $table_vm_conf .= "\n"; + $table_vm_conf .= "\n"; + $table_vm_conf .= "

$hostTagShort:

\n"; + $table_vm_conf .= "
\n"; $table_vm_conf .= "\n"; $table_vm_conf .= $vmtoolString; $table_vm_conf .= "
HOSTVMVERSIONRUNNING STATUSVERSION STATUSUPGRADE POLICYSYNC TIME W/HOST
\n"; - $vmString .= "
".$table_vm_conf; - ($table_vm_conf,$vmtoolString) = ("",""); + $vmString .= "
".$table_vm_conf; + ($table_vm_conf,$vmtoolString) = ("",""); } if($VM_RDM eq "yes" && $vmrdmString ne "") { - $hostTag = "VM RDMs-$cluster_count"; - $hostTagShort = "VM RDMs"; + $hostTag = "VM RDMs-$cluster_count"; + $hostTagShort = "VM RDMs"; - push @vm_jump_tags,"            $hostTagShort
\n"; + push @vm_jump_tags,"            $hostTagShort
\n"; - $table_vm_conf .= "\n"; - $table_vm_conf .= "

$hostTagShort:

\n"; - $table_vm_conf .= "\n"; - $table_vm_conf .= "\n"; + $table_vm_conf .= "\n"; + $table_vm_conf .= "

$hostTagShort:

\n"; + $table_vm_conf .= "
HOSTVMCOMPAT MODEDEVICEDISK MODELUN UUIDVIRTUAL DISK UUID
\n"; + $table_vm_conf .= "\n"; $table_vm_conf .= $vmrdmString; $table_vm_conf .= "
HOSTVMCOMPAT MODEDEVICEDISK MODELUN UUIDVIRTUAL DISK UUID
\n"; - $vmString .= "
".$table_vm_conf; - ($table_vm_conf,$vmrdmString) = ("",""); - } + $vmString .= "
".$table_vm_conf; + ($table_vm_conf,$vmrdmString) = ("",""); + } if($VM_NPIV eq "yes" && $vmnpivString ne "") { - $hostTag = "VM NPIV-$cluster_count"; - $hostTagShort = "VM NPIV"; + $hostTag = "VM NPIV-$cluster_count"; + $hostTagShort = "VM NPIV"; - push @vm_jump_tags,"            $hostTagShort
\n"; + push @vm_jump_tags,"            $hostTagShort
\n"; - $table_vm_conf .= "\n"; - $table_vm_conf .= "

$hostTagShort:

\n"; - $table_vm_conf .= "\n"; - $table_vm_conf .= "\n"; + $table_vm_conf .= "\n"; + $table_vm_conf .= "

$hostTagShort:

\n"; + $table_vm_conf .= "
HOSTVMNODE WWNPORT WWNGENERATED FROMDESIRED NODE WWNDESIRED PORT WWN
\n"; + $table_vm_conf .= "\n"; - $table_vm_conf .= $vmnpivString; - $table_vm_conf .= "
HOSTVMNODE WWNPORT WWNGENERATED FROMDESIRED NODE WWNDESIRED PORT WWN
\n"; - $vmString .= "
".$table_vm_conf; - ($table_vm_conf,$vmnpivString) = ("",""); - } + $table_vm_conf .= $vmnpivString; + $table_vm_conf .= "\n"; + $vmString .= "
".$table_vm_conf; + ($table_vm_conf,$vmnpivString) = ("",""); + } print REPORT_OUTPUT $vmString; - $vmString = ""; + $vmString = ""; } sub printClusterSummary { my ($local_cluster,$cluster_count,$atype,$aversion) = @_; my $cluster_name = $local_cluster->name; - my $cluster_health = $local_cluster->overallStatus->val; - my $cluster_host_cnt = $local_cluster->summary->numHosts; - my $cluster_avail_host = $local_cluster->summary->numEffectiveHosts; - my $cluster_cpu_cnt = prettyPrintData($local_cluster->summary->totalCpu,'MHZ'); - my $cluster_mem_cnt = prettyPrintData($local_cluster->summary->totalMemory,'B'); - my $cluster_avail_cpu = prettyPrintData($local_cluster->summary->effectiveCpu,'MHZ'); - my $cluster_avail_mem = prettyPrintData($local_cluster->summary->effectiveMemory,'M'); - my $cluster_drs = $local_cluster->configuration->drsConfig->enabled; - my $cluster_ha = $local_cluster->configuration->dasConfig->enabled; - my $cluster_dpm = $local_cluster->configurationEx->dpmConfigInfo->enabled; - my $cluster_vm_mon = $local_cluster->configuration->dasConfig->vmMonitoring; - my $cluster_host_mon = $local_cluster->configuration->dasConfig->hostMonitoring; + my $cluster_health = $local_cluster->overallStatus->val; + my $cluster_host_cnt = $local_cluster->summary->numHosts; + my $cluster_avail_host = $local_cluster->summary->numEffectiveHosts; + my $cluster_cpu_cnt = prettyPrintData($local_cluster->summary->totalCpu,'MHZ'); + my $cluster_mem_cnt = prettyPrintData($local_cluster->summary->totalMemory,'B'); + my $cluster_avail_cpu = prettyPrintData($local_cluster->summary->effectiveCpu,'MHZ'); + my $cluster_avail_mem = prettyPrintData($local_cluster->summary->effectiveMemory,'M'); + my $cluster_drs = $local_cluster->configuration->drsConfig->enabled; + my $cluster_ha = $local_cluster->configuration->dasConfig->enabled; + my $cluster_dpm = $local_cluster->configurationEx->dpmConfigInfo->enabled; + my $cluster_vm_mon = $local_cluster->configuration->dasConfig->vmMonitoring; + my $cluster_host_mon = $local_cluster->configuration->dasConfig->hostMonitoring; my $vmotions = $local_cluster->summary->numVmotions; - my ($mem_perc_string,$cpu_perc_string,$evc,$spbm,$hbDSPolicy) = ("","","DISABLED","N/A","N/A"); + my ($mem_perc_string,$cpu_perc_string,$evc,$spbm,$hbDSPolicy) = ("","","DISABLED","N/A","N/A"); my $curr_bal = ($local_cluster->summary->currentBalance ? ($local_cluster->summary->currentBalance/1000) : "N/A"); my $tar_bal = ($local_cluster->summary->targetBalance ? ($local_cluster->summary->targetBalance/1000) : "N/A"); @@ -3912,7 +3928,7 @@ sub printClusterSummary { $evc = $local_cluster->summary->currentEVCModeKey; } - if(($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq ' 6.0.0'|| $aversion eq '6.5.0')) { + if($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0') { if(defined($local_cluster->configurationEx->spbmEnabled)) { $spbm = $local_cluster->configurationEx->spbmEnabled ? "YES" : "NO"; } @@ -3922,8 +3938,8 @@ sub printClusterSummary { } ########################### - # CLUSTER SUMMARY - ########################### + # CLUSTER SUMMARY + ########################### push @cluster_jump_tags,"CLCluster: $cluster_name
\n"; @@ -3932,15 +3948,15 @@ sub printClusterSummary { my ($hostTag,$hostTagShort) = ("",""); ########################### - # SUMMARY - ########################### - if($CLUSTER_SUMMARY eq "yes") { + # SUMMARY + ########################### + if($CLUSTER_SUMMARY eq "yes") { $hostTag = "Cluster Summary-$cluster_name"; $hostTagShort = "Cluster Summary"; push @cluster_jump_tags,"            $hostTagShort
\n"; - $cluster_start .= "\n"; - $cluster_start .= "

Cluster Summary:

\n"; + $cluster_start .= "\n"; + $cluster_start .= "

Cluster Summary:

\n"; $cluster_start .= "\n"; $cluster_start .= "\n"; @@ -3962,14 +3978,14 @@ sub printClusterSummary { $cluster_start .= ""; if($cluster_health eq 'gray' ) { $cluster_start .= ""; $cluster_start .= ""; $cluster_start .= ""; $cluster_start .= ""; - $cluster_start .= ""; + $cluster_start .= ""; $cluster_start .= ""; $cluster_start .= ""; $cluster_start .= ""; @@ -3990,50 +4006,50 @@ sub printClusterSummary { } ########################### - # PRINT HA INFO - ########################### + # PRINT HA INFO + ########################### if($cluster_ha && $CLUSTER_HA eq "yes") { $hostTag = "HA Configurations-$cluster_name"; - $hostTagShort = "HA Configurations"; + $hostTagShort = "HA Configurations"; - push @cluster_jump_tags,"            $hostTagShort
\n"; + push @cluster_jump_tags,"            $hostTagShort
\n"; - $cluster_start .= "\n"; + $cluster_start .= "\n"; $cluster_start .= "

HA Configurations

\n"; $cluster_start .= "
CLUSTER HEALTHAVAILABLE HOST(s)# OF VMSVM-TO-HOST RATIOCURRENT BALANCETARGET BALANCEAVAILABLE CPUAVAILABLE MEMDRS ENABLEDHA ENABLEDDPM ENABLEDEVC ENABLEDSPBM ENABLED# OF vMOTIONS
UNKNOWN"; } - if($cluster_health eq 'green' ) { $cluster_start .= "CLUSTER OK"; } - if($cluster_health eq 'red' ) { $cluster_start .= "CLUSTER HAS PROBLEM"; } - if($cluster_health eq 'yellow' ) { $cluster_start .= "CLUSTER MIGHT HAVE PROBLEM"; } + if($cluster_health eq 'green' ) { $cluster_start .= "CLUSTER OK"; } + if($cluster_health eq 'red' ) { $cluster_start .= "CLUSTER HAS PROBLEM"; } + if($cluster_health eq 'yellow' ) { $cluster_start .= "CLUSTER MIGHT HAVE PROBLEM"; } $cluster_start .= "".$cluster_avail_host."/".$cluster_host_cnt."".$num_of_vms."".$vm_host_ratio."".$curr_bal."".$tar_bal."".$tar_bal."".$cluster_avail_cpu."".$cluster_avail_mem."".(($cluster_drs) ? "YES" : "NO")."
\n"; $cluster_start .= "\n"; if(defined($local_cluster->configuration->dasConfig->admissionControlPolicy)) { - my $admissionControlPolicy = $local_cluster->configuration->dasConfig->admissionControlPolicy; - if($admissionControlPolicy->isa('ClusterFailoverHostAdmissionControlPolicy')) { - if($admissionControlPolicy->failoverHosts) { - my $failoverHosts = $admissionControlPolicy->failoverHosts; - my $failoverHostString = ""; - foreach(@$failoverHosts) { - my $fhost = Vim::get_view(mo_ref => $_, properties => ['name']); - $failoverHostString .= $fhost->{'name'} . "
"; - } - $cluster_start .= ""; - } else { - $cluster_start .= ""; - } - }elsif($admissionControlPolicy->isa('ClusterFailoverLevelAdmissionControlPolicy')) { - $cluster_start .= ""; - }elsif($admissionControlPolicy->isa('ClusterFailoverResourcesAdmissionControlPolicy')) { - $cluster_start .= ""; - } else { - $cluster_start .= ""; - } - } else { - $cluster_start .= ""; - } - $cluster_start .= ""; - $cluster_start .= ""; - $cluster_start .= ""; - $cluster_start .= ""; - $cluster_start .= ""; + my $admissionControlPolicy = $local_cluster->configuration->dasConfig->admissionControlPolicy; + if($admissionControlPolicy->isa('ClusterFailoverHostAdmissionControlPolicy')) { + if($admissionControlPolicy->failoverHosts) { + my $failoverHosts = $admissionControlPolicy->failoverHosts; + my $failoverHostString = ""; + foreach(@$failoverHosts) { + my $fhost = Vim::get_view(mo_ref => $_, properties => ['name']); + $failoverHostString .= $fhost->{'name'} . "
"; + } + $cluster_start .= ""; + } else { + $cluster_start .= ""; + } + }elsif($admissionControlPolicy->isa('ClusterFailoverLevelAdmissionControlPolicy')) { + $cluster_start .= ""; + }elsif($admissionControlPolicy->isa('ClusterFailoverResourcesAdmissionControlPolicy')) { + $cluster_start .= ""; + } else { + $cluster_start .= ""; + } + } else { + $cluster_start .= ""; + } + $cluster_start .= ""; + $cluster_start .= ""; + $cluster_start .= ""; + $cluster_start .= ""; + $cluster_start .= ""; $cluster_start .= ""; - $cluster_start .= "
FAILOVER LEVELADMISSION CONTROL ENABLEDISOLATION RESPONSERESTART PRIORITYVM MONITORINGHOST MONITORINGHB DATASTORE POLICY
".$failoverHostString."N/A".$admissionControlPolicy->failoverLevel."".$admissionControlPolicy->cpuFailoverResourcesPercent."% CPU -- ".$admissionControlPolicy->memoryFailoverResourcesPercent." %MEM "."N/AN/A".(($local_cluster->configuration->dasConfig->admissionControlEnabled) ? "YES" : "NO")."".$local_cluster->configuration->dasConfig->defaultVmSettings->isolationResponse."".$local_cluster->configuration->dasConfig->defaultVmSettings->restartPriority."".$cluster_vm_mon."".$cluster_host_mon."".$failoverHostString."N/A".$admissionControlPolicy->failoverLevel."".$admissionControlPolicy->cpuFailoverResourcesPercent."% CPU -- ".$admissionControlPolicy->memoryFailoverResourcesPercent." %MEM "."N/AN/A".(($local_cluster->configuration->dasConfig->admissionControlEnabled) ? "YES" : "NO")."".$local_cluster->configuration->dasConfig->defaultVmSettings->isolationResponse."".$local_cluster->configuration->dasConfig->defaultVmSettings->restartPriority."".$cluster_vm_mon."".$cluster_host_mon."".$hbDSPolicy."
\n"; + $cluster_start .= "\n"; my $haAdvInfo; eval { $haAdvInfo = $local_cluster->RetrieveDasAdvancedRuntimeInfo(); }; @@ -4047,50 +4063,50 @@ sub printClusterSummary { $cluster_start .= "SLOT SIZETOTAL SLOTS IN CLUSTERUSED SLOTSAVAILABLE SLOTSTOTAL POWERED ON VMSTOTAL HOSTSTOTAL GOOD HOSTS\n"; if($haAdvInfo->isa('ClusterDasFailoverLevelAdvancedRuntimeInfo')) { - $cluster_start .= "".($haAdvInfo->slotInfo->cpuMHz ? $haAdvInfo->slotInfo->cpuMHz : "N/A"). " MHz -- ".($haAdvInfo->slotInfo->numVcpus ? $haAdvInfo->slotInfo->numVcpus : "N/A"). " vCPUs -- ".($haAdvInfo->slotInfo->memoryMB ? $haAdvInfo->slotInfo->memoryMB : "N/A")." MB"; - $cluster_start .= "".$haAdvInfo->totalSlots.""; - $cluster_start .= "".$haAdvInfo->usedSlots.""; - $cluster_start .= "".$haAdvInfo->unreservedSlots.""; - $cluster_start .= "".$haAdvInfo->totalVms.""; - $cluster_start .= "".$haAdvInfo->totalHosts.""; - $cluster_start .= "".$haAdvInfo->totalGoodHosts.""; - } else { - $cluster_start .= "N/A"; - $cluster_start .= "N/A"; - $cluster_start .= "N/A"; - $cluster_start .= "N/A"; - $cluster_start .= "N/A"; - $cluster_start .= "N/A"; - $cluster_start .= "N/A"; - } - $cluster_start .= "\n"; + $cluster_start .= "".($haAdvInfo->slotInfo->cpuMHz ? $haAdvInfo->slotInfo->cpuMHz : "N/A"). " MHz -- ".($haAdvInfo->slotInfo->numVcpus ? $haAdvInfo->slotInfo->numVcpus : "N/A"). " vCPUs -- ".($haAdvInfo->slotInfo->memoryMB ? $haAdvInfo->slotInfo->memoryMB : "N/A")." MB"; + $cluster_start .= "".$haAdvInfo->totalSlots.""; + $cluster_start .= "".$haAdvInfo->usedSlots.""; + $cluster_start .= "".$haAdvInfo->unreservedSlots.""; + $cluster_start .= "".$haAdvInfo->totalVms.""; + $cluster_start .= "".$haAdvInfo->totalHosts.""; + $cluster_start .= "".$haAdvInfo->totalGoodHosts.""; + } else { + $cluster_start .= "N/A"; + $cluster_start .= "N/A"; + $cluster_start .= "N/A"; + $cluster_start .= "N/A"; + $cluster_start .= "N/A"; + $cluster_start .= "N/A"; + $cluster_start .= "N/A"; + } + $cluster_start .= "\n"; ## HA HEARTBEAT DATASTORE ## - if(($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq ' 6.0.0'|| $aversion eq '6.5.0') && $haAdvInfo->heartbeatDatastoreInfo) { + if(($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0') && $haAdvInfo->heartbeatDatastoreInfo) { my $hahbInfo = $haAdvInfo->heartbeatDatastoreInfo; $hostTag = "Heartbeat Datastores-$cluster_name"; - $hostTagShort = "Heartbeat Datastores"; + $hostTagShort = "Heartbeat Datastores"; - push @cluster_jump_tags,"            $hostTagShort
\n"; + push @cluster_jump_tags,"            $hostTagShort
\n"; - $cluster_start .= "\n"; - $cluster_start .= "

Heartbeat Datastores

\n"; - $cluster_start .= "\n"; - $cluster_start .= "\n"; + $cluster_start .= "\n"; + $cluster_start .= "

Heartbeat Datastores

\n"; + $cluster_start .= "
DATASTOREHOSTS MOUNTED
\n"; + $cluster_start .= "\n"; - foreach(@$hahbInfo) { - my $hbDSName = Vim::get_view(mo_ref => $_->datastore, properties => ['name']); - my $hbHostMount = Vim::get_views(mo_ref_array=> $_->hosts, properties => ['name']); + foreach(@$hahbInfo) { + my $hbDSName = Vim::get_view(mo_ref => $_->datastore, properties => ['name']); + my $hbHostMount = Vim::get_views(mo_ref_array=> $_->hosts, properties => ['name']); $cluster_start .= ""; - } - $cluster_start .= "
DATASTOREHOSTS MOUNTED
".$hbDSName->{'name'}."".@$hbHostMount."
\n"; + } + $cluster_start .= "\n"; } ## HA HOSTS INFO ## if($haAdvInfo->dasHostInfo && $haAdvInfo->dasHostInfo->hostDasState) { $cluster_start .= "

HA Host Info

\n"; - $cluster_start .= "\n"; + $cluster_start .= "
\n"; $cluster_start .= "\n"; my ($nodeStates,$primHosts,$secondHosts,$dasstring) = ("","","",""); @@ -4142,21 +4158,21 @@ sub printClusterSummary { $cluster_start .= "
HA PRIMARY HOSTSHA SECONDARY HOSTSNODE STATES
\n"; %primary = (); - } + } - if($local_cluster->configIssue) { - my $clusterConfigIssues = $local_cluster->configIssue; - foreach(@$clusterConfigIssues) { - my $issue = $local_cluster->name . ";" . ($_->fullFormattedMessage ? $_->fullFormattedMessage : "N/A"); - push @configIssues, $issue; - } - } + if($local_cluster->configIssue) { + my $clusterConfigIssues = $local_cluster->configIssue; + foreach(@$clusterConfigIssues) { + my $issue = $local_cluster->name . ";" . ($_->fullFormattedMessage ? $_->fullFormattedMessage : "N/A"); + push @configIssues, $issue; + } + } ## HA CONFIGURATION ISSUE## if(@configIssues) { $cluster_start .= "

HA Configuration Issues

\n"; - $cluster_start .= "\n"; - $cluster_start .= "\n"; + $cluster_start .= "
ENTITYHA ISSUE
\n"; + $cluster_start .= "\n"; foreach(@configIssues) { my ($configIssueEntity,$configIssueMsg) = split(';',$_); @@ -4168,8 +4184,8 @@ sub printClusterSummary { ## HA ADV OPTIONS ## if($local_cluster->configurationEx->dasConfig->option) { $cluster_start .= "

HA Advanced Configurations

\n"; - $cluster_start .= "
ENTITYHA ISSUE
\n"; - $cluster_start .= "\n"; + $cluster_start .= "
ATTRIBUTEVALUE
\n"; + $cluster_start .= "\n"; my $haadv_string = ""; @@ -4186,15 +4202,15 @@ sub printClusterSummary { } ########################### - # PRINT DRS INFO - ########################### - if($cluster_drs && $CLUSTER_DRS eq "yes") { + # PRINT DRS INFO + ########################### + if($cluster_drs && $CLUSTER_DRS eq "yes") { $hostTag = "DRS Configurations-$cluster_name"; - $hostTagShort = "DRS Configurations"; + $hostTagShort = "DRS Configurations"; - push @cluster_jump_tags,"            $hostTagShort
\n"; + push @cluster_jump_tags,"            $hostTagShort
\n"; - $cluster_start .= "\n"; + $cluster_start .= "\n"; $cluster_start .= "

DRS Configurations

\n"; $cluster_start .= "
ATTRIBUTEVALUE
\n"; $cluster_start .= "\n"; @@ -4204,34 +4220,34 @@ sub printClusterSummary { $cluster_start .= "
DRS BEHAVIORVMOTION RATE
\n"; ## DRS ADV OPTIONS ## - if($local_cluster->configurationEx->drsConfig->option) { - $cluster_start .= "

DRS Advanced Configurations

\n"; - $cluster_start .= "\n"; - $cluster_start .= "\n"; - - my $drsadv_string = ""; - - my $advHAOptions = $local_cluster->configurationEx->drsConfig->option; - foreach(@$advHAOptions) { - $drsadv_string .= "\n"; - } - $cluster_start .= $drsadv_string; - $cluster_start .= "
ATTRIBUTEVALUE
".$_->key."".$_->value."
\n"; - } + if($local_cluster->configurationEx->drsConfig->option) { + $cluster_start .= "

DRS Advanced Configurations

\n"; + $cluster_start .= "\n"; + $cluster_start .= "\n"; + + my $drsadv_string = ""; + + my $advHAOptions = $local_cluster->configurationEx->drsConfig->option; + foreach(@$advHAOptions) { + $drsadv_string .= "\n"; + } + $cluster_start .= $drsadv_string; + $cluster_start .= "
ATTRIBUTEVALUE
".$_->key."".$_->value."
\n"; + } } ########################### - # PRINT DPM INFO - ########################### - if($cluster_dpm && $CLUSTER_DPM eq "yes") { + # PRINT DPM INFO + ########################### + if($cluster_dpm && $CLUSTER_DPM eq "yes") { $hostTag = "DPM Configurations-$cluster_name"; - $hostTagShort = "DPM Configurations"; + $hostTagShort = "DPM Configurations"; - push @cluster_jump_tags,"            $hostTagShort
\n"; + push @cluster_jump_tags,"            $hostTagShort
\n"; - $cluster_start .= "\n"; + $cluster_start .= "\n"; $cluster_start .= "

DPM Configurations

\n"; - $cluster_start .= "\n"; + $cluster_start .= "
\n"; $cluster_start .= "\n"; $cluster_start .= ""; @@ -4246,14 +4262,14 @@ sub printClusterSummary { my $rules = $local_cluster->configurationEx->rule; $hostTag = "Affinity Rules-$cluster_name"; - $hostTagShort = "Affinity Rules"; + $hostTagShort = "Affinity Rules"; - push @cluster_jump_tags,"            $hostTagShort
\n"; + push @cluster_jump_tags,"            $hostTagShort
\n"; - $cluster_start .= "\n"; + $cluster_start .= "\n"; $cluster_start .= "

Affinity Rules:

\n"; $cluster_start .= "
DPM BEHAVIOR
".$local_cluster->configurationEx->dpmConfigInfo->defaultDpmBehavior->val."
\n"; - if($aversion eq '4.1.0' || ($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq ' 6.0.0'|| $aversion eq '6.5.0')) { + if($aversion eq '4.1.0' || $aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0') { $cluster_start .= "\n"; } else { $cluster_start .= "\n"; @@ -4261,12 +4277,12 @@ sub printClusterSummary { foreach(sort {$a->name cmp $b->name} @$rules) { my $rule = $_; - my $is_enabled = $rule->enabled; - my $rule_name = $rule->name; - my $rule_type = "CLUSTER-RULE"; + my $is_enabled = $rule->enabled; + my $rule_name = $rule->name; + my $rule_type = "CLUSTER-RULE"; my $compliant; - if($aversion eq '4.1.0' || ($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq ' 6.0.0'|| $aversion eq '6.5.0')) { + if($aversion eq '4.1.0' || $aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0') { if($rule->inCompliance) { $compliant = ""; } else { @@ -4274,18 +4290,18 @@ sub printClusterSummary { } } - if(ref($rule) eq 'ClusterAffinityRuleSpec') { - $rule_type = "AFFINITY"; - } - elsif (ref($rule) eq 'ClusterAntiAffinityRuleSpec') { - $rule_type = "ANTI-AFFINITY"; - } + if(ref($rule) eq 'ClusterAffinityRuleSpec') { + $rule_type = "AFFINITY"; + } + elsif (ref($rule) eq 'ClusterAntiAffinityRuleSpec') { + $rule_type = "ANTI-AFFINITY"; + } my $listOfVMs = Vim::get_views(mo_ref_array => $_->{'vm'}, properties => ['name']); my $listOfVmsString = ""; foreach(@$listOfVMs) { $listOfVmsString .= $_->{'name'}."
"; } - if($aversion eq '4.1.0' || ($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq ' 6.0.0'|| $aversion eq '6.5.0')) { + if($aversion eq '4.1.0' || $aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0') { $cluster_start .= "".$compliant."\n"; } else { $cluster_start .= "\n"; @@ -4296,19 +4312,19 @@ sub printClusterSummary { } ########################### - # AFFINITY GROUP RULES - ########################### - if($CLUSTER_GROUP eq "yes" && $aversion eq '4.1.0' || ($aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq ' 6.0.0'|| $aversion eq '6.5.0')) { + # AFFINITY GROUP RULES + ########################### + if($CLUSTER_GROUP eq "yes" && ($aversion eq '4.1.0' || $aversion eq '5.0.0' || $aversion eq '5.1.0' || $aversion eq '5.5.0' || $aversion eq '6.0.0' || $aversion eq '6.5.0')) { if($local_cluster->configurationEx->group) { - my $groups = $local_cluster->configurationEx->group; + my $groups = $local_cluster->configurationEx->group; - $hostTag = "Affinity Group Rules-$cluster_name"; - $hostTagShort = "Affinity Group Rules"; + $hostTag = "Affinity Group Rules-$cluster_name"; + $hostTagShort = "Affinity Group Rules"; - push @cluster_jump_tags,"            $hostTagShort
\n"; + push @cluster_jump_tags,"            $hostTagShort
\n"; - $cluster_start .= "\n"; - $cluster_start .= "

Affinity Group Rules:

\n"; + $cluster_start .= "\n"; + $cluster_start .= "

Affinity Group Rules:

\n"; my ($drsHostsGroupString,$drsVMGroupString) = ("",""); foreach(sort {$a->name cmp $b->name} @$groups) { @@ -4316,15 +4332,15 @@ sub printClusterSummary { my $listOfHosts = Vim::get_views(mo_ref_array => $_->host, properties => ['name']); my $listOfHostsString = ""; foreach(@$listOfHosts) { - $listOfHostsString .= $_->{'name'}."
"; - } + $listOfHostsString .= $_->{'name'}."
"; + } $drsHostsGroupString .= "\n"; }elsif($_->isa('ClusterVmGroup')) { my $listOfVms = Vim::get_views(mo_ref_array => $_->vm, properties => ['name']); - my $listOfVmsString = ""; - foreach(@$listOfVms) { - $listOfVmsString .= $_->{'name'}."
"; - } + my $listOfVmsString = ""; + foreach(@$listOfVms) { + $listOfVmsString .= $_->{'name'}."
"; + } $drsVMGroupString .= "\n"; } } @@ -4339,12 +4355,12 @@ sub printClusterSummary { #VM GROUP if($drsVMGroupString ne "") { - $cluster_start .= "
RULE NAMERULE TYPEENABLEDVM(s)COMPLIANTMANDATORYUSER CREATED
RULE NAMERULE TYPEENABLEDVM(s)
YES
".$rule_name."".$rule_type."".(($is_enabled) ? "YES" : "NO")."".$listOfVmsString."".($rule->mandatory ? "YES" : "NO")."".($rule->userCreated ? "YES" : "NO")."
".$rule_name."".$rule_type."".(($is_enabled) ? "YES" : "NO")."".$listOfVmsString."
".$_->name."".$listOfHostsString."
".$_->name."".$listOfVmsString."
\n"; - $cluster_start .= "\n"; + $cluster_start .= "
RULE NAMEVM(s)
\n"; + $cluster_start .= "\n"; $cluster_start .= $drsVMGroupString; - $cluster_start .= "
RULE NAMEVM(s)

\n"; + $cluster_start .= "
\n"; } - } + } } @@ -4361,34 +4377,34 @@ sub printClusterSummary { my $rp = Vim::get_view(mo_ref => $_); if($rp->isa('VirtualApp')) { - my $vapp_name = $rp->name; - my $anno = ($rp->vAppConfig->annotation ? $rp->vAppConfig->annotation : "N/A"); - - my $ec = $rp->vAppConfig->entityConfig; - my $vm_vapp_string = ""; - foreach(@$ec) { - my $order = $_->startOrder; - my $tag = $_->tag; - $vm_vapp_string .= "".$tag."".$order."\n"; - } - $vapp_string .= "".$vapp_name."\n"; - $vapp_string .= "VMSTART ORDER\n"; - $vapp_string .= $vm_vapp_string."\n"; - } else { - my $rp_name = $rp->name; - my $rp_status = $rp->summary->runtime->overallStatus->val; - if($rp_status eq 'gray') { $rp_status = "UNKNOWN"; } - elsif($rp_status eq 'green') { $rp_status = "GREEN"; } - elsif($rp_status eq 'red') { $rp_status = "RED"; } - elsif($rp_status eq 'yellow') { $rp_status = "YELLOW"; } - my $rp_cpu_use = prettyPrintData($rp->summary->runtime->cpu->overallUsage,'MHZ'); - my $rp_cpu_max = prettyPrintData($rp->summary->runtime->cpu->maxUsage,'MHZ'); - my $rp_cpu_lim = prettyPrintData($rp->summary->config->cpuAllocation->limit,'MHZ'); - my $rp_cpu_rsv = prettyPrintData($rp->summary->config->cpuAllocation->reservation,'MHZ'); - my $rp_mem_use = prettyPrintData($rp->summary->runtime->memory->overallUsage,'B'); - my $rp_mem_max = prettyPrintData($rp->summary->runtime->memory->maxUsage,'B'); - my $rp_mem_lim = prettyPrintData($rp->summary->config->cpuAllocation->limit,'M'); - my $rp_mem_rsv = prettyPrintData($rp->summary->config->cpuAllocation->reservation,'M'); + my $vapp_name = $rp->name; + my $anno = ($rp->vAppConfig->annotation ? $rp->vAppConfig->annotation : "N/A"); + + my $ec = $rp->vAppConfig->entityConfig; + my $vm_vapp_string = ""; + foreach(@$ec) { + my $order = $_->startOrder; + my $tag = $_->tag; + $vm_vapp_string .= "".$tag."".$order."\n"; + } + $vapp_string .= "".$vapp_name."\n"; + $vapp_string .= "VMSTART ORDER\n"; + $vapp_string .= $vm_vapp_string."\n"; + } else { + my $rp_name = $rp->name; + my $rp_status = $rp->summary->runtime->overallStatus->val; + if($rp_status eq 'gray') { $rp_status = "UNKNOWN"; } + elsif($rp_status eq 'green') { $rp_status = "GREEN"; } + elsif($rp_status eq 'red') { $rp_status = "RED"; } + elsif($rp_status eq 'yellow') { $rp_status = "YELLOW"; } + my $rp_cpu_use = prettyPrintData($rp->summary->runtime->cpu->overallUsage,'MHZ'); + my $rp_cpu_max = prettyPrintData($rp->summary->runtime->cpu->maxUsage,'MHZ'); + my $rp_cpu_lim = prettyPrintData($rp->summary->config->cpuAllocation->limit,'MHZ'); + my $rp_cpu_rsv = prettyPrintData($rp->summary->config->cpuAllocation->reservation,'MHZ'); + my $rp_mem_use = prettyPrintData($rp->summary->runtime->memory->overallUsage,'B'); + my $rp_mem_max = prettyPrintData($rp->summary->runtime->memory->maxUsage,'B'); + my $rp_mem_lim = prettyPrintData($rp->summary->config->cpuAllocation->limit,'M'); + my $rp_mem_rsv = prettyPrintData($rp->summary->config->cpuAllocation->reservation,'M'); my ($rp_cpu_shares,$rp_mem_shares) = ("N/A","N/A"); if($rp->summary->config->cpuAllocation) { $rp_cpu_shares = ($rp->summary->config->cpuAllocation->shares->shares ? $rp->summary->config->cpuAllocation->shares->shares : "N/A"); @@ -4410,9 +4426,9 @@ sub printClusterSummary { } if($vmInRp != 0 && $rp_mem_shares ne "N/A") { $memUnitsPerVM = floor($rp_mem_shares/$vmInRp); - } + } - $resource_pool_string .= "".$rp_name.""; + $resource_pool_string .= "".$rp_name.""; $resource_pool_string .= $rp_status; $resource_pool_string .= "".$vmInRp.""; $resource_pool_string .= "".$rp_cpu_shares.""; @@ -4427,18 +4443,18 @@ sub printClusterSummary { $resource_pool_string .= "".$rp_cpu_max.""; $resource_pool_string .= "".$rp_mem_use.""; $resource_pool_string .= "".$rp_mem_max."\n"; - } + } } } if($CLUSTER_RP eq "yes") { if($resource_pool_string ne "") { $hostTag = "Resource Pool(s)-$cluster_name"; - $hostTagShort = "Resource Pool(s)"; + $hostTagShort = "Resource Pool(s)"; - push @cluster_jump_tags,"            $hostTagShort
\n"; + push @cluster_jump_tags,"            $hostTagShort
\n"; - $cluster_start .= "\n"; + $cluster_start .= "\n"; $cluster_start .= "

Resource Pool(s):

\n"; $cluster_start .= "\n"; $cluster_start .= "\n"; @@ -4454,13 +4470,13 @@ sub printClusterSummary { if($CLUSTER_VAPP eq "yes") { if($vapp_string ne "") { $hostTag = "vApp(s)-$cluster_name"; - $hostTagShort = "vApp(s)"; + $hostTagShort = "vApp(s)"; - push @cluster_jump_tags,"            $hostTagShort
\n"; + push @cluster_jump_tags,"            $hostTagShort
\n"; - $cluster_start .= "\n"; + $cluster_start .= "\n"; $cluster_start .= "

vApp(s):

\n"; - $cluster_start .= "
POOL NAMESTATUS# of VM(s)CPU SHARESCPU UNITS PER/VMMEM SHARESMEM UNITS PER/VMCPU LIMITCPU RESERVATIONMEM LIMITMEM RESERVATIONCPU USAGECPU MAXMEM USAGEMEM MAX
\n"; + $cluster_start .= "
\n"; $cluster_start .= $vapp_string; $cluster_start .= "
\n"; @@ -4512,11 +4528,11 @@ sub printClusterSummary { } } - print REPORT_OUTPUT "
".$cluster_start; + print REPORT_OUTPUT "
".$cluster_start; } sub printDatacenterSummary { - my ($local_datacenter,$dc_count,$atype,$aversion) = @_; + my ($local_datacenter,$dc_count,$atype,$aversion) = @_; my $datacenter_name = $local_datacenter->name; @@ -4552,16 +4568,17 @@ sub printDatacenterSummary { if(defined($pod->summary)) { my @podDatastores = (); my ($podDSCount,$podVMCount) = (0,0); - foreach my $ds ( @{$pod->childEntity} ) { - my $child_view = Vim::get_view(mo_ref => $ds); + # If a pod has no datastores, childEntity will be undef, so force an empty array. + foreach my $ds ( defined($pod->childEntity) ? @{$pod->childEntity} : () ) { + my $child_view = Vim::get_view(mo_ref => $ds); - if($child_view->isa("Datastore")) { - push @podDatastores, $child_view; + if($child_view->isa("Datastore")) { + push @podDatastores, $child_view; my $vmsperds = Vim::get_views(mo_ref_array => $child_view->vm, properties => ['name']); $podVMCount += @$vmsperds; $podDSCount++; - } - } + } + } # find the largest datastore my $largestDatastoreSize = 0; @@ -4584,11 +4601,11 @@ sub printDatacenterSummary { ############### if($DATASTORE_CLUSTER_POD_CONFIG eq "yes" && @$storagePods gt 0) { $hostTag = "Datastore Cluster Pod Config-$datacenter_name"; - $hostTagShort = "Datastore Cluster Pod Config"; - push @datastore_cluster_jump_tags,"            $hostTagShort
\n"; - $datacenter_start .= "\n"; - $datacenter_start .= "

Datastore Cluster Pod Config:

\n"; - $datacenter_start .= "\n"; + $hostTagShort = "Datastore Cluster Pod Config"; + push @datastore_cluster_jump_tags,"            $hostTagShort
\n"; + $datacenter_start .= "\n"; + $datacenter_start .= "

Datastore Cluster Pod Config:

\n"; + $datacenter_start .= "
\n"; $datacenter_start .= "\n"; foreach my $pod (@$storagePods) { @@ -4631,16 +4648,16 @@ sub printDatacenterSummary { # POD ADV OPTIONS ################## if($DATASTORE_CLUSTER_POD_ADV_CONFIG eq "yes" && @$storagePods gt 0) { - $hostTag = "Datastore Cluster Pod Advanced Configurations-$datacenter_name"; - $hostTagShort = "Datastore Cluster Pod Advanced Configurations"; - push @datastore_cluster_jump_tags,"            $hostTagShort
\n"; - $datacenter_start .= "\n"; - $datacenter_start .= "

Datastore Cluster Pod Advanced Configurations:

\n"; - $datacenter_start .= "
STORAGE POD NAMESDRS ENABLEDIO BALANCE ENABLEDIO BALANCE LATENCY THRESHOLDIO LOAD BALANCE THRESHOLDIO BALANCE INTERVALLOAD BALANCE SPACE UTILIZATION DIFFERENCESPACE UTILIZATION THRESHOLDENABLE INTRA-VM AFFINITYDEFAULT VM BEHAVIOR
\n"; - $datacenter_start .= "\n"; + $hostTag = "Datastore Cluster Pod Advanced Configurations-$datacenter_name"; + $hostTagShort = "Datastore Cluster Pod Advanced Configurations"; + push @datastore_cluster_jump_tags,"            $hostTagShort
\n"; + $datacenter_start .= "\n"; + $datacenter_start .= "

Datastore Cluster Pod Advanced Configurations:

\n"; + $datacenter_start .= "
STORAGE POD NAMEADVANCED CONFIGURATIONS
\n"; + $datacenter_start .= "\n"; foreach my $pod (@$storagePods) { - if(defined($pod->podStorageDrsEntry)) { + if(defined($pod->podStorageDrsEntry)) { my $podConfig = $pod->podStorageDrsEntry->storageDrsConfig->podConfig; if($podConfig->option) { my $podrules_string = ""; @@ -4658,35 +4675,36 @@ sub printDatacenterSummary { } ################## - # POD STORAGE - ################## + # POD STORAGE + ################## if($DATASTORE_CLUSTER_POD_STORAGE eq "yes" && @$storagePods gt 0) { $hostTag = "Datastore Cluster Pod Storage-$datacenter_name"; - $hostTagShort = "Datastore Cluster Pod Storage"; - push @datastore_cluster_jump_tags,"            $hostTagShort
\n"; - $datacenter_start .= "\n"; - $datacenter_start .= "

Datastore Cluster Pod Storage:

\n"; - $datacenter_start .= "
STORAGE POD NAMEADVANCED CONFIGURATIONS
\n"; - $datacenter_start .= "\n"; + $hostTagShort = "Datastore Cluster Pod Storage"; + push @datastore_cluster_jump_tags,"            $hostTagShort
\n"; + $datacenter_start .= "\n"; + $datacenter_start .= "

Datastore Cluster Pod Storage:

\n"; + $datacenter_start .= "
STORAGE POD NAMEDATASTORESMAINTENANCE MODE
\n"; + $datacenter_start .= "\n"; foreach my $pod (@$storagePods) { - if(defined($pod->summary)) { + if(defined($pod->summary)) { my @podDatastores = (); - my $podDSCount = 0; - foreach my $ds ( @{$pod->childEntity} ) { - my $child_view = Vim::get_view(mo_ref => $ds, properties => ['name','summary.maintenanceMode']); + my $podDSCount = 0; + # If a pod has no datastores, childEntity will be undef, so force an empty array. + foreach my $ds ( defined($pod->childEntity) ? @{$pod->childEntity} : () ) { + my $child_view = Vim::get_view(mo_ref => $ds, properties => ['name','summary.maintenanceMode']); - if($child_view->isa("Datastore")) { - push @podDatastores, $child_view; - } - } + if($child_view->isa("Datastore")) { + push @podDatastores, $child_view; + } + } my ($podDSString,$podDSMMString) = ("",""); - foreach(@podDatastores) { + foreach(@podDatastores) { $podDSString .= $_->{'name'} . "
"; $podDSMMString .= $_->{'summary.maintenanceMode'} . "
"; - } - $datacenter_start .= "\n"; + } + $datacenter_start .= "\n"; } } $datacenter_start .= "
STORAGE POD NAMEDATASTORESMAINTENANCE MODE
" . $pod->name . "" . $podDSString . "" . $podDSMMString . "
" . $pod->name . "" . $podDSString . "" . $podDSMMString . "
\n"; @@ -4697,12 +4715,12 @@ sub printDatacenterSummary { ############## if($DVS_SUMMARY eq "yes" && @$dvs gt 0) { $hostTag = "DVS Summary-$datacenter_name"; - $hostTagShort = "DVS Summary"; - push @datastore_cluster_jump_tags,"            $hostTagShort
\n"; - $datacenter_start .= "\n"; - $datacenter_start .= "

DVS Summary:

\n"; - $datacenter_start .= "\n"; - $datacenter_start .= "\n"; + $hostTagShort = "DVS Summary"; + push @datastore_cluster_jump_tags,"            $hostTagShort
\n"; + $datacenter_start .= "\n"; + $datacenter_start .= "

DVS Summary:

\n"; + $datacenter_start .= "
DVS NAME# OF PORTSVENDORVERSIONBUILDUUID
\n"; + $datacenter_start .= "\n"; foreach my $dvSwitch (@$dvs) { $datacenter_start .= ""; @@ -4721,12 +4739,12 @@ sub printDatacenterSummary { ################# if($DVS_CAPABILITY && @$dvs gt 0) { $hostTag = "DVS Capability-$datacenter_name"; - $hostTagShort = "DVS Capability"; - push @datastore_cluster_jump_tags,"            $hostTagShort
\n"; - $datacenter_start .= "\n"; - $datacenter_start .= "

DVS Capability:

\n"; - $datacenter_start .= "
DVS NAME# OF PORTSVENDORVERSIONBUILDUUID
\n"; - $datacenter_start .= ""; + $hostTagShort = "DVS Capability"; + push @datastore_cluster_jump_tags,"            $hostTagShort
\n"; + $datacenter_start .= "\n"; + $datacenter_start .= "

DVS Capability:

\n"; + $datacenter_start .= "
DVS NAMENIOC SUPPORTQOS SUPPORTDIRECT PATH GEN2 SUPPORTDEFINE NETWORK RSC POOLS SUPPORTNETWORK RSC POOL HIGH SHARE VALNIC TEAMING POLICY
\n"; + $datacenter_start .= ""; my ($niocSup,$qosSup,$defNetRscPoolSup,$netRscPoolShareVal,$dp2Sup,$nicTeam) = ("N/A","N/A","N/A","N/A","N/A","N/A",); @@ -4753,21 +4771,21 @@ sub printDatacenterSummary { $datacenter_start .= "
DVS NAMENIOC SUPPORTQOS SUPPORTDIRECT PATH GEN2 SUPPORTDEFINE NETWORK RSC POOLS SUPPORTNETWORK RSC POOL HIGH SHARE VALNIC TEAMING POLICY
\n"; } ############## - # DVS CONFIG - ############## - if($DVS_CONFIG eq "yes" && @$dvs gt 0) { - $hostTag = "DVS Config-$datacenter_name"; - $hostTagShort = "DVS Config"; - push @datastore_cluster_jump_tags,"            $hostTagShort
\n"; - $datacenter_start .= "\n"; - $datacenter_start .= "

DVS Config:

\n"; - $datacenter_start .= "\n"; - $datacenter_start .= "\n"; - - foreach my $dvSwitch (@$dvs) { + # DVS CONFIG + ############## + if($DVS_CONFIG eq "yes" && @$dvs gt 0) { + $hostTag = "DVS Config-$datacenter_name"; + $hostTagShort = "DVS Config"; + push @datastore_cluster_jump_tags,"            $hostTagShort
\n"; + $datacenter_start .= "\n"; + $datacenter_start .= "

DVS Config:

\n"; + $datacenter_start .= "
DVS NAMESWITCH ADDRESSMAX PORTSSTANDALONE PORTSMTUNIOC ENABLEDLDP OPERATIONLDP PROTOCOLACTIVE FLOW TIMEOUTIDLE FLOW TIMEOUTINTERNAL FLOW ONLYSAMPLE RATEEXT KEYCONFIG VERSIONDESCRIPTIONCREATE TIME
\n"; + $datacenter_start .= "\n"; + + foreach my $dvSwitch (@$dvs) { my ($mtu,$ldpOp,$ldpPro,$activeFlowTimeout,$idleFlowTimeout,$intFlowOnly,$sampleRate) = ("N/A","N/A","N/A","N/A","N/A","N/A"); if($dvSwitch->config->isa('VMwareDVSConfigInfo')) { - $mtu = $dvSwitch->config->maxMtu; + $mtu = $dvSwitch->config->maxMtu; $ldpOp = $dvSwitch->config->linkDiscoveryProtocolConfig->operation ? $dvSwitch->config->linkDiscoveryProtocolConfig->operation : "N/A"; $ldpPro = $dvSwitch->config->linkDiscoveryProtocolConfig->protocol ? $dvSwitch->config->linkDiscoveryProtocolConfig->protocol : "N/A"; $activeFlowTimeout = $dvSwitch->config->ipfixConfig->activeFlowTimeout ? $dvSwitch->config->ipfixConfig->activeFlowTimeout : "N/A"; @@ -4775,10 +4793,10 @@ sub printDatacenterSummary { $intFlowOnly = $dvSwitch->config->ipfixConfig->internalFlowsOnly ? "YES" : "NO"; $sampleRate = $dvSwitch->config->ipfixConfig->samplingRate ? $dvSwitch->config->ipfixConfig->samplingRate : "N/A"; - } + } - $datacenter_start .= ""; - $datacenter_start .= ""; + $datacenter_start .= ""; + $datacenter_start .= ""; $datacenter_start .= ""; $datacenter_start .= ""; $datacenter_start .= ""; @@ -4794,10 +4812,10 @@ sub printDatacenterSummary { $datacenter_start .= ""; $datacenter_start .= ""; $datacenter_start .= ""; - $datacenter_start .= "\n"; - } - $datacenter_start .= "
DVS NAMESWITCH ADDRESSMAX PORTSSTANDALONE PORTSMTUNIOC ENABLEDLDP OPERATIONLDP PROTOCOLACTIVE FLOW TIMEOUTIDLE FLOW TIMEOUTINTERNAL FLOW ONLYSAMPLE RATEEXT KEYCONFIG VERSIONDESCRIPTIONCREATE TIME
".$dvSwitch->summary->name."
".$dvSwitch->summary->name."".($dvSwitch->config->switchIpAddress ? $dvSwitch->config->switchIpAddress : "N/A")."".$dvSwitch->config->maxPorts."".$dvSwitch->config->numStandalonePorts."".$dvSwitch->config->configVersion."".($dvSwitch->config->description ? $dvSwitch->config->description : "N/A")."".$dvSwitch->config->createTime."
\n"; - } + $datacenter_start .= "\n"; + } + $datacenter_start .= "\n"; + } print REPORT_OUTPUT "
".$datacenter_start; } @@ -4820,29 +4838,29 @@ sub processOptions { $cluster_view = Vim::find_entity_view(view_type => 'ClusterComputeResource',filter => { name => $clusterInput }); unless($cluster_view) { Util::disconnect(); - die "Error: Unable to find Cluster: \"$clusterInput\"!\n"; + die "Error: Unable to find Cluster: \"$clusterInput\"!\n"; exit 1; } }elsif($type eq 'datacenter' && $hostType eq 'VirtualCenter') { $datacenter_view = Vim::find_entity_view(view_type => 'Datacenter',filter => { name => $datacenterInput}); unless($datacenter_view) { Util::disconnect(); - die "Error: Unable to find Datacenter: \"$datacenterInput\"!\n"; + die "Error: Unable to find Datacenter: \"$datacenterInput\"!\n"; exit 1; } my $CCR = Vim::find_entity_views(view_type => 'ClusterComputeResource', begin_entity => $datacenter_view); - my $CR = Vim::find_entity_views(view_type => 'ComputeResource', begin_entity => $datacenter_view); - my @list = (@$CCR,@$CR); - my %seen = (); - my @unique = grep { ! $seen{$_->name} ++ } @list; - $cluster_views = \@unique; + my $CR = Vim::find_entity_views(view_type => 'ComputeResource', begin_entity => $datacenter_view); + my @list = (@$CCR,@$CR); + my %seen = (); + my @unique = grep { ! $seen{$_->name} ++ } @list; + $cluster_views = \@unique; }elsif($type eq 'vcenter' && $hostType eq 'VirtualCenter') { my $CCR = Vim::find_entity_views(view_type => 'ClusterComputeResource'); - my $CR = Vim::find_entity_views(view_type => 'ComputeResource'); - my @list = (@$CCR,@$CR); - my %seen = (); - my @unique = grep { ! $seen{$_->name} ++ } @list; - $cluster_views = \@unique; + my $CR = Vim::find_entity_views(view_type => 'ComputeResource'); + my @list = (@$CCR,@$CR); + my %seen = (); + my @unique = grep { ! $seen{$_->name} ++ } @list; + $cluster_views = \@unique; } } @@ -4943,23 +4961,23 @@ sub processConf { ); open(CONFIG, "$conf") || die "Error: Couldn't open the $conf!"; - while () { - chomp; - s/#.*//; # Remove comments - s/^\s+//; # Remove opening whitespace - s/\s+$//; # Remove closing whitespace - next unless length; - my ($key, $value) = split(/\s*=\s*/, $_, 2); - if( grep $key eq $_, @goodparams ) { - $value =~ s/"//g; + while () { + chomp; + s/#.*//; # Remove comments + s/^\s+//; # Remove opening whitespace + s/\s+$//; # Remove closing whitespace + next unless length; + my ($key, $value) = split(/\s*=\s*/, $_, 2); + if( grep $key eq $_, @goodparams ) { + $value =~ s/"//g; if($key eq "EMAIL_TO") { @EMAIL_TO = (); @EMAIL_TO = split(',',$value); } else { - $configurations{$key} = $value; + $configurations{$key} = $value; } - } - } + } + } close(CONFIG); } @@ -4976,20 +4994,20 @@ sub processSubFiles { my ($config_input) = @_; open(CONFIG, "$config_input") || die "Error: Couldn't open the $config_input!"; - while () { - chomp; - s/#.*//; # Remove comments - s/^\s+//; # Remove opening whitespace - s/\s+$//; # Remove closing whitespace - next unless length; + while () { + chomp; + s/#.*//; # Remove comments + s/^\s+//; # Remove opening whitespace + s/\s+$//; # Remove closing whitespace + next unless length; if($hostlist) { $hostlists{$_} = "yes"; } if($vmlist) { $vmlists{$_} = "yes"; } - } - close(CONFIG); + } + close(CONFIG); } sub setConf { @@ -5084,148 +5102,148 @@ sub setConf { $VM_NPIV=(($configurations{'VM_NPIV'}) ? $configurations{'VM_NPIV'} : "yes"); $VM_TOOL=(($configurations{'VM_TOOL'}) ? $configurations{'VM_TOOL'} : "yes"); $VMW_APP=(($configurations{'VMW_APP'}) ? $configurations{'VMW_APP'} : "yes"); - $VPX_SETTING=(($configurations{'VPX_SETTING'}) ? $configurations{'VPX_SETTING'} : "yes"); + $VPX_SETTING=(($configurations{'VPX_SETTING'}) ? $configurations{'VPX_SETTING'} : "yes"); } sub getCpuAndMemPerf { - my ($entity_view) = @_; + my ($entity_view) = @_; my $returnString = ""; - my @metrics; - my %metricResults = (); - - if($entity_view->isa('ClusterComputeResource')) { - @metrics = qw(cpu.usage.average cpu.usagemhz.average mem.consumed.average mem.active.average); - }elsif($entity_view->isa('HostSystem')) { - @metrics = qw(cpu.usage.average cpu.usagemhz.average mem.usage.average mem.active.average); - }elsif($entity_view->isa('VirtualMachine')) { - @metrics = qw(cpu.usage.average cpu.usagemhz.average mem.usage.average mem.active.average cpu.ready.summation cpu.vmmemctl.average); - } - - my $entity_name = $entity_view->name; - - #get performance manager - my $perfMgr = Vim::get_view(mo_ref => $service_content->perfManager); - - #get performance counters - my $perfCounterInfo = $perfMgr->perfCounter; - - #grab all counter defs - my %allCounterDefintions = (); - foreach(@$perfCounterInfo) { - $allCounterDefintions{$_->key} = $_; - } - - my @metricIDs = (); - - #get available metrics from entity - my $availmetricid = $perfMgr->QueryAvailablePerfMetric(entity => $entity_view); - - foreach(sort {$a->counterId cmp $b->counterId} @$availmetricid) { - if($allCounterDefintions{$_->counterId}) { - my $metric = $allCounterDefintions{$_->counterId}; - my $groupInfo = $metric->groupInfo->key; - my $nameInfo = $metric->nameInfo->key; - my $instance = $_->instance; - my $key = $metric->key; - my $rolluptype = $metric->rollupType->val; - my $statstype = $metric->statsType->val; - my $unitInfo = $metric->unitInfo->key; - - #e.g. cpu.usage.average - my $vmwInternalName = $groupInfo . "." . $nameInfo . "." . $rolluptype; - - foreach(@metrics) { - if($_ eq $vmwInternalName) { - #print $groupInfo . "\t" . $nameInfo . "\t" . $rolluptype . "\t" . $statstype . "\t" . $unitInfo . "\n"; - my $metricId = PerfMetricId->new(counterId => $key, instance => '*'); - if(! grep(/^$key/,@metricIDs)) { - push @metricIDs,$metricId; - } - } - } - } - } - my $intervalIds = &get_available_intervals(perfmgr_view => $perfMgr, entity => $entity_view); - - my $perfQuerySpec = PerfQuerySpec->new(entity => $entity_view, maxSample => 10, intervalId => shift(@$intervalIds), metricId => \@metricIDs); - - my $metrics; - eval { - $metrics = $perfMgr->QueryPerf(querySpec => [$perfQuerySpec]); - }; - if(!$@) { - my %uniqueInstances = (); - foreach(@$metrics) { - my $perfValues = $_->value; - foreach(@$perfValues) { - my $object = $_->id->instance ? $_->id->instance : "TOTAL"; - #if($object eq "TOTAL") { - my ($numOfCounters,$sumOfCounters,$res) = (0,0,0); - my $values = $_->value; - my $metricRef = $allCounterDefintions{$_->id->counterId}; - my $unitString = $metricRef->unitInfo->label; - my $unitInfo = $metricRef->unitInfo->key; - my $groupInfo = $metricRef->groupInfo->key; - my $nameInfo = $metricRef->nameInfo->key; - my $rollupType = $metricRef->rollupType->val; - my $factor = 1; - if($unitInfo eq 'percent') { $factor = 100; } - - foreach(@$values) { - #if($rollupType eq 'average') { - $res = &average($_)/$factor; - $res = &restrict_num_decimal_digits($res,3); - #} - } - my $internalID = $groupInfo . "." . $nameInfo . "." . $rollupType; - $metricResults{$internalID} = $res . "\t" . $unitString . "\n"; - #} - } - } - } - - my ($cpuAvg,$cpuAvgPer,$memAvg,$memAvgPer,$ballonAvg,$readyAvg) = (0,0,0,0,0,0); - - for my $key ( sort keys %metricResults ) { - if($key eq 'cpu.usage.average') { - $cpuAvgPer = $metricResults{$key}; - }elsif($key eq 'cpu.usagemhz.average') { - $cpuAvg = $metricResults{$key}; - }elsif($key eq 'mem.usage.average' || $key eq 'mem.consumed.average') { + my @metrics; + my %metricResults = (); + + if($entity_view->isa('ClusterComputeResource')) { + @metrics = qw(cpu.usage.average cpu.usagemhz.average mem.consumed.average mem.active.average); + }elsif($entity_view->isa('HostSystem')) { + @metrics = qw(cpu.usage.average cpu.usagemhz.average mem.usage.average mem.active.average); + }elsif($entity_view->isa('VirtualMachine')) { + @metrics = qw(cpu.usage.average cpu.usagemhz.average mem.usage.average mem.active.average cpu.ready.summation cpu.vmmemctl.average); + } + + my $entity_name = $entity_view->name; + + #get performance manager + my $perfMgr = Vim::get_view(mo_ref => $service_content->perfManager); + + #get performance counters + my $perfCounterInfo = $perfMgr->perfCounter; + + #grab all counter defs + my %allCounterDefintions = (); + foreach(@$perfCounterInfo) { + $allCounterDefintions{$_->key} = $_; + } + + my @metricIDs = (); + + #get available metrics from entity + my $availmetricid = $perfMgr->QueryAvailablePerfMetric(entity => $entity_view); + + foreach(sort {$a->counterId cmp $b->counterId} @$availmetricid) { + if($allCounterDefintions{$_->counterId}) { + my $metric = $allCounterDefintions{$_->counterId}; + my $groupInfo = $metric->groupInfo->key; + my $nameInfo = $metric->nameInfo->key; + my $instance = $_->instance; + my $key = $metric->key; + my $rolluptype = $metric->rollupType->val; + my $statstype = $metric->statsType->val; + my $unitInfo = $metric->unitInfo->key; + + #e.g. cpu.usage.average + my $vmwInternalName = $groupInfo . "." . $nameInfo . "." . $rolluptype; + + foreach(@metrics) { + if($_ eq $vmwInternalName) { + #print $groupInfo . "\t" . $nameInfo . "\t" . $rolluptype . "\t" . $statstype . "\t" . $unitInfo . "\n"; + my $metricId = PerfMetricId->new(counterId => $key, instance => '*'); + if(! grep(/^$key/,@metricIDs)) { + push @metricIDs,$metricId; + } + } + } + } + } + my $intervalIds = &get_available_intervals(perfmgr_view => $perfMgr, entity => $entity_view); + + my $perfQuerySpec = PerfQuerySpec->new(entity => $entity_view, maxSample => 10, intervalId => shift(@$intervalIds), metricId => \@metricIDs); + + my $metrics; + eval { + $metrics = $perfMgr->QueryPerf(querySpec => [$perfQuerySpec]); + }; + if(!$@) { + my %uniqueInstances = (); + foreach(@$metrics) { + my $perfValues = $_->value; + foreach(@$perfValues) { + my $object = $_->id->instance ? $_->id->instance : "TOTAL"; + #if($object eq "TOTAL") { + my ($numOfCounters,$sumOfCounters,$res) = (0,0,0); + my $values = $_->value; + my $metricRef = $allCounterDefintions{$_->id->counterId}; + my $unitString = $metricRef->unitInfo->label; + my $unitInfo = $metricRef->unitInfo->key; + my $groupInfo = $metricRef->groupInfo->key; + my $nameInfo = $metricRef->nameInfo->key; + my $rollupType = $metricRef->rollupType->val; + my $factor = 1; + if($unitInfo eq 'percent') { $factor = 100; } + + foreach(@$values) { + #if($rollupType eq 'average') { + $res = &average($_)/$factor; + $res = &restrict_num_decimal_digits($res,3); + #} + } + my $internalID = $groupInfo . "." . $nameInfo . "." . $rollupType; + $metricResults{$internalID} = $res . "\t" . $unitString . "\n"; + #} + } + } + } + + my ($cpuAvg,$cpuAvgPer,$memAvg,$memAvgPer,$ballonAvg,$readyAvg) = (0,0,0,0,0,0); + + for my $key ( sort keys %metricResults ) { + if($key eq 'cpu.usage.average') { + $cpuAvgPer = $metricResults{$key}; + }elsif($key eq 'cpu.usagemhz.average') { + $cpuAvg = $metricResults{$key}; + }elsif($key eq 'mem.usage.average' || $key eq 'mem.consumed.average') { if($entity_view->isa('ClusterComputeResource') && $key eq 'mem.consumed.average') { - $memAvgPer = $metricResults{$key}; + $memAvgPer = $metricResults{$key}; }elsif(!$entity_view->isa('ClusterComputeResource') && $key eq 'mem.usage.average'){ $memAvgPer = $metricResults{$key}; } - }elsif($key eq 'mem.active.average') { - $memAvg = $metricResults{$key}; - }elsif($key eq 'cpu.ready.summation') { - $readyAvg = $metricResults{$key}; - }elsif($key eq 'cpu.vmmemctl.average') { - $ballonAvg = $metricResults{$key}; - } - } + }elsif($key eq 'mem.active.average') { + $memAvg = $metricResults{$key}; + }elsif($key eq 'cpu.ready.summation') { + $readyAvg = $metricResults{$key}; + }elsif($key eq 'cpu.vmmemctl.average') { + $ballonAvg = $metricResults{$key}; + } + } my ($perfString,$hostTag,$hostTagShort) = ("","",""); if($entity_view->isa('ClusterComputeResource')) { - $perfString .= "

Cluster Performance

\n"; - $perfString .= "\n"; + $perfString .= "

Cluster Performance

\n"; + $perfString .= "
\n"; $perfString .= "\n"; - $perfString .= "\n"; + $perfString .= "\n"; $perfString .= "\n"; $perfString .= "\n"; $perfString .= "\n"; $perfString .= "
cpu.usagemhz.averagecpu.usage.averagemem.active.averagemem.consumed.average
" . $cpuAvg . "" . $cpuAvg . "" . $cpuAvgPer . "" . $memAvg . "" . $memAvgPer . "
\n"; - } elsif($entity_view->isa('HostSystem')) { + } elsif($entity_view->isa('HostSystem')) { my $hostsystem_name = $entity_view->name; if($demo eq "yes") { $hostsystem_name = $host_name; } - $perfString .= "" . $hostsystem_name . "" . $cpuAvg . "" . $cpuAvgPer . "" . $memAvg . "" . $memAvgPer . "\n"; - } else { - $perfString .= "" . $entity_view->name . "" . $cpuAvg . "" . $cpuAvgPer . "" . $readyAvg . "" . $memAvg . "" . $memAvgPer . "" . $ballonAvg . "\n"; - } + $perfString .= "" . $hostsystem_name . "" . $cpuAvg . "" . $cpuAvgPer . "" . $memAvg . "" . $memAvgPer . "\n"; + } else { + $perfString .= "" . $entity_view->name . "" . $cpuAvg . "" . $cpuAvgPer . "" . $readyAvg . "" . $memAvg . "" . $memAvgPer . "" . $ballonAvg . "\n"; + } return $perfString; } @@ -5240,12 +5258,12 @@ sub get_available_intervals { my @intervals; if ($provider_summary->refreshRate) { if($provider_summary->refreshRate != -1) { - push @intervals, $provider_summary->refreshRate; + push @intervals, $provider_summary->refreshRate; } } foreach (@$historical_intervals) { if($_->samplingPeriod != -1) { - push @intervals, $_->samplingPeriod; + push @intervals, $_->samplingPeriod; } } return \@intervals; @@ -5257,8 +5275,8 @@ sub average { my $avg = 0; foreach(@arr) { - $avg += $_; - $n += 1; + $avg += $_; + $n += 1; } return $avg ? $avg/$n : 0; } @@ -5277,7 +5295,7 @@ sub find_by_key { foreach my $item (@$list) { if ($key eq $item->key) { - return $item; + return $item; } } @@ -5290,8 +5308,8 @@ sub get_pci_string { # defect 173631 if ($pciString =~ /([a-fA-F0-9]+):([a-fA-F0-9]+)\.([a-fA-F0-9]+)$/) { $pciString = hexstr_to_int($1) - . ":" . hexstr_to_int($2) - . "." . hexstr_to_int($3); + . ":" . hexstr_to_int($2) + . "." . hexstr_to_int($3); } return $pciString } @@ -5311,7 +5329,7 @@ sub getSnapshotTree { foreach my $node (@$tree) { $head = ($ref->value eq $node->snapshot->value) ? " " : " " if (defined $ref); my $quiesced = ($node->quiesced) ? "YES" : "NO"; - my $desc = $node->description; + my $desc = $node->description; if($desc eq "" ) { $desc = "NO DESCRIPTION"; } push @vmsnapshots,"".$host."".$vm."".$node->name."".$desc."".$node->createTime."".$node->state->val."".$quiesced.""; @@ -5325,11 +5343,11 @@ sub startReport { print "This can take a few minutes depending on the size of your environment. \nGet a cup of coffee/tea/beer and check out http://www.virtuallyghetto.com\n\n"; if($demo eq "yes") { - $host_name = "DEMO-HOST.primp-industries.com"; - } + $host_name = "DEMO-HOST.primp-industries.com"; + } $start_time = time(); - open(REPORT_OUTPUT, ">$report"); + open(REPORT_OUTPUT, ">encoding(UTF-8)", "$report") or die $!; $my_time = "Date: ".giveMeDate('MDYHMS'); my $html_start = < - + VMware vSphere Health Check Report v$version - $my_time ($system_name)