[SOLVED] Read proxmox node pool(s) capacity via API

Jan 8, 2021
13
0
6
35
Hi everyone :)

We' re looking for a reliable way to read zfs pool 'usable capacity' total via the API ?

Please note that it's not the 'available', but the total, for example we've got two sub volumes in the pool:

vmdata-16k
vmdata-32k

when we use /nodes/{node}/storage we get the 'total' value for each one of those, but that total is for both the volumes because they are 'sub directories' of the same pool ? However that value is not static and changes overtime as the volumes get used.

So what would be the tactic to 'calculate' ? the pool's TOTAL capacity as it was configured?

Thanks in advance,
Aleksandra
 
Last edited:
Can you please explain a bit more what you mean with
the pool's TOTAL capacity as it was configured?

ZFS, especially when configured as "thin provisioned" will be quite dynamic in how much space is still available.

All datasets in the pool share the same free space and see the same free space unless you have quotas and reservations set up (happens with non thin provisioned ZFS storages).

If a dataset (for example VM, CT) have snapshots, those will use up more space, the more the current data diverges from the snapshot.

If you use the ZFS pool for other things as well, for example the system installation and we are talking about the default "local-zfs", then you have another factor that decides on the overall space available.
 
Hi,

Thanks for the reply, so what I mean is total space allocated to the pool - that can't change/expand unless is reconfigured ?

Now, our configuration:
1. Is thin provisioned
2. There are two pools, one is for OS etc, second is for the guests.

But to clarify once again, I don't need to know AVAILABLE and/or USED space, just the total for the pool - is there API endpoint to figure this out ?

Thanks,
Aleksandra
 
Okay, I think I got it now. The output of zfs list would have helped to grasp it quicker :)

In your pool you have two datasets ("volume" in ZFS terminology is a type of dataset, zvol) which you use to define two storages for Proxmox VE.

They both share the same free space in the pool, but have rather different used values, depending on the VM disks stored on them. This also leads to interesting graphs in the storage summary.

And now you would like to get the total of the whole pool via the API IIUC?

There is no API endpoint that can give you that info right away. But you should get there by fetching the infos for those two storages, and do the following calculation: vmdata-16k_used + vmdata-32k_used + vmdata-16k_available
 
Yeah,

That's the best I could come with in y head as well and it's better than what we have, however other than making our own rules around these sub volumes how do I know which once should be 'added' to the calculation from the /hodes/{node}/storage as there's no pool info coming along ?

Also if you don't mind telling me how & how often are these values monitored and updated in proxmox ? I.e. is this real time ?
 
You either know which pool the storages belong to, because you set it up, or you check the storage config via the "storage/<storage name>" API endpoint. https://pve.proxmox.com/pve-docs/api-viewer/index.html#/storage/{storage}

The "pool" key contains the path to <pool>/<sub dataset>.

Also if you don't mind telling me how & how often are these values monitored and updated in proxmox ? I.e. is this real time ?
This is done by the pvestatd daemon, which checks it every 10 seconds.
 
Good to hear. You can also mark a thread as solved by editing the first post. There should be a drop down menu next to the title :)
 

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!