Can I query the size of a database in influx db 2

I looked through the influx nodes and I can’t find an example of how to get the total size of a particular bucket. Is this possible, I’m using 2.x databases.

Hello @Vishal,
What do you mean by total size?
Series number?
Storage?
Are you using OSS or Cloud? If you’re using Cloud, I’d recommend looking at the following blog:

and installing the cloud usage template theres a query in that dashboard that graphs storage/bucket

I am using OSS (docker hub Image URI: influxdb:2.0.7). I’ve created a bucket named ‘TelemetryData’ and have ingested data into it. I would like to know how much disk space this bucket has taken using flux query.
For now, I am using below shell command to get bucket size:
du -sh /var/influxdb/engine/data/Bucket ID/

Hello @Vishal,
Unfortunately the usage.from() function can only query Cloud instances.

Thanks for sharing your solution.

Hi @Anaisdg,

Is it still not possible to query the size of the bucket using flux (OSS)?

Regarding Vishal’s solution, is there a influx CLI command I can use to query the size of the bucket?

Thanks in advance.

Hi @kouter

As a workaround, you can use the [inputs.filecount] plugin for telegraf and point it at ~/.influxdb2/. It returns the count and size of files in the directory. If you want it for a specific bucket, just set the directory path to ~.influxdbv2\engine\data\ [bucketid]. I believe this will accomplish what you are trying to do.

1 Like

@blharvey is there any solution for people who are not using telegraf.

is there a solution for OSS in recent times