Get Free/Total/Used space in SeaweedFS

116 views Asked by At

I can't seem to find how to get Used/Free/Total space of my SeaweedFS docker instance through some kind of API.

We're moving from Minio to SeaweedFS and in Minio, there was a GET API endpoint <minio_url>:<minio_port>/api/v1/admin/info from which I grabbed the needed info.

Is there something like this in SFS?

Minio example:

data_req = requests.get(f"http://{minio_url}/api/v1/admin/info", headers={"Cookie": f"token={token}"})
json_data = data_req.json()
parsed_data = json_data.get("servers")[0].get("drives")[0]

available_gb = math.ceil(parsed_data.get("availableSpace", 0) / 1024**3)
used_gb = math.ceil(parsed_data.get("usedSpace", 0) / 1024**3)
total_gb = math.ceil(parsed_data.get("totalSpace", 0) / 1024**3)

I know I can browse through the files and count the size iteratively. But that can be quite slow after a few hundreds of GB. I need to show this number on the top of our site.

1

There are 1 answers

0
chrislusf On

You can call gRPC API on filer

rpc Statistics (StatisticsRequest) returns (StatisticsResponse)