我正在寻找 ESX/ESXi 特定命令/示例 pyvmomi API 以确定管理程序上的系统内存信息 - 免费/总计/已使用。
最佳答案
运行 ESXi 主机命令
vsish -e get /memory/comprehensive
原始输出
Comprehensive {
Physical memory estimate:12454784 KB
Given to VMKernel:12454784 KB
Reliable memory:0 KB
Discarded by VMKernel:1580 KB
Mmap critical space:0 KB
Mmap buddy overhead:3084 KB
Kernel code region:18432 KB
Kernel data and heap:14336 KB
Other kernel:1421360 KB
Non-kernel:120036 KB
Reserved memory at low addresses:59900 KB
Free:10875956 KB
}
格式
vsish -e get /memory/comprehensive | sed 's/:/ /' | awk '
/Phys/ { phys = $(NF-1); units = $NF; width = length(phys) }
/Free/ { free = $(NF-1) }
END { print width, units, phys, phys-free, free }' |
while read width units phys used free; do
printf "Phys %*d %s\n" $width $phys $units
printf "Used %*d %s\n" $width $used $units
printf "Free %*d %s\n" $width $free $units
done
输出
Phys 12454784 KB
Used 1580564 KB
Free 10874220 KB
关于python - 如何通过 pyvmomi 或 cli 确定 ESX 管理程序上的总内存、空闲内存和可用内存?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42801307/