extended dumper which also dumps controller information
authorDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 29 Sep 2011 20:47:11 +0000 (20:47 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 29 Sep 2011 20:47:11 +0000 (20:47 +0000)
git-svn-id: svn://svn.rot13.org/sysadmin-cookbook@277 191e9f34-6774-4a6d-acfc-7664dacd4a2a

recepies/smart/dump-smart.sh [new file with mode: 0755]

diff --git a/recepies/smart/dump-smart.sh b/recepies/smart/dump-smart.sh
new file mode 100755 (executable)
index 0000000..32e9464
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/sh -x
+
+tw_cli=/srv/3ware/x86_64/tw_cli
+sas2ircu=/srv/sas2ircu_linux_x86_rel/sas2ircu
+
+cd /srv/smart
+dir=`hostname -s`
+test -d $dir || mkdir $dir
+cd $dir
+#ls -d /sys/block/sd* | cut -d/ -f4 | xargs -i sh -cx "/usr/sbin/smartctl -a /dev/{} > smart.{}"
+
+if [ -z "$DEBUG" ] ; then
+
+ls /dev/disk/by-id/scsi-* | grep -v part[0-9]* | while read dev ; do
+       echo $dev
+       name=`echo $dev | sed 's/^.*scsi-//'`
+       sudo smartctl -a $dev > smart.$name
+done
+
+fi
+
+test -x $sas2ircu && $sas2ircu LIST | grep 1000h | awk '{ print $1 }' | xargs -i $sas2ircu {} DISPLAY > controller.lsi_sysbios
+
+if [ -x $tw_cli ] ; then
+       controller=`$tw_cli show | grep ^c[0-9] | cut -d" " -f1`
+       if [ ! -z "$controller" ] ; then
+               $tw_cli /$controller show all > controller.3ware
+               $tw_cli /$controller/bbu show all >> controller.3ware
+       fi
+fi
+
+test ! -z "$DEBUG" && exit 1
+
+git add smart.sd* controller.*
+git commit -m `date +%Y-%m-%d.%H:%M:%S` -a