Last active
December 5, 2017 20:38
-
-
Save drakonstein/0b2e72e1c1bc56d08b02e6c422f808b0 to your computer and use it in GitHub Desktop.
Find the average objects per pg in each Ceph pool
This file contains 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 | |
declare -A pool_pgs | |
declare -A pool_objs | |
output=$(ceph pg dump 2>/dev/null | awk '/active/ {print $1,$2}' | sed 's/\.[[:alnum:]]*//') | |
while read pool objs; do | |
pool_objs[$pool]=$(( ${pool_objs[$pool]:-0} + $objs)) | |
pool_pgs[$pool]=$(( ${pool_pgs[$pool]} + 1 )) | |
done <<< "$output" | |
output="pool+objects+pgs+per" | |
for pool in ${!pool_pgs[@]}; do | |
objs=${pool_objs[$pool]} | |
pgs=${pool_pgs[$pool]} | |
output="$output | |
$pool+$objs+$pgs+$(awk 'BEGIN {print '${objs}' / '${pgs}'}')" | |
done | |
echo "$output" | sort -n | column -t -s'+' | |
unset pool_pgs | |
unset pool_avg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment