Logoj0ke.net Open Build Service > Projects > server:monitoring > nagios-plugins-lsi > check_mpt2sas
Sign Up | Log In

File check_mpt2sas of Package nagios-plugins-lsi

 
1
#!/bin/bash
2
3
LIST=$(cat /proc/scsi/sg/devices | awk '{ print $NF }')
4
5
COUNT=1
6
for i in $LIST;
7
do
8
        FAILED=$(cat /proc/scsi/sg/device_strs | head -n$COUNT | tail -n1)
9
10
        if [ $i -eq "-1" ];
11
        then
12
                echo CRITICAL - $FAILED
13
                exit 2
14
        fi
15
16
        if [ $i -ne "1" ];
17
        then
18
                echo WTF - $FAILED
19
                exit 3
20
        fi
21
22
        let COUNT=COUNT+1
23
done
24
25
echo OK - $(cat /proc/scsi/sg/device_strs | sed 's/$/ -/' | paste $(perl -e "print \"- \"x$COUNT;"))
26