The script code is as follows:
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 ($ 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]; Poollist[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", Poollist[i]); printf ("|\n");
}‘
Script implementation Statistics The number of PG in the OSD