How to query hard disk usage via web API?

jtongen

New Member
Sep 25, 2020
10
0
1
46
I'd like to query the amount of hard disk space used on the server (or remaining) via the web API. I see I can query the total size of the hard disks via:

/nodes/{node}/disks/list

(There is a 'size' field in there). How can I query the size used or remaining, of the total size of the disk? It shows up in the webUI, but Im not able to find the rest API to query that information.


I'd like to be able to do this because it seems that proxmox VMs go unstable if the disk usage goes to 100%; it seems to allow additional clones but most of the VMs effectively crash at 100% disk consumption (my vm images are on a separate partition, so the server itself is fine).
 
## Storage usage
Code:
pvesh get /nodes/pve1/storage --output-format json-pretty --human-readable 1  | grep -i used_fra

Works fine so far. @jtongen How do you monitor this value? Some bash magic or some other tool/script?

## Overprovisioning

I also would like to monitor overprovisioning status for the lvmthin and directory based storage types. If it grows to much there could be storage problems when burst usage occurs (software updates e.g.).
Clearly it must be available since PVE shows a warning when migrating a disk.

How to do that via CLI?
Or is this a LVM feature showing this info? Any idea?
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!