piwik

dimecres, 5 de juny del 2013

Script that monitors the status of a HP physical RAID


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash

PHDRIVE[1]=`hpacucli ctrl all show config detail | grep "physicaldrive 1I:1:1" | awk '{print $10}' | sed 's/)//' | sed -e 's/[\t ]//g;/^$/d'`
PHDRIVE[2]=`hpacucli ctrl all show config detail | grep "physicaldrive 1I:1:2" | awk '{print $10}' | sed 's/)//' | sed -e 's/[\t ]//g;/^$/d'`
PHDRIVE[3]=`hpacucli ctrl all show config detail | grep "physicaldrive 1I:1:3" | awk '{print $10}' | sed 's/)//' | sed -e 's/[\t ]//g;/^$/d'`
PHDRIVE[4]=`hpacucli ctrl all show config detail | grep "physicaldrive 1I:1:4" | awk '{print $10}' | sed 's/)//' | sed -e 's/[\t ]//g;/^$/d'`
#PHDRIVE[1]="FAULT"
#PHDRIVE[2]="FAULT"
#PHDRIVE[3]="OK"
#PHDRIVE[4]="OK"
#echo ${PHDRIVE[1]}

#Meaning of the variable ALARM, 
# 0 ----------- No alarms, everything OK
# 1 ----------- Disk 1 doesn't have STATUS OK
# 2 ----------- Disk 2 doesn't have STATUS OK
# 3 ----------- Disk 3 doesn't have STATUS OK
# 4 ----------- Disk 4 doesn't have STATUS OK
ALARM=0

for i in `seq 1 4`;
do
  if [ "${PHDRIVE[$i]}" != "OK" ]; then
    ALARM=$i
  fi
done

echo $ALARM

Cap comentari:

Publica un comentari a l'entrada