sandeepkalekar's Posts

I am executing following piece of code to get the performance metrics. When I set intervalId other 20 in PerfQuerySpec api and execute api QueryPerf(querySpec => [$perfQuerySpec]) i get error - ... See more...
I am executing following piece of code to get the performance metrics. When I set intervalId other 20 in PerfQuerySpec api and execute api QueryPerf(querySpec => [$perfQuerySpec]) i get error - A specified parameter was not correct. querySpec.interval' Need help to resolve this issue. I want to setup rollup interval as 1 hr so that we get average cpu and memeory usage of past 1 hr. my $serviceInst = Vim::get_view (mo_ref => ManagedObjectReference->new(type => 'ServiceInstance', value => 'ServiceInstance')); my $perfMgr = Vim::get_view (mo_ref => $serviceInst->content->perfManager); my (@hosts,@metrics,%metricResults) = (); my $perfCounterInfo = $perfMgr->perfCounter; my @metricIDs ; my $metric ; my $groupInfo ; my $nameInfo  ; my $instance ; my $key ; my $rollupType ; my $statstype ; my $unitInfo ; my $res; my $unitString; my $values; my $metricRef; #grab all counter defs my %allCounterDefintions = (); foreach(@$perfCounterInfo) { $allCounterDefintions{$_->key} = $_; } # enumerate all performance counters by their IDs my %perfCounter = map { $_->key => $_ } @{$perfMgr->perfCounter}; foreach my $vm_view (@$vm_views) { my $vmref ; my @vmdk ; while (my ($key, $value) = each(%{$vm_info})) { my $vmname = $$vm_info{$key}{VMName}; if (defined($vmname) && $vm_view->name eq $vmname ) { $vmref = $$vm_info{$key}; } } if (!$vmref) { next; } $vmref->{'averagePercentCapacityContention'} = (); $vmref->{'cpuAveragePercentUsage'} = (); $vmref->{'memoryAverageUsage'} = (); if (!defined($vm_view)) { next; } my $availmetricid = $perfMgr->QueryAvailablePerfMetric(entity => $vm_view); foreach(sort {$a->counterId cmp $b->counterId} @$availmetricid) { if($allCounterDefintions{$_->counterId}) { $metric = $allCounterDefintions{$_->counterId}; $groupInfo = $metric->groupInfo->key; $nameInfo = $metric->nameInfo->key; $instance = $_->instance; $key = $metric->key; $rollupType = $metric->rollupType->val; $statstype = $metric->statsType->val; $unitInfo = $metric->unitInfo->key; #e.g. cpu.usage.average my $vmwInternalName = $groupInfo . "." . $nameInfo . "." . $rollupType; foreach(@metrics) { if($_ eq $vmwInternalName) { my $metricId = PerfMetricId->new(counterId => $key, instance => '*'); if(! grep(/^$key/,@metricIDs)) { push @metricIDs,$metricId; } } } my $metricId = PerfMetricId->new(counterId => $key, instance => '*'); } } my $perfQuerySpec = PerfQuerySpec->new(entity => $vm_view, maxSample => 10, intervalId => 20, metricId => \@metricIDs); my $metrics = $perfMgr->QueryPerf(querySpec => [$perfQuerySpec]);
Which internal API can we use to get the vmware tags and tag category?
Hi stumpr, Thank you for suggesting use of $host->{'runtime.connectionState'}; I needed one more help. How can we find the ESX Host is up, if it is not managed by Vcenter server, before enr... See more...
Hi stumpr, Thank you for suggesting use of $host->{'runtime.connectionState'}; I needed one more help. How can we find the ESX Host is up, if it is not managed by Vcenter server, before enrolling it to the Vcenter.
I am using RebootHost_Task API, pinging the ESX server to check if it is up(using Net::Ping module) and then using ExitMaintenanceMode_Task to exit the maintenance mode for the ESX server. I s... See more...
I am using RebootHost_Task API, pinging the ESX server to check if it is up(using Net::Ping module) and then using ExitMaintenanceMode_Task to exit the maintenance mode for the ESX server. I sometimes get InvalidHostConnectionState fault when I trigger ExitMaintenanceMode_Task. This is because even though the ESX host is pingable, the SOAP request is unsuccessful. Which Vmware perl SDK API can be used to check the host status before triggering ExitMaintenanceMode_Task aPI
How do I create datastore of specific size say 2.5 TB using Vmware perl API CreateVmfsDatastore ? I have used following block of code, where i am passing $dataStoreSize as the argument - my... See more...
How do I create datastore of specific size say 2.5 TB using Vmware perl API CreateVmfsDatastore ? I have used following block of code, where i am passing $dataStoreSize as the argument - my $dataStoreSize = 2.5; # datastore size is set in TB my $newDatastoreOptions = $ds_view->QueryVmfsDatastoreCreateOptions( devicePath => $hostScsiDisk->devicePath ) ; my $HostDiskPartitionInfo = $hs_view->ComputeDiskPartitionInfo ( devicePath => $hostScsiDisk->devicePath , layout => @$newDatastoreOptions[0]->info->layout ); my $diskname = @$newDatastoreOptions[0]->spec->vmfs->extent->diskName ; my $partition = @$newDatastoreOptions[0]->spec->vmfs->extent->partition ; my $diskUuid = @$newDatastoreOptions[0]->spec->diskUuid ; my $partitionarr = @$newDatastoreOptions[0]->spec->partition->partition ; my $hostDiskPartitionSpec = HostDiskPartitionSpec->new(     chs => @$newDatastoreOptions[0]->spec->partition->chs ,     partition => @$newDatastoreOptions[0]->spec->partition->partition,     totalSectors => $dataStoreSize * ???,     partitionFormat => @$newDatastoreOptions[0]->spec->partition->partitionFormat ); my $hostScsiDiskPartition = new HostScsiDiskPartition( diskName => $diskname, partition => @$newDatastoreOptions[0]->spec->vmfs->extent->partition ); my $hostVmfsSpec = new HostVmfsSpec( blockSizeMb => 1, extent => $hostScsiDiskPartition, majorVersion => @$newDatastoreOptions[0]->spec->vmfs->majorVersion,  volumeName => $dataStore); my $vmfsDatastoreCreateSpec = new VmfsDatastoreCreateSpec( partition => $hostDiskPartitionSpec, vmfs => $hostVmfsSpec , diskUuid => $diskUuid ); $newDatastore = $ds_view->CreateVmfsDatastore( spec => $vmfsDatastoreCreateSpec ); I wanted to know how the totalSectors would be calculated - totalSectors => $dataStoreSize *??? Can we use API call ComputeDiskPartitionInfo, while creating a datastore of specific size?
I am invoking Vmware perl API CreateVmfsDatastore and creating a datastore of 10 TB. But due to large datastore size(10TB) in case of particular box, the API CreateVmfsDatastore gives timeout, ev... See more...
I am invoking Vmware perl API CreateVmfsDatastore and creating a datastore of 10 TB. But due to large datastore size(10TB) in case of particular box, the API CreateVmfsDatastore gives timeout, even though the datastore is created. I am getting following error - SOAP request error - possibly a protocol issue: SSL read timeout:  at /usr/share/perl/5.14/perl5db.pl line 3737. at /usr/lib/perl5/Net/SSL.pm line 210.         Net::SSL::die_with_error(LWP::Protocol::https::Socket=GLOB(0x15100d0), "SSL read timeout") called at /usr/lib/perl5/Net/SSL.pm line 218         Net::SSL::__ANON__[/usr/lib/perl5/Net/SSL.pm:218]("ALRM") called at /usr/share/perl/5.14/perl5db.pl line 3737         eval {...} called at /usr/share/perl/5.14/perl5db.pl line 3737         Net::SSL::read(LWP::Protocol::https::Socket=GLOB(0x15100d0), "", 1024, 0) called at /usr/share/perl5/Net/HTTP/Methods.pm line 256         Net::HTTP::Methods::my_readline(LWP::Protocol::https::Socket=GLOB(0x15100d0), "Status") called at /usr/share/perl5/Net/HTTP/Methods.pm line 343         Net::HTTP::Methods::read_response_headers(LWP::Protocol::https::Socket=GLOB(0x15100d0), "laxed", 1, "junk_out", ARRAY(0x4ff3480)) called at /usr/share/perl5/LWP/Protocol/http.pm line 378         LWP::Protocol::http::request(LWP::Protocol::https=HASH(0x69b8e70), HTTP::Request=HASH(0x63377c8), undef, undef, undef, 180) called at /usr/share/perl5/LWP/UserAgent.pm line 192         eval {...} called at /usr/share/perl5/LWP/UserAgent.pm line 191         LWP::UserAgent::send_request(LWP::UserAgent=HASH(0x5649a48), HTTP::Request=HASH(0x63377c8), undef, undef) called at /usr/share/perl5/LWP/UserAgent.pm line 274         LWP::UserAgent::simple_request(LWP::UserAgent=HASH(0x5649a48), HTTP::Request=HASH(0x63377c8), undef, undef) called at /usr/share/perl5/LWP/UserAgent.pm line 282         LWP::UserAgent::request(LWP::UserAgent=HASH(0x5649a48), HTTP::Request=HASH(0x63377c8)) called at /usr/share/perl/5.14/VMware/VICommon.pm line 2199         SoapClient::request(SoapClient=HASH(0x5649c50), "CreateVmfsDatastore", "<_this type=\"HostDatastoreSystem\">datastoreSystem-14979</_thi"..., "\"urn:vim25/test\"") called at /usr/share/perl/5.14/VMware/VIM25Stub.pm line 76513         VimService::CreateVmfsDatastore(VimService=HASH(0x5649ac0), "_this", ManagedObjectReference=HASH(0x59c57c8), "spec", VmfsDatastoreCreateSpec=HASH(0x6330f30)) called at /usr/share/perl/5.14/VMware/VICommon.pm line 1699         ViewBase::invoke(HostDatastoreSystem=HASH(0x69ca3c0), "CreateVmfsDatastore", "spec", VmfsDatastoreCreateSpec=HASH(0x6330f30)) called at (eval 47)[/usr/share/perl/5.14/VMware/VIMRuntime.pm:59] line 22 Is there any way to increase the timeout?