Last active
June 9, 2022 07:44
-
-
Save wido/27d7525a1d4effdc72efa6764351e518 to your computer and use it in GitHub Desktop.
Ceph RADOS Gateway bucket statistics
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Get the usage statistics of all RGW buckets | |
# | |
# Sort output with: ./rgw-bucket-stats.sh|sort -k 2 -n|tac | |
# | |
# Author: Wido den Hollander <[email protected]> | |
# | |
for BUCKET in $(radosgw-admin bucket list|python -c "import json,sys; [sys.stdout.write(bucket + '\n') for bucket in json.load(sys.stdin)]"); do | |
STATS=$(radosgw-admin bucket stats --bucket=$BUCKET) | |
KB=$(echo $STATS|python -c 'import sys, json; print(json.load(sys.stdin)["usage"]["rgw.main"]["size_kb_actual"])') | |
if [ "$?" -ne 0 ]; then | |
continue | |
fi | |
echo "$BUCKET $KB" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment