API get storage with content images

Apr 29, 2021
8
0
6
46
Hi.
I'm trying to write a script to calculate the sizes of the VM's disks in order to create an automated report of vm consumption (with cpu/ram/disk). With /api2/json/cluster/resources I only get the boot disk size which is not enough.

The idea is to get the data from API and insert it into a mysql database, and use the aggregated data in the sql db to create a report.

I can connect to API and extract data, all fine, but when I use a user with PVEauditor role, I cannot see content images in the /api2/json/nodes/{node}/storage/{storage}/content. I only get the content types iso and zst. However, when I connect with root account (for testing only), it shows fine.

Which permissions do I need to extract the content images from that API call? Any "safe" permissions instead of full admin?

Thanks in advance
--
Markus
 
Last edited:
Hi,
unfortunately, the check used for the content listing is the same as the check used for read access, so a bit restrictive right now. If a volume is owned by a VM, you need also need the VM.Config.Disk permission for that VM. Feel free to open a feature request to require fewer privileges for just listing the images on the bugtracker: https://bugzilla.proxmox.com/
 
Thanks for your reply.
I'll probably just use an account with correct privileges for the time being. I got it working just fine and am populating a database with point in time info of vm's right now.
 

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!