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.
Asked
Active
Viewed 3,631 times
4
-
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/ – Vishal Aug 06 '21 at 10:53
2 Answers
1
In InfluxDB v2.x, you could take advantage of the internal stats as following:
from(bucket: "yourBucket")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "storage_shard_disk_size")
|> filter(fn: (r) => r["_field"] == "gauge")
|> last()

Munin
- 1,576
- 2
- 19
-
At `v.timeRangeStart` and `v.timeRangeStop` I'm getting: `Error: failed to execute query: 400 Bad Request: error @1:49-1:50: undefined identifier v` What does v mean in this Flux expression? – NoahR Jul 22 '23 at 22:03
-
Can you double check the Variables tab on the Chronograf according to https://docs.influxdata.com/influxdb/v2.0/visualize-data/variables/? – Munin Jul 26 '23 at 10:51
0
Nothing springs immediately to mind in Flux to do this but you could just backup one specific bucket using the influx backup command and then just query the local directory size in your filesystem.

FractalDoctor
- 2,496
- 23
- 32
-
1I 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/ – Vishal Aug 06 '21 at 10:52