Monitoring disks and power supplies and fans and such...

Ben Russo ben at muppethouse.com
Thu May 27 08:54:02 CDT 2004


Michael Weber wrote:

>Hi, Ben.
>
>Would it be a problem to get a copy of your script?  I am just getting
>to write such a beast.
>
>Thanx!
>
>  
>
Sure Michael,

I actually got this from someone else on the mailing list a while ago. 
I'm sorry I don't remember who, or I would give due credit.

[root at bonzo root]# cd /etc/RAID
[root at bonzo RAID]# ls -lart
total 668
-rw-r--r--    1 root     root           86 Aug  6  2002 raid.check.commands
-rw-r--r--    1 root     root          331 Aug  6  2002 cronlist
-rwxr-xr-x    1 root     root       642103 Aug 25  2003 
afaapps-2.6-0.i386.rpm
-rw-r--r--    1 root     root         1228 Aug 26  2003 
raid.production.config
-rw-r--r--    1 root     root          119 Aug 26  2003 testmsg.txt
-rwx------    1 root     root          507 Aug 26  2003 raid.cronjob
drwxr-xr-x   55 root     root         8192 May 25 14:24 ..
-rw-r--r--    1 root     root         1228 May 27 08:47 raid.current.config
-rw-r--r--    1 root     root            0 May 27 08:47 raid.check.diff
drwxr-xr-x    2 root     root         4096 May 27 08:47 .

*[root at bonzo RAID]# crontab -l
#  MIN   HOUR   DOM     MOY     DOW     COMMAND
# (0-59) (0-23) (1-31)  (1-12)  (0-6) 0=Sunday
#_____  ______  ______  ______  ______  ______
47 1,8,19 * * * /etc/RAID/raid.cronjob > /dev/null 2>&1
*
[root at bonzo RAID]# cat raid.cronjob
#!/bin/bash
cd /etc/RAID
rm raid.current.config
/usr/sbin/afacli < /etc/RAID/raid.check.commands
diff raid.current.config raid.production.config > raid.check.diff
NUMLINES=`cat /etc/RAID/raid.check.diff | wc -l`
if [ $NUMLINES -gt 0 ]
        then
        logger -p kern.emerg -t DISK-ERROR cronjob 
/etc/RAID/raid.cronjob dead hard disk on BONZO.reston.tnsi.com, please 
check asap.
        sendmail Eli at mydomain.com < testmsg.txt
        sendmail Ben.Russo at mydomain.com < testmsg.txt
        sendmail 8772283694 at mydomain.com < testmsg.txt
        fi

[root at bonzo RAID]# cat raid.production.config
File raid.current.config receiving all output.

AFA0>
COMMAND: container list
Executing: container list
Num          Total  Oth Chunk          Scsi   Partition
Label Type   Size   Ctr Size   Usage   B:ID:L Offset:Size
----- ------ ------ --- ------ ------- ------ -------------
 0    RAID-5  546GB       32KB Open    0:01:0 64.0KB: 136GB
 /dev/sda                              0:04:0 64.0KB: 136GB
                                       0:02:0 64.0KB: 136GB
                                       0:03:0 64.0KB: 136GB
                                       0:00:0 64.0KB: 136GB


AFA0>
COMMAND: disk list
Executing: disk list

B:ID:L  Device Type     Blocks    Bytes/Block Usage            Shared Rate
------  --------------  --------- ----------- ---------------- ------ ----
0:00:0   Disk            286749480 512         Initialized      NO     160
0:01:0   Disk            286749480 512         Initialized      NO     160
0:02:0   Disk            286749480 512         Initialized      NO     160
0:03:0   Disk            286749480 512         Initialized      NO     160
0:04:0   Disk            286749480 512         Initialized      NO     160

AFA0>
COMMAND: logfile end
Executing: logfile end

*[root at bonzo RAID]# cat testmsg.txt
From: root at bonzo.reston.tnsi.com
To: MIS-UNIX-ALERTS
Subject: BONZO HAS RAID PROBLEM
Bonzo has a Disk or RAID problem.
*




More information about the Linux-PowerEdge mailing list