Created
March 14, 2018 08:00
-
-
Save Banshee1221/bfe99cec326bb0690d7f9919d9589c0b to your computer and use it in GitHub Desktop.
Ceph PG Summary Script
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
# Laurent Barbe | |
# http://cephnotes.ksperis.com/blog/2015/02/23/get-the-number-of-placement-groups-per-osd | |
ceph pg dump | awk ' | |
BEGIN { IGNORECASE = 1 } | |
/^PG_STAT/ { col=1; while($col!="UP") {col++}; col++ } | |
/^[0-9a-f]+\.[0-9a-f]+/ { match($0,/^[0-9a-f]+/); pool=substr($0, RSTART, RLENGTH); poollist[pool]=0; | |
up=$col; i=0; RSTART=0; RLENGTH=0; delete osds; while(match(up,/[0-9]+/)>0) { osds[++i]=substr(up,RSTART,RLENGTH); up = substr(up, RSTART+RLENGTH) } | |
for(i in osds) {array[osds[i],pool]++; osdlist[osds[i]];} | |
} | |
END { | |
printf("\n"); | |
printf("pool :\t"); for (i in poollist) printf("%s\t",i); printf("| SUM \n"); | |
for (i in poollist) printf("--------"); printf("----------------\n"); | |
for (i in osdlist) { printf("osd.%i\t", i); sum=0; | |
for (j in poollist) { printf("%i\t", array[i,j]); sum+=array[i,j]; sumpool[j]+=array[i,j] }; printf("| %i\n",sum) } | |
for (i in poollist) printf("--------"); printf("----------------\n"); | |
printf("SUM :\t"); for (i in poollist) printf("%s\t",sumpool[i]); printf("|\n"); | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment