Created
March 4, 2015 22:57
-
-
Save linuxkidd/1aa61ac7e36e01213068 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo osd,device,pci id,pci path,description | |
for i in $(mount | awk '/ceph\/osd/ {printf("%s,%s\n", $1, $3)}'); do | |
osdid=$(echo $i | awk -F, '{print $2}' | awk -F\/ '{sub (/[^0-9]+/, "", $NF); print "osd."$NF}') | |
basedev=$(basename $(echo $i | awk -F, '{print $1}' | sed -e 's/[0-9]//g')) | |
syspath=$(find /sys/devices/ -name $basedev) | |
hostpath=$(basename $(echo $syspath | awk -F\/host '{print $1}') | sed -e 's/^[0-9]*://') | |
if [ $(echo $hostpath | grep ata -c) -gt 0 ]; then | |
hostpath=$(basename $(dirname $(echo $syspath | awk -F\/host '{print $1}')) | sed -e 's/^[0-9]*://') | |
fi | |
hostdev=$(lspci | grep ^$hostpath) | |
echo "$osdid,$basedev,$hostdev" | sed -e 's/\ /,/' | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The objective is to identify which storage controller each OSD is plugged into.