Get the Number of Placement Groups Per Osd
Get the PG distribution per osd in command line :
pool : 0 1 2 3 | SUM ------------------------------------------------osd.10 6 6 6 84 | 102osd.11 7 6 6 76 | 95osd.12 4 4 3 56 | 67osd.20 5 5 5 107 | 122osd.13 3 3 3 73 | 82osd.21 9 10 10 110 | 139osd.14 3 3 3 85 | 94osd.15 6 6 6 87 | 105osd.22 6 6 5 87 | 104osd.23 10 10 10 87 | 117osd.16 7 7 7 102 | 123osd.17 5 5 5 99 | 114osd.18 4 4 4 103 | 115osd.19 7 7 7 112 | 133osd.0 5 5 5 72 | 87osd.1 5 5 6 83 | 99osd.2 3 3 3 74 | 83osd.3 5 5 5 61 | 76osd.4 3 3 4 76 | 86osd.5 5 5 5 78 | 93osd.6 3 2 2 78 | 85osd.7 3 3 3 88 | 97osd.8 9 9 9 91 | 118osd.9 5 6 6 79 | 96------------------------------------------------SUM : 128 128 128 2048 |
The command :
123456789101112131415 | ceph pg dump | awk ' /^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]; su |