Skip to content

Commit

Permalink
Update ViPullStatistics.pl
Browse files Browse the repository at this point in the history
  • Loading branch information
rschitz authored Apr 6, 2017
1 parent 5986405 commit cf87cd2
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions root/ViPullStatistics.pl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use Unicode::Normalize;

# $Data::Dumper::Indent = 1;
$Util::script_version = "0.9.121";
$Util::script_version = "0.9.122";
$ENV{'PERL_LWP_SSL_VERIFY_HOSTNAME'} = 0;

Opts::parse();
Expand Down Expand Up @@ -213,7 +213,7 @@ sub getSnapshotTreeRaw {
$datacentre_name =~ s/[ .]/_/g;
$datacentre_name = NFD($datacentre_name);
$datacentre_name =~ s/[^[:ascii:]]//g;
$datacentre_name =~ s/[^A-Za-z0-9]/_/g;
$datacentre_name =~ s/[^A-Za-z0-9-_]/_/g;

my $clusters_views = Vim::find_entity_views(view_type => 'ClusterComputeResource', properties => ['name','configurationEx', 'summary', 'datastore', 'host'], begin_entity => $datacentre_view);

Expand All @@ -224,7 +224,7 @@ sub getSnapshotTreeRaw {
$cluster_name =~ s/[ .]/_/g;
$cluster_name = NFD($cluster_name);
$cluster_name =~ s/[^[:ascii:]]//g;
$cluster_name =~ s/[^A-Za-z0-9]/_/g;
$cluster_name =~ s/[^A-Za-z0-9-_]/_/g;

if (my $cluster_root_pool_view = Vim::find_entity_view(view_type => 'ResourcePool', filter => {name => qr/^Resources$/}, properties => ['summary.quickStats'], begin_entity => $cluster_view)) {
my $cluster_root_pool_quickStats = $cluster_root_pool_view->get_property('summary.quickStats');
Expand Down Expand Up @@ -276,7 +276,7 @@ sub getSnapshotTreeRaw {
$shared_datastore_name =~ s/[ .()]/_/g;
$shared_datastore_name = NFD($shared_datastore_name);
$shared_datastore_name =~ s/[^[:ascii:]]//g;
$shared_datastore_name =~ s/[^A-Za-z0-9]/_/g;
$shared_datastore_name =~ s/[^A-Za-z0-9-_]/_/g;

my $shared_datastore_uncommitted = 0;
if ($cluster_datastore_view->summary->uncommitted) {
Expand Down Expand Up @@ -343,7 +343,7 @@ sub getSnapshotTreeRaw {
$unshared_datastore_name =~ s/[ .()]/_/g;
$unshared_datastore_name = NFD($unshared_datastore_name);
$unshared_datastore_name =~ s/[^[:ascii:]]//g;
$unshared_datastore_name =~ s/[^A-Za-z0-9]/_/g;
$unshared_datastore_name =~ s/[^A-Za-z0-9-_]/_/g;

my $unshared_datastore_uncommitted = 0;
if ($cluster_datastore_view->summary->uncommitted) {
Expand Down Expand Up @@ -472,14 +472,14 @@ sub getSnapshotTreeRaw {
$cluster_vm_view_name =~ s/[ .()]/_/g;
$cluster_vm_view_name = NFD($cluster_vm_view_name);
$cluster_vm_view_name =~ s/[^[:ascii:]]//g;
$cluster_vm_view_name =~ s/[^A-Za-z0-9]/_/g;
$cluster_vm_view_name =~ s/[^A-Za-z0-9-_]/_/g;

# my $cluster_vm_view_path = Util::get_inventory_path($cluster_vm_view, Vim::get_vim());

# my $cluster_vm_view_path_uni = NFD($cluster_vm_view_path); # Unicode normalization Form D (NFD), canonical decomposition.
# $cluster_vm_view_path_uni =~ s/[^[:ascii:]]//g; # Remove all non-ascii.
# $cluster_vm_view_path_uni =~ s/ - /_/g; # Replace all " - " with "_"
# $cluster_vm_view_path_uni =~ s/[^A-Za-z0-9]/_/g; # Replace all non-alphanumericals with _
# $cluster_vm_view_path_uni =~ s/[^A-Za-z0-9-_]/_/g; # Replace all non-alphanumericals with _

$cluster_vm_views_vcpus += $cluster_vm_view->{'config.hardware.numCPU'};
$cluster_vm_views_vram += $cluster_vm_view->{'runtime.maxCpuUsage'};
Expand Down Expand Up @@ -687,7 +687,7 @@ sub getSnapshotTreeRaw {
$cluster_vm_view_off_name =~ s/[ .()]/_/g;
$cluster_vm_view_off_name = NFD($cluster_vm_view_off_name);
$cluster_vm_view_off_name =~ s/[^[:ascii:]]//g;
$cluster_vm_view_off_name =~ s/[^A-Za-z0-9]/_/g;
$cluster_vm_view_off_name =~ s/[^A-Za-z0-9-_]/_/g;

my $cluster_vm_view_off_files = $cluster_vm_view_off->{'layoutEx.file'};
# http://pubs.vmware.com/vsphere-60/topic/com.vmware.wssdk.apiref.doc/vim.vm.FileLayoutEx.FileType.html
Expand Down Expand Up @@ -847,7 +847,7 @@ sub getSnapshotTreeRaw {
$StandaloneResourceDatastore_name =~ s/[ .()]/_/g;
$StandaloneResourceDatastore_name = NFD($StandaloneResourceDatastore_name);
$StandaloneResourceDatastore_name =~ s/[^[:ascii:]]//g;
$StandaloneResourceDatastore_name =~ s/[^A-Za-z0-9]/_/g;
$StandaloneResourceDatastore_name =~ s/[^A-Za-z0-9-_]/_/g;
my $StandaloneResourceDatastore_uncommitted = 0;
if ($StandaloneResourceDatastore->summary->uncommitted) {
$StandaloneResourceDatastore_uncommitted = $StandaloneResourceDatastore->summary->uncommitted;
Expand Down Expand Up @@ -902,7 +902,7 @@ sub getSnapshotTreeRaw {
$standalone_vm_view_name =~ s/[ .()]/_/g;
$standalone_vm_view_name = NFD($standalone_vm_view_name);
$standalone_vm_view_name =~ s/[^[:ascii:]]//g;
$standalone_vm_view_name =~ s/[^A-Za-z0-9]/_/g;
$standalone_vm_view_name =~ s/[^A-Za-z0-9-_]/_/g;

$standalone_vm_views_vcpus += $standalone_vm_view->{'config.hardware.numCPU'};

Expand Down

0 comments on commit cf87cd2

Please sign in to comment.