cPanel Config

Welcome to cPanelConfig the fastest growing cPanel configuration and troubleshooting guide on the internet. Please take the time and register. We would love to have your contribution to this completely free cPanel resource. We are updating this daily so be sure to visit us on a regular basis.

3ware RAID monitoring script

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 4 out of 5)
Loading ... Loading ...

Posted by yolau

3ware RAID cards are used by the majority of Data Centers (Layeredtech, Softlayer, etc.) so if you have a RAID card installed (which is always a good idea) you might have a 3ware card.

I don’t know if you know or not (many people don’t) but it’s your responsibility to monitor the RAID array. There will be no errors on screen if something is wrong with the array until it’s too late and your system will not boot.
3ware has a nice monitoring and management tool for Linux called tw_cli. While this comes with a monitoring script I found it hard to setup so I thought that I will write a personalized monitoring script that will check the status of the array and it will send me an email when the array is degraded.

Here are the simple steps that you have to fallow to setup this script:

  1. First you must have a 3ware RAID card. you can check this by running
  2. lspci | grep 3ware

    If it outputs something about a 3ware RAID card you have one.

  3. Install tw_cli
  4. wget http://www.3ware.com/download/Escalade9500SSeries/9.3.0.4/tw_cli-linux-x86-9.3.0.4.tgz
    gzip -d tw_cli-linux-x86-9.3.0.4.tgz
    tar -xf tw_cli-linux-x86-9.3.0.4.tar

    Note the path to tw_cli !

  5. Write a bash file with the fallowing
  6. #!/bin/bash
    com=`/path_to_ tw_cli/tw_cli info c0 u0 status | awk ‘{print $4}’`
    echo $com
    if [ "$com" = "DEGRADED" ];
    then
    mail -s “RAID Warning” you@domain.com < body
    fi


    Note: You also have to make a file called “body” that will have the body of the warning email.
    Also replace you@domain.com with your email.

  7. Schedule a cron to run this script every day or so. You can do something like this:
  8. crontab -e

    Add a line like:

    0 11,23 * * * /path_to_script/test

    This will test the array at 11:00 and 23:00 and will email you if it detects any problems.

  9. Restart crond
  10. service crond restart


Hope it helps !
If you have any suggestions to improve the script please leave a comment.

Share this:
  • Digg
  • del.icio.us
  • Slashdot
  • StumbleUpon
  • Netvouz
  • description
  • ThisNext
  • MisterWong
  • Wists
  • De.lirio.us
  • Furl
  • MyShare
  • Smarking
  • Technorati
  • YahooMyWeb

If you enjoyed this post, make sure you subscribe to my RSS feed!

Leave a Reply