Fixing bugs in map disk types to osd script

This commit is contained in:
dse 2020-05-27 12:27:26 +02:00
parent 95b1922a36
commit fbf4618afe
1 changed files with 8 additions and 4 deletions

12
map-osd-to-disktype Normal file → Executable file
View File

@ -1,13 +1,17 @@
# Assumes, osd is up and
#
OSDTYPE=ssd
# Tempfile
./megacli-status > /tmp/megaclisas-status.out
/opt/ungleich-tools/megaclisas-status > /tmp/megaclisas-status.out
# Gets osd numbers of a particular device class, and gets their mountpoints on the host, and puts them into a tempfile
for osd in $(ceph osd tree | grep $OSD | grep -v down | cut -b 1-3); do findmnt -t xfs -n -o TARGET,SOURCE | grep $osd| cut -c 24- >> /tmp/list_osd_mountpoint; done
for osd in $(ceph osd tree | grep $OSDTYPE | grep -v down | cut -b 1-3); do findmnt -t xfs -n -o TARGET,SOURCE | grep $osd | cut -c 24- >> /tmp/list_osd_mountpoint.out; done
# Gets the Megacli mappings for the mountpoints
for MOUNT in $(cat /tmp/list_osd_mountpoint | awk '{print $2}' | sed 's/[0-9]*//g') ; do cat /tmp/megaclisas-status.out | grep $MOUNT | awk '{print $1}' >> /tmp/megacli-mappings.out; done
for MOUNT in $(cat /tmp/list_osd_mountpoint.out | awk '{print $2}' | sed 's/[0-9]*//g') ; do cat /tmp/megaclisas-status.out | grep $MOUNT | awk '{print $1}' >> /tmp/megacli-mappings.out; done
# Gets the hardware types for the Megacli mappings
for i in $(cat /tmp/megacli-mappings.out); do awk '/Disk info/,0' /tmp/megaclisas-status.out | grep $i | cut -d '|' -f 3 >> /tmp/disk_types; done
for megacli_mappings in $(cat /tmp/megacli-mappings.out); do awk '/Disk info/,0' /tmp/megaclisas-status.out | grep $megacli_mappings | cut -d '|' -f 3 >> /tmp/disk_types.out; done