#!/bin/bash echo '<<>>' ############### Dell perc 6/i ############# if [ -a /opt/dell/srvadmin/bin/omreport ] then CONTROLLER=`/opt/dell/srvadmin/bin/omreport storage controller` # Get Controller Info CINFO=$(echo "$CONTROLLER" | grep Status) CINFOSTAT=$(echo "$CINFO" | cut -d':' -f2) CINFOSTAT=${CINFOSTAT:1} echo Controller Status=$CINFOSTAT IFS=' ' set -f #Drive status DRIVES=`/opt/dell/srvadmin/bin/omreport storage pdisk controller=0 -fmt ssv | sed -n '/[0-1].*/p'` for line in $DRIVES do DRIVEINFO=$(echo "$line" | cut -d';' -f1) DRIVESTATUS=$(echo "$line" | cut -d';' -f2) echo Drive $DRIVEINFO=$DRIVESTATUS done set +f unset IFS #echo $DRIVES fi ################## Dell LSI Controllers ############## if [ -a /opt/MegaRAID/MegaCli/MegaCli64 ] then RAID=/tmp/lsi.$$ #TODO figure out how to get controller status CTRLSTAT=Ok echo Controller Status=$CTRLSTAT #WARNING need to disable the stderr redirection to null in check_mk script /opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -aAll -NoLog > $RAID 2>&1 CTRLBATINFO="$(grep "Battery State" $RAID | cut -d\: -f2)" CTRLBATINFO=$(echo $CTRLBATINFO) [ "$CTRLBATINFO" = "Operational" ] && CTRLBATINFO=Ok #echo Battery Status=$CTRLBATINFO /opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -Lall -aALL -NoLog > $RAID let iLOGICALDEV=0 grep "Virtual Drive:" $RAID | while read DEVICE; do STATUS="$(grep -A 5 "$DEVICE" $RAID | tail -1 | cut -d\: -f2)" STATUS=${STATUS:1} [ "$STATUS" = "Optimal" ] && STATUS=Ok echo Logical Drive $iLOGICALDEV=$STATUS let iLOGICALDEV++ done /opt/MegaRAID/MegaCli/MegaCli64 -PDList -aALL -NoLog > $RAID let iDEVICE=0 grep "Device Id" $RAID | while read DEVICE; do STATUS="$(grep -A 12 "$DEVICE" $RAID | tail -1 | cut -d\: -f2)" STATUS=${STATUS:1} [ "$STATUS" = "Online, Spun Up" ] && STATUS=Ok echo Drive $iDEVICE=$STATUS let iDEVICE++ done rm -f $RAID fi #################### Adaptec controllers #################### if [ -a /usr/StorMan/arcconf ] then RAID=/tmp/adpatec.$$ /usr/StorMan/arcconf getconfig 1 al > $RAID CTRLSTAT="$(grep "Controller Status" $RAID | cut -d\: -f2)" CTRLSTAT=$(echo $CTRLSTAT) [ "$CTRLSTAT" = "Optimal" ] && CTRLSTAT=Ok echo Controller Status=$CTRLSTAT CTRLBATINFO="$(grep -A 2 "Controller Battery" $RAID|grep "Status"|cut -d\: -f2)" CTRLBATINFO=$(echo $CTRLBATINFO) [[ "$CTRLBATINFO" = "Optimal" || "$CTRLBATINFO" = "Charging" ]]; CTRLBATINFO=Ok echo Battery Status=$CTRLBATINFO CTRTEMP="$(grep "Temperature" $RAID| cut -d\: -f2|awk '{print $5}')" CTRTEMP=$(echo $CTRTEMP) [ "$CTRTEMP" = "(Normal)" ] && CTRTEMP=Ok echo Controller Temp=$CTRTEMP let iLOGICALDEV=0 grep "Status of logical device" $RAID | cut -d\: -f2 | while read STATUS; do [ "$STATUS" = "Optimal" ] && STATUS=Ok echo Logical Drive $iLOGICALDEV=$STATUS let iLOGICALDEV++ done let iLOGICALDEV=0 grep "Failed stripes" $RAID| cut -d\: -f2 | while read STATUS; do [ "$STATUS" = "No" ] && STATUS=Ok echo Logical Drive Stripe $iLOGICALDEV=$STATUS let iLOGICALDEV++ done let iDEVICE=0 grep "Device #" $RAID | while read DEVICE; do STATUS="$(grep -A 2 "$DEVICE" $RAID | tail -1 | cut -d\: -f2)" STATUS=${STATUS:1} [ "$STATUS" = "Online" ] && STATUS=Ok echo Drive $iDEVICE=$STATUS let iDEVICE++ done rm -f $RAID fi ################## MPT status ############## # https://jira.observium.org/browse/OBS-3733 if [ -a /usr/sbin/mpt-status ] then # you need to use option -p/--probe_id to probe SCSI id's when not on id 0 # and then use -i/--set_id to set id of primary device # change value in next sting SCSIID=6 RAID=$(mktemp) #TODO figure out how to get controller status CTRLSTAT=Ok echo Controller Status=$CTRLSTAT /usr/sbin/mpt-status -i $SCSIID -s -n > $RAID # Example output: #vol_id:9 OPTIMAL #phys_id:1 ONLINE #phys_id:0 ONLINE #scsi_id:1 100% #scsi_id:0 100% STATUS=$(grep "vol_id:$SCSIID" $RAID | cut -f 2 -d\ ) [ "$STATUS" = "OPTIMAL" ] && STATUS=Ok echo Logical Drive $SCSIID=$STATUS # CTRLBATINFO="$(grep "Battery State" $RAID | cut -d\: -f2)" # CTRLBATINFO=$(echo $CTRLBATINFO) # [ "$CTRLBATINFO" = "Operational" ] && CTRLBATINFO=Ok # #echo Battery Status=$CTRLBATINFO # # /opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -Lall -aALL -NoLog > $RAID # # /opt/MegaRAID/MegaCli/MegaCli64 -PDList -aALL -NoLog > $RAID # grep "phys_id" $RAID | while read DEVICE; do STATUS=$(grep "$DEVICE" $RAID | cut -f 2 -d\ ) DRIVE=$(grep "$DEVICE" $RAID | cut -f 1 -d\ |cut -f 2 -d\:) # STATUS=${STATUS:1} [ "$STATUS" = "ONLINE" ] && STATUS=Ok echo Drive $DRIVE=$STATUS done rm -f $RAID fi ################## cciss vol status status ############## # https://jira.observium.org/browse/OBS-3733 if [ -a /usr/bin/cciss_vol_status ] then # change value in next sting if you need DEVICE=/dev/sg0 RAID=$(mktemp) #TODO figure out how to get controller status CTRLSTAT=Ok echo Controller Status=$CTRLSTAT /usr/bin/cciss_vol_status --verbose $DEVICE > $RAID # Example output #Controller: Smart Array P400i # Board ID: 0x3235103c # Logical drives: 2 # Running firmware: 7.22 # ROM firmware: 7.22 #/dev/sda: (Smart Array P400i) RAID 1 Volume 0 status: OK. #/dev/sdb: (Smart Array P400i) RAID 5 Volume 1 status: OK. # Physical drives: 6 # connector 1I box 1 bay 1 HP EH0146FCBVB 94N0A09LFRQ11439 HPD4 OK # connector 1I box 1 bay 2 HP EH0146FCBVB 94P0A07LFRQ11439 HPD4 OK # connector 1I box 1 bay 3 HP DH072ABAA6 3PD0VL20000098153V5V HPDB S.M.A.R.T. predictive failure. # connector 1I box 1 bay 4 HP DH072ABAA6 3PD0V5V20000981533W9 HPDB OK # connector 2I box 1 bay 5 HP DH072ABAA6 3PD01R4700009748XSQF HPD2 OK # connector 2I box 1 bay 6 HP DG072A8B54 3LB0PMLV00007701Q2LR HPD7 OK #/dev/sg0(Smart Array P400i:0): Non-Volatile Cache status: # Cache configured: Yes # Total cache memory: 208 MiB # Cache Ratio: 25% Read / 75% Write # Read cache memory: 52 MiB # Write cache memory: 156 MiB # Write cache enabled: No # Write cache temporarily disabled # Temporary disable condition. Posted write operations have #been disabled due to the fact that less than 75% of the #battery packs are at the sufficient voltage level. LOGICALDRIVESCOUNT=$(grep "Logical drives" $RAID | cut -f 5 -d\ ) [ "$LOGICALDRIVESCOUNT" = "" ] && LOGICALDRIVESCOUNT=0 LOGICALDRIVEN=0 while [ $LOGICALDRIVEN -lt $LOGICALDRIVESCOUNT ] do LOGICALDEVICE=$(grep "Volume $LOGICALDRIVEN status" $RAID | cut -f 1 -d\:) STATUS=$(grep "Volume $LOGICALDRIVEN status" $RAID | rev | cut -f 1 -d: | rev | tr -d \ \. ) [ "$STATUS" = "OK" ] && STATUS=Ok echo "Logical Drive $LOGICALDEVICE=$STATUS" LOGICALDRIVEN=$(( $LOGICALDRIVEN +1 )) done cat $RAID | awk '/bay/ {print $9}' | while read DISKSERIAL; do STATUS=$(grep $DISKSERIAL $RAID | awk '/bay/ {for(i=11;i<=NF;i++) printf $i" "; print ""}' ) [[ "$STATUS" = "OK" || "$STATUS" = "OK " ]] && STATUS=Ok [[ "$STATUS" = "S.M.A.R.T. predictive failure." || "$STATUS" = "S.M.A.R.T. predictive failure. " ]] && STATUS=Non-Critical echo Drive $DISKSERIAL=$STATUS done rm -f $RAID fi