#!/bin/sh #---------------------------------------------------------------------------- # /var/install/bin/smartmon-report - show status of S.M.A.R.T. devices # # Creation: 01.01.2004 jb # Last Update: $Id$ # # Copyright (c) 2004-2008 Jens Berger # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #---------------------------------------------------------------------------- config_file=/etc/config.d/smartmon smartmon_report=/var/smartmon/smartmon_report # reading eislib . /var/install/include/eislib . $config_file rm -f $smartmon_report touch $smartmon_report for IDX in `/usr/bin/seq 1 $SMARTMON_DEVICE_N`; do eval smartmon_device_active='$SMARTMON_DEVICE_'$IDX'_ACTIVE' eval smartmon_device_type='$SMARTMON_DEVICE_'$IDX'_TYPE' eval smartmon_device_name='$SMARTMON_DEVICE_'$IDX'_NAME' if [ $smartmon_device_active = "yes" ]; then touch $smartmon_report if [ $smartmon_device_type = "3ware" ]; then maxports=31 if [ -z "`echo $smartmon_device_name | grep '/dev/tw[a|e]'`" ]; then maxports=15 fi for i in `/usr/bin/seq 0 $maxports`; do /usr/sbin/smartctl -d 3ware,$i -a $smartmon_device_name >/dev/null 2>&1 if [ $? == 0 ]; then smartmon_use_driver_options="-d 3ware,$i" echo "******************************************************************************************" >> $smartmon_report echo " Short report for drive with id $i of 3Ware-Raid '$smartmon_device_name'" >> $smartmon_report echo "******************************************************************************************" >> $smartmon_report /usr/sbin/smartctl -A $smartmon_device_name $smartmon_use_driver_options >> $smartmon_report fi done elif [ $smartmon_device_type = "cciss" ]; then for i in `/usr/bin/seq 0 127`; do /usr/sbin/smartctl -d cciss,$i -a $smartmon_device_name >/dev/null 2>&1 if [ $? == 0 ]; then smartmon_use_driver_options="-d cciss,$i" echo "******************************************************************************************" >> $smartmon_report echo " Short report for drive with id $i of SmartArray-Raid '$smartmon_device_name'" >> $smartmon_report echo "******************************************************************************************" >> $smartmon_report /usr/sbin/smartctl -A $smartmon_device_name $smartmon_use_driver_options >> $smartmon_report fi done # elif [ $smartmon_device_type = "areca" ]; then # for i in `seq 0 23`; do # /usr/sbin/smartctl -d areca,$i -a $smartmon_device_name >/dev/null 2>&1 # if [ $? == 0 ]; then # smartmon_use_driver_options="-d areca,$i" # echo "******************************************************************************************" >> $smartmon_report # echo " Short report for drive with id $i of Areca-Raid '$smartmon_device_name'" >> $smartmon_report # echo "******************************************************************************************" >> $smartmon_report # /usr/sbin/smartctl -A $smartmon_device_name $smartmon_use_driver_options >> $smartmon_report # fi # done elif [ $smartmon_device_type = "scsi" ]; then smartmon_use_driver_options="-d scsi" echo "******************************************************************************************" >> $smartmon_report echo " Short report for drive '$smartmon_device_name'" >> $smartmon_report echo "******************************************************************************************" >> $smartmon_report /usr/sbin/smartctl -A $smartmon_device_name $smartmon_use_driver_options >> $smartmon_report elif [ $smartmon_device_type = "ata" ]; then smartmon_use_driver_options="-d ata" echo "******************************************************************************************" >> $smartmon_report echo " Short report for drive '$smartmon_device_name'" >> $smartmon_report echo "******************************************************************************************" >> $smartmon_report /usr/sbin/smartctl -A $smartmon_device_name $smartmon_use_driver_options >> $smartmon_report elif [ $smartmon_device_type = "sat" ]; then smartmon_use_driver_options="-d sat" echo "******************************************************************************************" >> $smartmon_report echo " Short report for drive '$smartmon_device_name'" >> $smartmon_report echo "******************************************************************************************" >> $smartmon_report /usr/sbin/smartctl -A $smartmon_device_name $smartmon_use_driver_options >> $smartmon_report fi else echo "******************************************************************************************" >> $smartmon_report echo " Drive '$smartmon_device_name'" is skipped because it is deactivated in configuration file! >> $smartmon_report echo "******************************************************************************************" >> $smartmon_report fi done cat $smartmon_report | more anykey rm -f $smartmon_report exit 0