hi,
i searched for quite a while how to get to more detailed VM stats via api/cmdline and was lead to multiple wrong paths/dead ends.
eventually, i found that default text-based output of "pvesh get" is severely crippled, but you get to all of the vm performance/statistics data when you use json based output instead. it looks this isn't documented anywhere!? i would add an RFE to proxmox bugzilla then.
here is an example to get the bytes read and written to/from scsi0 disk:
i searched for quite a while how to get to more detailed VM stats via api/cmdline and was lead to multiple wrong paths/dead ends.
eventually, i found that default text-based output of "pvesh get" is severely crippled, but you get to all of the vm performance/statistics data when you use json based output instead. it looks this isn't documented anywhere!? i would add an RFE to proxmox bugzilla then.
here is an example to get the bytes read and written to/from scsi0 disk:
Code:
# pvesh get nodes/pve-node6/qemu/223/status/current --output-format=json | jq -jr '"scsi0.rd_bytes="
,.blockstat.scsi0.rd_bytes ,"," , "scsi0.wr_bytes=",.blockstat.scsi0.wr_bytes,"\n"'
scsi0.rd_bytes:190018602496,scsi0.wr_bytes:93583524352
Code:
# pvesh get nodes/pve-node6/qemu/223/status/current --output-format=text
Code:
┌─────────────────┬────────────────────┐
│ key │ value │
╞═════════════════╪════════════════════╡
│ agent │ 1 │
├─────────────────┼────────────────────┤
│ cpus │ 4 │
├─────────────────┼────────────────────┤
│ ha │ {"managed":0} │
├─────────────────┼────────────────────┤
│ lock │ backup │
├─────────────────┼────────────────────┤
│ maxdisk │ 40.00 GiB │
├─────────────────┼────────────────────┤
│ maxmem │ 8.00 GiB │
├─────────────────┼────────────────────┤
│ name │ gitlab │
├─────────────────┼────────────────────┤
│ pid │ 27590 │
├─────────────────┼────────────────────┤
│ qmpstatus │ running │
├─────────────────┼────────────────────┤
│ running-machine │ pc-i440fx-5.2+pve0 │
├─────────────────┼────────────────────┤
│ running-qemu │ 5.2.0 │
├─────────────────┼────────────────────┤
│ status │ running │
├─────────────────┼────────────────────┤
│ uptime │ 17w 1d 12h 51m │
├─────────────────┼────────────────────┤
│ vmid │ 223 │
└─────────────────┴────────────────────┘
Code:
# pvesh get nodes/pve-node6/qemu/223/status/current --output-format=json|jq "."|head -n30
Code:
{
"agent": 1,
"balloon": 8589934592,
"ballooninfo": {
"actual": 8589934592,
"free_mem": 572932096,
"last_update": 1677352844,
"major_page_faults": 3596724,
"max_mem": 8589934592,
"mem_swapped_in": 457097216,
"mem_swapped_out": 882458624,
"minor_page_faults": 23990786471,
"total_mem": 8200802304
},
"blockstat": {
"ide2": {
"account_failed": false,
"account_invalid": false,
"failed_flush_operations": 0,
"failed_rd_operations": 0,
"failed_unmap_operations": 0,
"failed_wr_operations": 0,
"flush_operations": 0,
"flush_total_time_ns": 0,
"idle_time_ns": 10414516232180416,
"invalid_flush_operations": 0,
"invalid_rd_operations": 0,
"invalid_unmap_operations": 0,
"invalid_wr_operations": 0,
"rd_bytes": 152,
Last edited: