return to PRS Technologies website


ck_hp_disk_status.sh
#!/usr/bin/ksh ############################################################################### # # Module: ck_hp_disk_status.sh # Author: Peter R. Schmidt # Description: Check on status of HPUX disks # # Change Log # # Date Name Description................. # 05/23/01 Peter R. Schmidt Start Program # ############################################################################### type vgdisplay > /dev/null 2>&1 if [ $? != 0 ];then echo "Error in ck_hp_disk_status: vgdisplay not found." exit 1 fi type pvdisplay > /dev/null 2>&1 if [ $? != 0 ];then echo "Error in ck_hp_disk_status: pvdisplay not found." exit 1 fi type lvdisplay > /dev/null 2>&1 if [ $? != 0 ];then echo "Error in ck_hp_disk_status: lvdisplay not found." exit 1 fi vgdisplay -v | awk ' \ /VG Name/ { vg_name = $3 } /LV Name/ { lv_name = $3 } /PV Name/ { pv_name = $3 } /Status/ { # printf "debug: %s %s %s\n",$1,$2,$3 flag_problem=0; vol_type=$1 vol_status=$3 if (vol_type == "VG") { if (vol_status != "available") { flag_problem=1 } } if (vol_type == "PV") { if (vol_status != "available") { flag_problem=1 } } if (vol_type == "LV") { if (vol_status != "available/syncd") { flag_problem=1 } } if (flag_problem == 1) { printf "WARNING: a HP/UX disk or mirror appears to be down.\n" if (vol_type == "VG") { printf " Type: %s, Name: %s, Status: %s\n",vol_type,vg_name, vol_status printf "\n" runtxt = sprintf "vgdisplay %s",vg_name system (runtxt) } if (vol_type == "PV") { printf " Type: %s, Name: %s, Status: %s\n",vol_type,pv_name, vol_status printf "\n" runtxt = sprintf "pvdisplay %s",pv_name system (runtxt) } if (vol_type == "LV") { printf " Type: %s, Name: %s, Status: %s\n",vol_type,lv_name, vol_status printf "\n" runtxt = sprintf "lvdisplay %s",lv_name system (runtxt) } printf "\n" } } ' \ ###############################################################################