From 86229de0f26f9341aa7fe83971e7e66abd89ddda Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Thu, 29 Sep 2011 20:47:11 +0000 Subject: [PATCH] extended dumper which also dumps controller information git-svn-id: svn://svn.rot13.org/sysadmin-cookbook@277 191e9f34-6774-4a6d-acfc-7664dacd4a2a --- recepies/smart/dump-smart.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 recepies/smart/dump-smart.sh diff --git a/recepies/smart/dump-smart.sh b/recepies/smart/dump-smart.sh new file mode 100755 index 0000000..32e9464 --- /dev/null +++ b/recepies/smart/dump-smart.sh @@ -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 -- 2.20.1