Skip to content

Instantly share code, notes, and snippets.

@concubidated
Last active January 2, 2016 15:38
Show Gist options
  • Save concubidated/8324399 to your computer and use it in GitHub Desktop.
Save concubidated/8324399 to your computer and use it in GitHub Desktop.
Pool RBD Usage
#!/bin/bash
declare -A POOLS;
for pool in $(ceph osd dump|grep pool|awk -F"'" '{print $2}');
do
for rbd in $(rbd list -p $pool 2>/dev/null);
do
if [ "$rbd" != "" ];then
size=$(rbd info -p $pool $rbd|grep size|awk '{print $2}');
let POOLS[$pool]+="$size";
fi;
done;
done;
for pool in "${!POOLS[@]}";
do
for size in ${POOLS[$pool]};
do
echo $pool: $size MB;
done;
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment