Storaged Used

API

New Member
Dec 4, 2013
9
1
1
How can I get the storage used for a "directory" type storage from the API? I can't seem to figure it out.
 
Last edited:
No, that returns info for the specific node. I need overall storage info.

I know that the syntax involves the <node> but in the output I see all cluster-shared storages.
Since you asked about "storage directory" and that could be local to each node, if you mean a "directory" storage type

otherwise, I don't know how.

Marco
 
I know that the syntax involves the <node> but in the output I see all cluster-shared storages.
Since you asked about "storage directory" and that could be local to each node, if you mean a "directory" storage type

otherwise, I don't know how.

Marco

That's what I mean. A "directory" storage type.
 
That's what I mean. A "directory" storage type.

well, the default "local" storage is a "directory" storage type

in the output of pvesh nodes/<nodename>/storage I get, amongst the others:
{
"active" : 1,
"avail" : "2813050880",
"content" : "images,iso,vztmpl,backup,rootdir",
"shared" : 0,
"storage" : "local",
"total" : "34935173120",
"type" : "dir",
"used" : "32122122240"
}

so you should be able to process this output and get total, used, avail sizes. Or am I missing smething (it could easily be) ?

Marco
 
well, the default "local" storage is a "directory" storage type

in the output of pvesh nodes/<nodename>/storage I get, amongst the others:
{
"active" : 1,
"avail" : "2813050880",
"content" : "images,iso,vztmpl,backup,rootdir",
"shared" : 0,
"storage" : "local",
"total" : "34935173120",
"type" : "dir",
"used" : "32122122240"
}

so you should be able to process this output and get total, used, avail sizes. Or am I missing smething (it could easily be) ?

Marco

Log into the GUI, click on the storage called "local" and tell me if that's equal to ~29.9 GB. If not, these two numbers don't match (32122122240/(1024^3) = used in GB).
 
Log into the GUI, click on the storage called "local" and tell me if that's equal to ~29.9 GB. If not, these two numbers don't match (32122122240/(1024^3) = used in GB).

Proxmox Virtual Environment_2014-05-27_14-25-03.jpg

eg: used is

32122122240 = 1024*1024*1024*29.916
so 29,92 (rounded) is the same in bytes, and so on. At least on my system.

[edit]

also
pvesh get nodes/<nodename>/storage/local/status
gives directly the asked storage info:
{
"active" : 1,
"avail" : "2813050880",
"content" : "images,iso,vztmpl,backup,rootdir",
"shared" : 0,
"total" : "34935173120",
"type" : "dir",
"used" : "32122122240"
}



Marco
 
Last edited: