[map-osd-to-disktype] improved formatting, printf fixed size, so the columns match every time! (probably will have a bug if we reach 99+ osds)

This commit is contained in:
dse 2020-05-27 20:13:39 +02:00
parent 4309c1639d
commit 97c1893dce

View file

@ -18,11 +18,11 @@ for MOUNT in $(cat /tmp/list_osd_mountpoint.out | awk '{print $1}' | sed 's/[0-9
for megacli_mappings in $(cat /tmp/megacli-mappings.out); do awk '/Disk info/,0' /tmp/megaclisas-status.out | grep -w "$megacli_mappings"p0 | cut -d '|' -f 2-6,8 >> /tmp/disk_types.out; done for megacli_mappings in $(cat /tmp/megacli-mappings.out); do awk '/Disk info/,0' /tmp/megaclisas-status.out | grep -w "$megacli_mappings"p0 | cut -d '|' -f 2-6,8 >> /tmp/disk_types.out; done
# Formatting, to get the local $OSDTYPE osd-s # Formatting, to get the local $OSDTYPE osd-s
for osd_num in $(cat /tmp/list_osd_mountpoint.out | awk '{print $2}' | cut -c 24- ); do echo osd-$osd_num >> /tmp/local_osds.out; done for osd_num in $(cat /tmp/list_osd_mountpoint.out | awk '{print $2}' | cut -c 24- ); do printf "%-7s%s\n" "osd-$osd_num" >> /tmp/local_osds.out; done
# Combine and display the outputs # Combine and display the outputs
paste /tmp/local_osds.out /tmp/disk_types.out paste /tmp/local_osds.out /tmp/disk_types.out -d '|'
# Cleanup *.out files in the temp dir # Cleanup *.out files in the temp dir
rm /tmp/*.out #rm /tmp/*.out