VMware Cloud Community
vohuythao
Enthusiast
Enthusiast

'mem.usage.average" has value 0

Hi guys,

I currently got a problem with Get-Stat command.

I try to run this to get information of a powered on VM

Get-Stat -Entity $Names -MaxSamples 1 -Stat "cpu.usage.average","mem.usage.average"

$mem = $stats| where {$_.MetricID -eq "mem.usage.average"}

$memvalue = $mem.Value

And the value of $memvalue is 0 in some cases

I don't know this is normal or it got an issue/problem? I think the memory usage of a VM cannot has 0 ( percent)

Do you have any ideas or recommendation?

Thank you all

4 Replies
MKguy
Virtuoso
Virtuoso

I think the memory usage of a VM cannot has 0 ( percent)

It can very well be at 0%, that is if the VM is actually powered-off during the sample interval. Have you checked that?

-- http://alpacapowered.wordpress.com
0 Kudos
LucD
Leadership
Leadership

Since you didn't specify a Historical Interval (via Start/Finish or IntervalSecs/IntervalMins, you will get statistical data from Historical Interval 1 (Past Day).

This is aggregated data, in other words, the vCenter, or better the scheduled task on the DB server where the vCenter DB is stored, takes the Realtime metrics (20 sec interval) together (all falling in the same 5 minute interval), and will calculate the average of the values over the 5 minute interval.

If that VM was powered on for lets say 2 x 20 secs intervals during the 5 minutes, it could result in a 0 value (don't forget the rounding).

When a VM is powered off, there will be no statistical data, not a 0 value.

It would be interesting to get the Events related to this VM, and check when it stopped/started.

Do you also see a 0 value for the Past Day under the Performance tab in the vSphere client ?


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

vohuythao
Enthusiast
Enthusiast

Thanks MKGuy and LucD,

This VM was powered on during 1 month

I try to put the -IntervalSecs 60 to this command, and it also still has value 0

Under the Performance tab in the vSphere client, Memory -> Measurement : Active

Capture.JPG

There is value 0, so strange :smileygrin:

0 Kudos
LucD
Leadership
Leadership

If you select the interval as 60 seconds, the Get-Stat cmdlet will return samples for the next lower interval.

In this case that would be the Realtime interval, with a 20 seconds sampling interval.

Btw, you should select the Usage Average metric via Chart Options, now it isn't displayed.


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