Hi folks,
What managed entities are performance providers?
Obviously HostSystem and VirtualMachine. They work just fine to me.
What's about Network? Datastore? ResourcePool? ComputeResource? ClusterComputeResource?
To me they fail to provide performance statistics ...
Maybe they need to be addressed by MOR from a specific node on the object instances tree?
The VI API reference instead of listing, gives them a brilliant description 8-/:
"Those managed entities that are capable of returning performance statistics are Performance Providers."
As useful as it gets...
Thanks in advance.
I'll use Powershell since that's what I'm working with at the moment...
PS> $perfMoRef = (get-view ServiceInstance).Content.PerfManager
#get the moref for a VM
PS> $vmMoRef = (get-vm MYVM01 | get-view).Moref
#grab the counters for the last hour
PS> $counters = (get-view $perfMoRef).QueryAvailablePerfMetric($vmMoRef,(Get-Date).AddHours(-1),(Get-Date),20)
As you mentioned, this works for the VM
When I try the same for a cluster:
PS> $counters_for_cluster = (get-view $perfMoRef).QueryAvailablePerfMetric($clMoRef,(Get-Date).AddHours(-1),(Get-Date),20)
I get
Exception calling "QueryAvailablePerfMetric" with "4" argument(s): "A specified parameter was not correct.
interval"
At line:1 char:65
+ $counters_for_cluster = (get-view $perfMoRef).QueryAvailablePerfMetric( <<<< $clMoRef,(Get-Date).AddHours(-1),(Get-Date),20)
(Note... I revisited the above after getting to the bottom... setting the interval (4th parm) to -1 returned an array of perfMetric IDs)... maybe that's the key ???
So, I tried another approach (using powershell cmdlets rather than trying to navigate the objects):
PS> get-cluster | get-stat -common
PS> get-resourcepool | get-stat -common
... both return data for "cpu.usagemhz.average" and "mem.usage.average" metrics.
As expected,
PS> get-vmhost | get-stat -common
returns a boatload of data and
PS> get-datastore | get-stat -common
returns a bunch of errors.
Something else interesting is this... the VM supports realtimne stats while the cluster only supports summary stats
#cluster
PS> (get-view $perfMoRef).QueryPerfProviderSummary($clMoRef)
Entity : VMware.Vim.ManagedObjectReference
CurrentSupported : False
SummarySupported : True
RefreshRate : -1
#vm
PS> (get-view $perfMoRef).QueryPerfProviderSummary($vmMoRef)
Entity : VMware.Vim.ManagedObjectReference
CurrentSupported : True
SummarySupported : True
RefreshRate : 20
If this doesn't help, I'll look at it in Perl, but it may take a few days for me to get back to it.
Doug
... Oh, and I found a list as soon as I posted before :smileygrin:
Go to page 108-110 of this doc
http://www.vmware.com/support/developer/vc-sdk/visdk25pubs/visdk25programmingguide.pdf
Sorry, formatting the table so it would look nice in the forum post wasn't going to happen!
Thanks Doug,
I have a C# code that can tell whether a managed object is a performance provider, it is not a problem.
Yes, the guide has kind of list of the objects.
I was hoping for more .
Thanks Doug, I appreciate you answering my post
I've noticed that I spend a bit of time digging for information -- and messing around with the code to see why I get odd errors when I think I should have it right.
I had chalked it up to me learning the API, but I find myself in the same situation, although,for common tasks, the Powershell toolkit hides a lot of the complexity.
I still cannot get QueryPerfProviderSummary from a ComputeResource.
Are you saying I can QueryAvailablePerfMetric on it anyway using -1 the interval ID?
You need to first get MOR of Compute Resource and then use the same with QueryPerf. -1 is not a valid value for interval ID. First you need to query AvailablePerfIntervals for ComputeResource and then use the same for querying performance data.
When I called
$counters_for_cluster = (get-view $perfMoRef).QueryAvailablePerfMetric($clMoRef,(Get-Date).AddHours(-1),(Get-Date),-1)
on a ClusterResource, it worked. I'll try a ComputeResource in my lab -- but my internet access is a little weak, so I'll have to work fast.
Message was edited by: DougBaer (weird asterisks in code... meant to be bold)
Hi Subramanyam,
This is exactly what I'm doing.
1. I use the ComputeResource instnce MOR to call QueryPerfProviderSummary: it fails (invalid argument)
is this what you call "query AvailablePerfIntervals"?
2. I call QueryAvailablePerfMetric (with the same MOR) to get the list of metric IDs: it fails too (invalid argument)
3. after that I'm suppose to call QueryPerfCounter to get metadata of the available metrics and QueryPerf to get samples.
How different it is from what you're suggesting?
Thanks!
Thanks Doug for a good advise; I've just installed Powershell with the VMware Infrastructure Toolkit, it really helps to get things straight.
I don'd know if you've seen this, but VMware has some good sample code here for Perl, Java and C#:
http://www.vmware.com/communities/content/developer/samplecode/
Thanks Doug, I've seen it, the code is so-so, I'm coding something a little bit more sophisticated.
But it gave me some pointers, especially Java samples.
Glad to hear it. Hitting the VI client, I can pull perf data from Host, VM, Cluster, and Resource Pool objects -- my guess is that this is everything that is a perf provider.
From the API Reference (http://pubs.vmware.com/vi3/sdk/ReferenceGuide/vim.ComputeResource.html)
Description: Represents a set of physical compute resources for a set of virtual machines.
The base type ComputeResource, when instantiated by calling vim.Folder.CreateStandaloneHost, represents a single host.
The subclass ClusterComputeResource represents a cluster of hosts and adds distributed management features such as
availability and resource scheduling. A ComputeResource always has a root ResourcePool associated with it.
Certain types of clusters such as those with VMware DRS enabled and standalone hosts (ESX Server 3) support the
creation of ResourcePool hierarchies. From the Perl Programming Guide:> ==find_entity_view==
Searches the inventory tree for a managed entity that matches the specified entity type. The search begins with
the root folder unless the begin_entity parameter is specified.
Parameters:
view_type – Managed entity type specified as one of these strings:
o “ClusterComputeResource”
o “ComputeResource”
o “Datacenter”
o “Folder”
o “HostSystem”
o “ResourcePool”
o “VirtualMachine”
=== Try some code -- were you using Perl? ===
my $perfmgr_view = Vim::get_view(mo_ref => Vim::get_service_content()->perfManager);
my $perfCounterInfo = $perfmgr_view->perfCounter;
sub GetResource {
my $crs = Vim::find_entity_views(view_type => $_[0]);
foreach my $cr (@$crs) {
print $_[0]," ", $cr->name,"\n";
return $cr;
}
}
my $testVM = GetResource('VirtualMachine');
my $PerfSummary = $perfmgr_view->QueryPerfProviderSummary( entity => $testVM ) ;
print "currentSupported:",$PerfSummary->currentSupported,"\n";
print "refreshRate:",$PerfSummary->refreshRate,"\n";
print "summarySupported:",$PerfSummary->summarySupported,"\n";
print "\n";
my $testCR = GetResource('ComputeResource');
$PerfSummary = $perfmgr_view->QueryPerfProviderSummary( entity => $testCR ) ;
print "currentSupported:",$PerfSummary->currentSupported,"\n";
print "refreshRate:",$PerfSummary->refreshRate,"\n";
print "summarySupported:",$PerfSummary->summarySupported,"\n";
print "\n";
#print Dumper ($testCR) . "\n\n\n";
my $testCCR = GetResource('ClusterComputeResource');
$PerfSummary = $perfmgr_view->QueryPerfProviderSummary( entity => $testCCR ) ;
print "currentSupported:",$PerfSummary->currentSupported,"\n";
print "refreshRate:",$PerfSummary->refreshRate,"\n";
print "summarySupported:",$PerfSummary->summarySupported,"\n";
#print Dumper ($testCCR) . "\n\n\n";
__END__
For me, this returns
C:\Scripts\SAMPLES>perl Myperf.pl
VirtualMachine UDA
currentSupported:1
refreshRate:20
summarySupported:1
ComputeResource DL580 Cluster
currentSupported:0
refreshRate:-1
summarySupported:1
ClusterComputeResource DL580 Cluster
currentSupported:0
refreshRate:-1
summarySupported:1
===
This tells me that, for ClusterCompute resources, current data is not kept... only summary. This kind of makes sense since it is an aggregate (assuming that a ComputeResource is, in fact, a ClusterComputeResource).
NOTE: the description for the refreshRate property:
Message was edited by: DougBaer (formatting)
Bottom line is that you appear to be able to get Realtime performance stats from HostSystem and VirtualMachine objects, but summary performance only for ComputeResource, ClusterComputeResource and ResourcePool objects.
That's right, it seems to be the correct picture.
Thanks Doug
This document was generated from the following thread: what managed entities are performance providers?