From 058a1d0baa8f24dc1f1519c297be0653c51b952e Mon Sep 17 00:00:00 2001 From: llnu Date: Wed, 27 May 2020 19:21:33 +0200 Subject: [PATCH] map-osd-to-disktype v1, changed from findmnt to lsblk, added more info to the output --- map-osd-to-disktype | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/map-osd-to-disktype b/map-osd-to-disktype index 552804a..4150bda 100755 --- a/map-osd-to-disktype +++ b/map-osd-to-disktype @@ -1,23 +1,24 @@ # Assumes, osd is up and # -OSDTYPE=ssd +#OSDTYPE=ssd # Tempfile /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 $OSDTYPE | grep -v down | cut -b 1-3); do findmnt -t xfs -n -o TARGET,SOURCE | grep "ceph-$osd " | cut -c 24- >> /tmp/list_osd_mountpoint.out; 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 "ceph-$osd " | cut -c 24- >> /tmp/list_osd_mountpoint.out; done +for osd in $(ceph osd tree | grep 'ssd\|hdd' | grep -v down | cut -b 1-3); do lsblk -p -o NAME,MOUNTPOINT | grep -w "/var/lib/ceph/osd/ceph-$osd" | cut -c 3- >> /tmp/list_osd_mountpoint.out ; done # Gets the Megacli mappings for the mountpoints -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 +for MOUNT in $(cat /tmp/list_osd_mountpoint.out | awk '{print $1}' | 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 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 +for megacli_mappings in $(cat /tmp/megacli-mappings.out); do awk '/Disk info/,0' /tmp/megaclisas-status.out | grep $megacli_mappings | cut -d '|' -f 2-6,8 >> /tmp/disk_types.out; done # Formatting, to get the local $OSDTYPE osd-s -for osd_num in $(cat /tmp/list_osd_mountpoint.out | awk '{print $1}'); 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 echo osd-$osd_num >> /tmp/local_osds.out; done # Combine and display the outputs paste /tmp/local_osds.out /tmp/disk_types.out