# 在未 enable 及 setup 前, query 是沒有任何數據的 !!
vbox metrics query debian1
# 例出某 VM 可以收集的平均數據
vbox metrics list lxc "*:avg"
Object Metric Unit Minimum Maximum Period Count Description ---------- -------------------- ---- ---------- ---------- ---------- ---------- ----------- lxc CPU/Load/User:avg % 0 100000 1 1 lxc CPU/Load/Kernel:avg % 0 100000 1 1 lxc RAM/Usage/Used:avg kB 0 2147483647 1 1 lxc Guest/CPU/Load/User:avg % 0 100000 1 1 lxc Guest/CPU/Load/Kernel:avg % 0 100000 1 1 lxc Guest/CPU/Load/Idle:avg % 0 100000 1 1 lxc Guest/RAM/Usage/Total:avg kB 0 2147483647 1 1 lxc Guest/RAM/Usage/Free:avg kB 0 2147483647 1 1 lxc Guest/RAM/Usage/Balloon:avg kB 0 2147483647 1 1 lxc Guest/RAM/Usage/Shared:avg kB 0 2147483647 1 1 lxc Guest/RAM/Usage/Cache:avg kB 0 2147483647 1 1 lxc Guest/Pagefile/Usage/Total:avg kB 0 2147483647 1 1
metrics 的格式是
RAM/Usage/Used:avg
# setup 它
usage: vbox metrics setup [--samples <count>] <VM> [<metric_list>]
Example
vbox metrics setup debian1
# Default 是會一秒收集所有的數據一次
[--period <seconds>]
[--samples <count>]
# enable 它
vbox metrics enable debian1
# 查看1次
vbox metrics query debian2 "*:avg"
Object Metric Values ---------- -------------------- -------------------------------------------- debian2 CPU/Load/User:avg 5.05% debian2 CPU/Load/Kernel:avg 42.42% debian2 RAM/Usage/Used:avg 193408 kB debian2 Guest/CPU/Load/User:avg 58.00% debian2 Guest/CPU/Load/Kernel:avg 42.00% debian2 Guest/CPU/Load/Idle:avg 0.00% debian2 Guest/RAM/Usage/Total:avg 384636 kB debian2 Guest/RAM/Usage/Free:avg 337652 kB debian2 Guest/RAM/Usage/Balloon:avg 0 kB debian2 Guest/RAM/Usage/Shared:avg 0 kB debian2 Guest/RAM/Usage/Cache:avg 0 kB debian2 Guest/Pagefile/Usage/Total:avg 122872 kB
CPU 及 RAM 開頭的是它對 Host 的使用情況.
而Guest 開首的則是 VM 的內部情況.
# 不斷更新數據(1秒1次)
vbox metrics collect debian2 "*:avg"
後記:
就我觀測, 在 VM ilde 的情況下, host 都會有 3%左右的 overhead
Object Metric Values ---------- -------------------- -------------------------------------------- debian2 CPU/Load/User:avg 1.00% debian2 CPU/Load/Kernel:avg 2.00% debian2 RAM/Usage/Used:avg 193424 kB debian2 Guest/CPU/Load/User:avg 0.00% debian2 Guest/CPU/Load/Kernel:avg 0.00% debian2 Guest/CPU/Load/Idle:avg 100.00%