On Thu, Oct 03, 2002 at 09:43:22AM -0600, Trevor wrote: > Would it be possible to share your script with me (and the list)? I run > software raid and have been looking for an effective way to monitor my > mirrored raid drives.
Try the following: This is a very simple utility for Linux systems that use software raid disks. It seems to work for me, but it is without warranty, understand how it works and what you are doing, use it at your own risk. Because software raid can survive a disk dying, you might never know about it. Raidcheck is my attempt to automatically find out if there is a problem. The pseudo-file /proc/mdstat tells of raid status--including whether anything has gone wrong, such as a disk failure, raidcheck watches for changes in this pseudo-file. If you want to do this too, once your raid is working correctly, do the following as root: # mkdir /etc/raidcheck.d Put the file you are reading now in "/etc/raidcheck.d" as "readme.txt". Save the following as "/etc/raidcheck.d/raidcheck": ------ begin "/etc/raidcheck.d/raidcheck" after this line ------ #!/bin/sh # # This file is part of raidcheck, to learn more see # /etc/raidcheck.d/readme.txt # # When your raid is working correctly, make a note of it with: # # # cp /proc/mdstat /etc/raidcheck.d/mdstat.reference # diff /etc/raidcheck.d/mdstat.reference /proc/mdstat \ || diff -Nu /etc/raidcheck.d/mdstat.reference /proc/mdstat \ | mail root -s "RAID Status Changed on `hostname`" ------ end "/etc/raidcheck.d/raidcheck" before this line ------ Next: # chmod 755 /etc/raidcheck.d/raidcheck # cp /proc/mdstat /etc/raidcheck.d/mdstat.reference # cp /etc/raidcheck.d/raidcheck /etc/cron.daily/raidcheck To see if it works: # /etc/cron.daily/raidcheck You should not get an e-mail. Edit /etc/raidcheck.d/mdstat.reference making some change. Try again: # /etc/cron.daily/raidcheck This time you should get an e-mail. If you want to be really thorough, stop here until tomorrow morning. At that point you should have another e-mail waiting for you. Once you are sure your new cron job is working, look at /proc/mdstat and make sure it still looks OK (it is up to you to figure out that), then undo your test: # cp /proc/mdstat /etc/raidcheck.d/mdstat.reference Done. Now, if there is a raid problem (or any change in raid configuration), an e-mail will be sent to root (or some other address) once a day (every day--to remind you). If you want to send this e-mail to someone other than root, edit /etc/cron.daily/raidcheck, find where it says "root", change it to something else. Also, make sure cron is running (it should be on a reasonable system). Once you get an e-mail, you will have to look into the technical and groady details of raid to figure out what when wrong (if anything), and fix it. Maybe you get to buy and install a new disk drive. Once you have things working again, make a new reference: # cp /proc/mdstat /etc/raidcheck.d/mdstat.reference You should quit getting daily e-mails until something goes wrong again. Resist the temptation to "improve" this script and make it any fancier. It is simple, and therefore likely to work and unlikely break else. It is hard to add redunancy in such a way that things are actually more reliable but this simple version seems to accomplish the task. The most complicated thing here is the instructions. Understand them, don't just follow them blindly. Kent Borg e-mail: "kentborg", that at-sign thingie, "borg", a period, then "org". 3 October 2002 -- redhat-list mailing list unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe https://listman.redhat.com/mailman/listinfo/redhat-list