VMware Cloud Community
Marcus316
Enthusiast
Enthusiast

Need help with PowerCLI stats collection

Hello all,

I'm trying to collect some metrics via PowerCLI for

Datastore Average IOPS

and

Guest Average Latency (GAVG) for all VMs in a given Datastore.

This is normally a straightforward process if the vCenter statistics levels are configured properly, which I believe they are. But here is my problem :

When I run "Get-StatType -Entity Datastore-1", these are all the metrics I get

PowerCLI C:\> Get-StatType -Entity Datastore-1
disk.used.latest
disk.provisioned.latest
disk.capacity.latest
disk.unshared.latest
datastore.numberReadAveraged.average
datastore.numberWriteAveraged.average
datastore.read.average
datastore.write.average

However, when I try to grab one of these stats, I get nothing back, for example :

PowerCLI C:\>Get-Stat -Entity Datastore-1 -Stat datastore.numberReadAveraged.average
PowerCLI C:\>

When I do a simple "Get-Stat -Entity Datastore-1" I get plenty of stats of "disk.used.latest" stats but not the metrics I want, which are "datastore.numberReadAveraged.average" and "datastore.numberWriteAveraged.average".
The just don't seem to work via PowerCLI.

I tried getting them another way, by "Getting" all VMs in a given Datastore and then Aggregating that data, but even at the VM level I get the same result.
The stat is there but there are no values for it. However, I CAN get see these metrics when I go to a VM's Performance tab in the vSphere client!

If anyone has an idea of what the problem could be, please let me know!

Thanks!


- vCenter version is 5.5.
- Database rollup tasks are all functionning properly.
- My vCenter Statistics levels are set to 3 for the 3 first Intervals (P.S.: it has been set to 3 for about 3 weeks, before that it was at 1 everywhere)
- My PowerCLI version :

PowerCLI C:\> Get-PowerCLIVersion

PowerCLI Version
----------------
   VMware vSphere PowerCLI 5.5 Release 2 Patch 1 build 1931983
---------------
Snapin Versions
---------------
   VMWare AutoDeploy PowerCLI Component 5.5 build 1890764
   VMWare ImageBuilder PowerCLI Component 5.5 build 1890764
   VMware License PowerCLI Component 5.5 build 1265954
   VMware VDS PowerCLI Component 5.5 build 1926677
   VMware vSphere PowerCLI Component 5.5 Patch 1 build 1926677

0 Kudos
6 Replies
LucD
Leadership
Leadership

When you pass a datastore for the Entity value, you will need to be at Statistics Level 3.

Try passing the VMHost where the datastore is located, that should return data (it only requires Statistics Level 1).

In the returned data, the Instance is the Uuid of the datastore.

You can create a hash table to look up the datastorename from te Uuid.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Marcus316
Enthusiast
Enthusiast

Hi Luc,

Thanks for the response.

For some reason, that doesn't work either, I see the stats I want when I do a Get-StatType, but when I do a Get-stat :

PowerCLI C:\> Get-Stat -Stat datastore* -Entity ESXi1

PowerCLI C:\>

Any ideas of why this would happen?

Thanks,

Marc

0 Kudos
Freep
Contributor
Contributor

Try passing an actual object to -Entity as it expects and not just a string

$vmhost = get-vmhost ESXi1

Get-Stat -stat datastore* -entity $vmhost -realtime

Now that i think about it.  That may be the problem is the datastore stats are realtime only.  So you need -Realtime.

0 Kudos
squebel
Contributor
Contributor

I'm having the exact same problem and can't seem to figure a way around it. I've even dropped the statistics levels down to 1 when following VMware KB: Changing the collection level for the Storage DRS and the SIOC data counters in the VMwar... but it doesn't seem to help at all. I can get data from the datastore.read.average metric at the datastore level which is nice, but it would be great to get the IOPS numbers as well. Did you ever find a solution?

0 Kudos
LucD
Leadership
Leadership

Have a look at Get the maximum IOPS


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
squebel
Contributor
Contributor

I've actually been working with your scripts from that post.. thanks btw! The big difference between what I'm thinking should work and what your script does, is you're gathering the MaxIO at the vmdk level for every vm of the datastore. While that does get the information I'm looking for by adding all that together, it's not as easy as getting it straight from the datastore entity itself. Maybe I'm completely misunderstanding what datastore.numberReadAveraged.average means or why I can't get it to return any data but it seems to me it should be returning something.

0 Kudos