Ceph map OSD to disk/drive serial number

A handy little script to output which Ceph OSD it mapped to which drive serial number:

#!/bin/bash

DISKS=`ceph-disk list | grep "ceph data"`
old_IFS=$IFS
IFS=$'\n'
#echo $DISKS
for DISK in $DISKS; do
        DEV=`awk '{print $1}' <<< $DISK`
        OSD=`awk '{print $7}' <<< $DISK`
        DEV=`echo $DEV | sed -e 's/\/dev\///g'`
        ID=`ls -l /dev/disk/by-id | grep $DEV | awk '{print $9}' | egrep -v "wwn"`
        echo $OSD $ID
done
IFS=$old_IFS