Quantcast
Channel: VMware Communities : All Content - All Communities
Viewing all articles
Browse latest Browse all 207710

get_stat memory counters

$
0
0

I have got the below script which reports on memory usage of VM's via using the get-stat command.   In our virtual centre out statistci levels are set to 1 for each interval duration, so we can only use basic counters.   The main counters for memory I have used are mem.usage.average and mem.consumed.average.  The script is below :

 

$businessDays = "Monday","Tuesday","Wednesday","Thursday","Friday"
$dayStart = New-Object DateTime(1,1,1,7,30,0)
$dayEnd = New-Object DateTime(1,1,1,17,30,0)
get-cluster "EO Cluster 0" |Get-VM | where {$_.PowerState -eq "PoweredOn" -and $_.MemoryMB -ge 4096} | `
Select name,MemoryMB,
  @{N="Average Memory Usage Percentage";E={[math]::Round((get-stat -entity $_ -Start ((Get-Date).AddDays(-7)) -Finish (Get-Date) -stat mem.usage.average |Where-object {$businessDays -contains $_.Timestamp.DayOfWeek -and $_.timestamp.timeofday -gt $daystart.timeofday -and $_.timestamp.timeofday -lt $dayend.timeofday} | Measure-Object -Property Value -Average).Average)}},

@{N="Average Memory Usage MB";E={[math]::Round((get-stat -entity $_ -Start ((Get-Date).AddDays(-7)) -Finish (Get-Date) -stat mem.consumed.average | Where-object {$businessDays -contains $_.Timestamp.DayOfWeek -and $_.timestamp.timeofday -gt $daystart.timeofday -and $_.timestamp.timeofday -lt $dayend.timeofday} | Measure-Object -Property Value -Average).Average / 1KB)}}

 

This script gets values only from VM's which have more than 4GB of memory.

 

The issue I have is understanding the counter values and in particular the counters.  For one of the VM's, i get the below values for the last 7 days :

 

Name: VM Name

MemoryMB: 4096

Avg Memory Usage : 24      (mem.usage.average)

Avg Memory Usage MB : 4096   (mem.consumed.average)

 

or

 

Name: VM Name

MemoryMB: 6144

Avg Memory Usage : 8   (mem.usage.average)

Avg Memory Usage MB : 5879 (mem.consumed.average)

 

I just wanted to find out what the mem.consumed.average value shows, as from the above value the average mem consumed is quite high same as the memory allocated but the percentage used is quite low.  So which value do we follow.  Does the consumed value shows that how much of the guest memory has been touched but not used.   Can anyone please advise, as I need to explain these reports to management.


Viewing all articles
Browse latest Browse all 207710

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>