Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save endeepak/3a09d80c58bd732f815f2b25f2adafd7 to your computer and use it in GitHub Desktop.
Save endeepak/3a09d80c58bd732f815f2b25f2adafd7 to your computer and use it in GitHub Desktop.
Influxdb : Print cardinality / series count per measurement
#!/usr/bin/env bash
if [ "$#" -ne 1 ]
then
echo "Usage: $0 <db_name>"
exit 1
fi
db_name=$1
meaurement_names=$(influx -database $db_name -execute 'SHOW MEASUREMENTS' | tail -n +4)
for meaurement_name in $meaurement_names; do
number_of_series=$(influx -database $db_name -execute "SHOW SERIES FROM \"$meaurement_name\"" | tail -n +3 | wc -l)
echo "$meaurement_name $number_of_series"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment