Backup & Recovery

The script is intended to automate the drive monitoring.

The drive goes down due to read / write failures.

The monitoring needs to be done to bring up the drives to make sure that backup happens through those drives.

This script is in execution in our environment and it list the defaultd drives and brings them back in operation. Use the following parameter to use them in log files.
 

FNAME=`date '+%m%d%Y-%HHRS`

SNAME=`date '+%B-%d-%Y-%HHRS'`



  1. List the original status of the drives before the action is taken

/usr/openv/volmgr/bin/vmoprcmd | grep -i down > Drive_Status/OUTPUT/Drive_Origin.$FNAME

Check for the available media servers and list that to a file. It is good to list it to a file.

/usr/openv/netbackup/bin/admincmd/nbemmcmd - listhosts > Drive_Status/Available_Media_Servers

    3. Grep the media servers list and execute the volume manger operational command to find the list of defaulted drives

for server in `cat /stuvnbkm1e/Drive_Status/Available_Media_Servers`

do

/usr/local/bin/sudo /usr/openv/volmgr/bin/vmoprcmd -devconfig -l -h $server | grep -i down | awk '{print $8, $9, $3, $4}'| grep -v "hcart2" > /Drive_Status/OUTPUT/drivestate.$server

I am taking action only for VTL drives because as we want to list out physical drives seperately. That is the reason why we are excluding hcart2 type drives

   4. Check the log file for each server seperately and take action for defaulted drives. The details of the drive, drive path, index num , drive type are stored in the file.

if [ `cat /stuvnbkm1e/Drive_Status/OUTPUT/drivestate.$server | wc -l` -gt 0 ]; then

echo $server >> /Drive_Status/driveupdates

echo "========================================" >> Drive_Status/driveupdates

echo " " >> Drive_Status/driveupdates

cat Drive_Status/OUTPUT/drivestate.$server >> Drive_Status/driveupdates

for indexnum in `cat Drive_Status/OUTPUT/drivestate.$server | awk '{print $3}'`

do

/usr/openv/volmgr/bin/vmoprcmd -up $indexnum -h $server

done

echo " " >> Drive_Status/driveupdates

fi

done


      5. The drive will now be made up and the details will be available in the log file.

     
      6. We are taking the details alone without bringing up the physical drives as we want to monitor them seperately


 

echo "LTO4 Down Drive Status as of " $SNAME " -- NEEDS TO BE BROUGHT UP MANUALLY" > Drive_Status/drivestateLTO4.$FNAME

echo "========================================================================================" >> Drive_Status/drivestateLTO4.$FNAME

echo " " >> Drive_Status/drivestateLTO4.$FNAME

for server in `cat Drive_Status/Available_Media_Servers`

do

/usr/local/bin/sudo /usr/openv/volmgr/bin/vmoprcmd -devconfig -l -h $server| grep -i down | grep -v PENDING | grep -i "hcart2" | awk '{print $8, $9, $3, $4}'>> Drive_Status//drivestateLTO4.$FNAME

done

echo " " >> Drive_Status/driveupdates

echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" >> Drive_Status/driveupdates

echo " " >> Drive_Status/driveupdates

cat /stuvnbkm1e/Drive_Status/drivestateLTO4.$FNAME >> Drive_Status/driveupdates


                7. The drive update file will have the details in the formatted manner and can be mailed or read from the server. If a drive appears repeatedly on the log then you need to verify the configurations manually.

cat /Drive_Status/driveupdates | mailx -s "Drive Status Report as of "$SNAME bkp@123.com



SAMPLE OUTPUT FILE:

Down Drive Status as of July-09-2010-00HRS

===============================================

###### Please check the status of the drives once manually #######

###### LTO 4 drives have to be manually made up #######

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

SERVER 1
========================================

DR51-BKM11E-NBC2A-Drive10 /dev/rmt/36cbn 40  hcart3

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

* The status of drives before action taken has been stored at --> /stuvnbkm1e/Drive_Status/OUTPUT/Drive_Origin.07092010-00HRS *

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++