pvesh get /cluster/resources no DISK usage output on qemu VM

rojoblandino

Member
Sep 11, 2019
31
4
13
40
I have an old laptop for developing and testing, and i am doing a plugin for Nagios to get info from the VM's, Memory, Status and HD usage info. As the screenshoot I have posted i am getting the info from pvesh, but the Disk column is 0 always, with LXC containers i am not having problems.

First at all my PVE version:

Code:
proxmox-ve: 6.4-1 (running kernel: 5.4.140-1-pve)
pve-manager: 6.4-13 (running version: 6.4-13/9f411e79)
pve-kernel-5.4: 6.4-6
pve-kernel-helper: 6.4-6
pve-kernel-5.4.140-1-pve: 5.4.140-1
pve-kernel-5.4.128-1-pve: 5.4.128-2
pve-kernel-5.4.124-1-pve: 5.4.124-2
ceph-fuse: 12.2.11+dfsg1-2.1+b1
corosync: 3.1.2-pve1
criu: 3.11-3
glusterfs-client: 5.5-3
ifupdown: residual config
ifupdown2: 3.0.0-1+pve4~bpo10
libjs-extjs: 6.0.1-10
libknet1: 1.20-pve1
libproxmox-acme-perl: 1.1.0
libproxmox-backup-qemu0: 1.1.0-1
libpve-access-control: 6.4-3
libpve-apiclient-perl: 3.1-3
libpve-common-perl: 6.4-3
libpve-guest-common-perl: 3.1-5
libpve-http-server-perl: 3.2-3
libpve-storage-perl: 6.4-1
libqb0: 1.0.5-1
libspice-server1: 0.14.2-4~pve6+1
lvm2: 2.03.02-pve4
lxc-pve: 4.0.6-2
lxcfs: 4.0.6-pve1
novnc-pve: 1.1.0-1
openvswitch-switch: 2.12.3-1
proxmox-backup-client: 1.1.13-2
proxmox-mini-journalreader: 1.1-1
proxmox-widget-toolkit: 2.6-1
pve-cluster: 6.4-1
pve-container: 3.3-6
pve-docs: 6.4-2
pve-edk2-firmware: 2.20200531-1
pve-firewall: 4.1-4
pve-firmware: 3.3-1
pve-ha-manager: 3.1-1
pve-i18n: 2.3-1
pve-qemu-kvm: 5.2.0-6
pve-xtermjs: 4.7.0-3
qemu-server: 6.4-2
smartmontools: 7.2-pve2
spiceterm: 3.1-1
vncterm: 1.6-2
zfsutils-linux: 2.0.5-pve1~bpo10+1

When running the command pvesh get /cluster/resources I got following output, In the table i have an LXC running with id 100 and a qemu id 105, as it shows the LXC show the usage correctly but qemu VM is always 0:

Code:
┌────────────────────────┬─────────┬────────────────┬────────┬───────────┬─────────┬───────┬────────┬────────────┬────────────┬────────────┬──────────────┬─────────┬────────────┬──────┬───────────┬─────────┬─────────┐
│ id                     │ type    │ content        │    cpu │ disk      │ hastate │ level │ maxcpu │    maxdisk │     maxmem │ mem        │ name         │ node    │ plugintype │ pool │ status    │ storage │  uptime │
╞════════════════════════╪═════════╪════════════════╪════════╪═══════════╪═════════╪═══════╪════════╪════════════╪════════════╪════════════╪══════════════╪═════════╪════════════╪══════╪═══════════╪═════════╪═════════╡
│ lxc/100                │ lxc     │                │  0.00% │ 1.06 GiB  │         │       │      1 │  32.00 GiB │   1.00 GiB │ 38.58 MiB  │ www          │ develop │            │      │ running   │         │  3m 34s │
├────────────────────────┼─────────┼────────────────┼────────┼───────────┼─────────┼───────┼────────┼────────────┼────────────┼────────────┼──────────────┼─────────┼────────────┼──────┼───────────┼─────────┼─────────┤
│ lxc/101                │ lxc     │                │  0.00% │ 0.00 B    │         │       │      2 │  16.00 GiB │   1.00 GiB │ 0.00 B     │ cbpolicyd    │ develop │            │      │ stopped   │         │      0s │
├────────────────────────┼─────────┼────────────────┼────────┼───────────┼─────────┼───────┼────────┼────────────┼────────────┼────────────┼──────────────┼─────────┼────────────┼──────┼───────────┼─────────┼─────────┤
│ lxc/107                │ lxc     │                │  0.00% │ 0.00 B    │         │       │      1 │  32.00 GiB │ 512.00 MiB │ 0.00 B     │ testssh      │ develop │            │      │ stopped   │         │      0s │
├────────────────────────┼─────────┼────────────────┼────────┼───────────┼─────────┼───────┼────────┼────────────┼────────────┼────────────┼──────────────┼─────────┼────────────┼──────┼───────────┼─────────┼─────────┤
│ node/develop           │ node    │                │ 32.74% │ 6.19 GiB  │         │       │      4 │  14.70 GiB │   3.66 GiB │ 1.76 GiB   │              │ develop │            │      │ online    │         │ 10m 58s │
├────────────────────────┼─────────┼────────────────┼────────┼───────────┼─────────┼───────┼────────┼────────────┼────────────┼────────────┼──────────────┼─────────┼────────────┼──────┼───────────┼─────────┼─────────┤
│ qemu/102               │ qemu    │                │  0.00% │ 0.00 B    │         │       │      4 │  64.00 GiB │   3.00 GiB │ 0.00 B     │ win8         │ develop │            │      │ stopped   │         │      0s │
├────────────────────────┼─────────┼────────────────┼────────┼───────────┼─────────┼───────┼────────┼────────────┼────────────┼────────────┼──────────────┼─────────┼────────────┼──────┼───────────┼─────────┼─────────┤
│ qemu/103               │ qemu    │                │  0.00% │ 0.00 B    │         │       │      2 │  95.00 GiB │   2.00 GiB │ 0.00 B     │ winxpESXCLI  │ develop │            │      │ stopped   │         │      0s │
├────────────────────────┼─────────┼────────────────┼────────┼───────────┼─────────┼───────┼────────┼────────────┼────────────┼────────────┼──────────────┼─────────┼────────────┼──────┼───────────┼─────────┼─────────┤
│ qemu/104               │ qemu    │                │  0.00% │ 0.00 B    │         │       │      1 │  32.00 GiB │   2.00 GiB │ 0.00 B     │ cliente      │ develop │            │      │ stopped   │         │      0s │
├────────────────────────┼─────────┼────────────────┼────────┼───────────┼─────────┼───────┼────────┼────────────┼────────────┼────────────┼──────────────┼─────────┼────────────┼──────┼───────────┼─────────┼─────────┤
│ qemu/105               │ qemu    │                │ 52.52% │ 0.00 B    │         │       │      2 │  64.00 GiB │   2.00 GiB │ 198.85 MiB │ routerbridge │ develop │            │      │ running   │         │  9m 29s │
├────────────────────────┼─────────┼────────────────┼────────┼───────────┼─────────┼───────┼────────┼────────────┼────────────┼────────────┼──────────────┼─────────┼────────────┼──────┼───────────┼─────────┼─────────┤
│ qemu/106               │ qemu    │                │  0.00% │ 0.00 B    │         │       │      2 │  32.00 GiB │   2.00 GiB │ 0.00 B     │ ipv6toipv4   │ develop │            │      │ stopped   │         │      0s │
├────────────────────────┼─────────┼────────────────┼────────┼───────────┼─────────┼───────┼────────┼────────────┼────────────┼────────────┼──────────────┼─────────┼────────────┼──────┼───────────┼─────────┼─────────┤
│ qemu/108               │ qemu    │                │  0.00% │ 0.00 B    │         │       │      2 │  32.00 GiB │   1.00 GiB │ 0.00 B     │ ClearOS      │ develop │            │      │ stopped   │         │      0s │
├────────────────────────┼─────────┼────────────────┼────────┼───────────┼─────────┼───────┼────────┼────────────┼────────────┼────────────┼──────────────┼─────────┼────────────┼──────┼───────────┼─────────┼─────────┤
│ storage/develop/backup │ storage │ backup         │        │ 39.35 GiB │         │       │        │ 155.96 GiB │            │            │              │ develop │ pbs        │      │ available │ backup  │         │
├────────────────────────┼─────────┼────────────────┼────────┼───────────┼─────────┼───────┼────────┼────────────┼────────────┼────────────┼──────────────┼─────────┼────────────┼──────┼───────────┼─────────┼─────────┤
│ storage/develop/local  │ storage │ iso,vztmpl     │        │ 6.19 GiB  │         │       │        │  14.70 GiB │            │            │              │ develop │ dir        │      │ available │ local   │         │
├────────────────────────┼─────────┼────────────────┼────────┼───────────┼─────────┼───────┼────────┼────────────┼────────────┼────────────┼──────────────┼─────────┼────────────┼──────┼───────────┼─────────┼─────────┤
│ storage/develop/mypool │ storage │ rootdir,images │        │ 84.38 GiB │         │       │        │ 406.88 GiB │            │            │              │ develop │ zfspool    │      │ available │ mypool  │         │
└────────────────────────┴─────────┴────────────────┴────────┴───────────┴─────────┴───────┴────────┴────────────┴────────────┴────────────┴──────────────┴─────────┴────────────┴──────┴───────────┴─────────┴─────────┘

Only the LXC containers give me information but qemu VM's return me 0 on Disk Column, so I can not know of the usage of disk for that VM.

Is there any other way to get Disk usage for a qemy VM?

Another way i will have to read the info from qemu-img info file.qcow2 of each disk, but i would like to do that as a last resource.

Greetings!
 

Attachments

  • Captura de pantalla_2021-10-08_07-26-38.png
    Captura de pantalla_2021-10-08_07-26-38.png
    115.3 KB · Views: 12
Last edited:
pvesh is a debugging tool and does not provide that info. You need to query the REST API to get that info.
 
pvesh is a debugging tool and does not provide that info. You need to query the REST API to get that info.
I am getting from REST API the same information.
 

Attachments

  • Captura de pantalla_2021-10-11_15-33-56.png
    Captura de pantalla_2021-10-11_15-33-56.png
    19.6 KB · Views: 15
  • Captura de pantalla_2021-10-11_15-36-45.png
    Captura de pantalla_2021-10-11_15-36-45.png
    21.7 KB · Views: 13
Sorry, I was confused. The disk usage for VMs is always 0, because this is something only known by the guest.

> Is there any other way to get Disk usage for a qemy VM?

I guess the only way is to query the qemu agent (need a running agent in side the VM):

# qm guest cmd <VMID> get-fsinfo

> Another way i will have to read the info from qemu-img info file.qcow2 of each disk, but i would like to do that as a last resource.

This will not provide the Information you want.