RAID monitoring

Discussion in 'Technical' started by TheRudy, Jul 19, 2006.

  1. TheRudy

    TheRudy ISPConfig Developer


    Anyone knows a nice RAID monitoring tool? I know that md's tools have build-in raid tool that informs you when something is wrong but i would also like some weblike tool. Similar to munin for example where it shows status of array, detailed info of all arrays and so on.. Been searching for it for quite a while yet i can't find anything usefull..
  2. falko

    falko Super Moderator

  3. TheRudy

    TheRudy ISPConfig Developer

    omg i'm so stupid, yes, a script that's checking that and cronjob that checks it every 10 min! If raid array is broken, it emails me..

    That's not a big cpu and memory consumer if i'm checking small text file every 10 min with cronjob is it?

    And we have a solution!
  4. edge

    edge HowtoForge Supporter

    Nice one.. Zabbix .. Now all we need is a good Howto for Debian :)
    I've done the zabbix_network_monitoring severall times now (on a virtual Debian), but till now with no luck :/
  5. TheRudy

    TheRudy ISPConfig Developer

    # Usage:
    ra=(md0 md1 md2) #all available raid arrays
    for ((i=0;i<$count_ra;i++)); do
    if [ $(grep -A1 ${ra[${i}]} /proc/mdstat | grep UU | wc -l) -eq 0 ]; then
    #send email if one the raid arrays fails..
    mdadm --detail /dev/${ra[${i}]} | mail -s "${ra[${i}]} RAID Array failed" alert@domain.tpl
    Probably not the best code but hey.. If someone can make it better it would be cool..
    It works if you change it from -eq 0 to -eq 1 and it sends out emails for all raid arrays, haven't tested with 0 :D

    10 min cron job will be fine right?
  6. falko

    falko Super Moderator

    I don't see any problems with that. :)
  7. TheRudy

    TheRudy ISPConfig Developer

    hmm a bit of a problem i might have :D

    Any idea why it doesn't send data with email? To test it, i set 1 so if the arrays are OK, i get 3 emails, each email contains data about raid array (--detail /dev/md0 and so on...). Now the thing is, if i run this script manually, i receive 3 emails with raid data about each array! But if the cronjob does it, it sends 3 emails with subject as it should be but without any content!

    cron looks like:
    0,10,20,30,40,50 * * * * /usr/local/bin/ &> /dev/null
    tested also with:
    0,10,20,30,40,50 * * * * (/usr/local/bin/ | mail -s "test" alert@domain.tld)
    as 4th email, i get:

    Null message body; hope that's ok
    Null message body; hope that's ok
    Null message body; hope that's ok
    I don't get it! mdadm --detail command isn't run with cronjob cause?
    I set the ownership to root, script is 755, no errors..


    edit: i put the file in /usr/local/bin, could that be a problem? Don't see how since i can run it manually from there without any problems and getting emails with data..
  8. TheRudy

    TheRudy ISPConfig Developer

    Duh! :rolleyes:

    You need full path in script else mdadm can't be found when the script is run by cronjob... Duh again..

    /sbin/mdadm --detail /dev/${ra[${i}]} | mail -s "${ra[${i}]} RAID Array failed" alert@domain.tpl
    Also moved file from old location to /root and hmm, well, it works ;)
  9. falko

    falko Super Moderator

    Or you put something like this at the beginning of your script:

  10. TheRudy

    TheRudy ISPConfig Developer

    I'll just stick with my way.. :D

Share This Page