scRIPT
ceph pg dump | awk '
/^pg_stat/ { col=
1
; while($col!=
"up"
) {col++}; col++ }
/^[
0
-9
a-f]+\.[
0
-9
a-f]+/ { match($
0
,/^[
0
-9
a-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=