I was searching all the documentation (forgive me if I didn’t find it) and I couldn’t find a way to make a request to the database, and it would return, for example, the number of measurements that a bucket has.
Found a related question
Hello
i’m new to Influx and i used relational databases in the past a lot.
I could not find a way to get the total number of measurements in a database.
I found out show measurements… but unfortunately no total numbers…
And related question, in relational databases, when you perform a query from their native CLI, i can get the total number which is quite useful…is there anything similar with Influxdb (some configuration parameter?)
thanks
influx -database telegraf -execute "show series" | tail -n +3 | awk -F, '{print $1}' | uniq | wc -l
Which gives a solution from flux cli (terminal) which is good information, but generally I want to ask influxdb directly for this information
scott
May 28, 2024, 4:38pm
2
@AnonymousWebHacker What version of InfluxDB are you using?
AnonymousWebHacker:
make a request to the database, and it would return, for example, the number of measurements that a bucket has
For InfluxDB 2 and flux that’s pretty easy to do:
import "influxdata/influxdb/schema"
schema.measurements(bucket: "example-bucket")
|> count()