I got cpu and memory usage of ESXi host from following code
cpu_usage = host.summary.quickStats.overallCpuUsage
memory_usage =host.summary.quickStats.overallMemoryUsage
ie,
cpu_usage = 200
memory_usage = 4699
Howto calculate percentage of utlilization from values ??
Have any other way to find cpu and memory utilization percentage ??
Hi,
Can i calculate percentage of cpu and memory utilization like ???
cpu utilization
===========
overallCpuUsage = host.summary.quickStats.overallCpuUsage
numCpuCores = host.summary.hardware.numCpuCores
numCpuPkgs = host.summary.hardware.numCpuPkgs
cpuMhz = host.summary.hardware.cpuMhz
cpu_usage_percentage = ( overallCpuUsage / ( numCpuPkgs * numCpuCores * cpuMhz ) ) * 100 <=== ??
I got this equation from link bellow
Memory utilization
================
overallCpuUsage = host.summary.quickStats.overallCpuUsage
memorySize = host.summary.hardware.memorySize
memory_usage_percentage = (overallCpuUsage / memorySize) * 100 <=== ??
I believe numCores is the total across all CPU sockets, but I would validate it.
(numCores * cpuMhz) = cpuTotalMhz
(memorySize /1048576) = memTotalMB
Then use the quickStats values to calculate a % usage.
Yeah, that's just 1024 * 1024 to convert B to MB.
Hi stumpr,
thanks for this info
Could you please confirm this
cpu_usage_percent = ( (numCores*cpuMhz) / cpu_usage ) * 100
mem_usage_percent = ( (memorySize*1048576) / mem_usage ) * 100
thanks
That should be it. as long as cpu_usage is Mhz and mem_usage is MB from the quickStats properties.
Hi,
This example should be helpful for others
QuickStats
overallCpuUsage = 191
overallMemoryUsage = 4708
cpu_mhz = 2933
numCores = 2
memorySize = 5298638848
cpu_usage_perc = ( overallCpuUsage / ( numCores * cpu_mhz ) ) * 100
cpu_usage_perc = 3.2
mem_usage_perc = ( overallMemoryUsage / ( memorySize / (1024*1024) ) ) * 100
mem_usage_perc = 93.1
I have following data from Virtual machine and I want to calculate percentage of cpu and memory utilization.
Note : I could not find cpuMhz of Virtual machine.
config.hardware
============
memoryMB = 8192
numCPU = 2
numCoresPerSocket = 1
summary.quickStats
===============
overallCpuUsage = 116
guestMemoryUsage = 409
hostMemoryUsage = 3609
* I think percentage of memory utilization can be calculate like ????
mem_usage_perc = ( guestMemoryUsage / memoryMB ) * 100
mem_usage_perc = 4.9
* How calculate percentage of cpu utilization ???