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

[root@server]# sudo -u influxdb influx bucket list
ID                      Name                    Retention       Shard group duration    Organization ID         Schema Type
ac0875d38424582f        _monitoring             168h0m0s        24h0m0s                 xxxxxxxxxxxxxxxx        implicit
f92231ce585d2e6c        _tasks                  72h0m0s         24h0m0s                 xxxxxxxxxxxxxxxx        implicit
686d3c919b5f28d1        default                 672h0m0s        24h0m0s                 xxxxxxxxxxxxxxxx        implicit
9e5b8ddca4fd19e8        default_downsampled     8760h0m0s       168h0m0s                xxxxxxxxxxxxxxxx        implicit
[root@server]# du --max-depth=1 -h /var/lib/influxdb/engine/data
156K    /var/lib/influxdb/engine/data/ac0875d38424582f
3.7G    /var/lib/influxdb/engine/data/686d3c919b5f28d1
384K    /var/lib/influxdb/engine/data/f92231ce585d2e6c
210M    /var/lib/influxdb/engine/data/9e5b8ddca4fd19e8
2 Likes