Anyone wondering about dell/ Perc raid support - and checking raid read on

Discussion in 'Tips/Tricks/Mods' started by craig baker, Apr 3, 2014.

  1. craig baker

    craig baker Member HowtoForge Supporter

    I've got a poweredge 2970 and as you may know its raid utility is a version of LSI MegaCLI. But raid status is not shown by ISPCONFIG3 - until now.

    the monitor page is located at
    /usr/local/ispconfig/server/lib/classes/monitor_tools.inc.php

    if you add this code:
    --snip--

    /*
    * Check, if MegaCLI LSI RAID is enabled
    */
    if (file_exists('/opt/MegaRAID/MegaCli/MegaCli64')) {
    /*
    * Fetch the output
    */
    $data['output'] = shell_exec('/opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -Lall -aALL');

    /*
    * Then calc the state.
    */
    $tmp = explode("\n", $data['output']);
    $state = 'ok';
    $state = $this->_setState($state,$data['output']);
    }
    --snip---
    RIGHT before the block containing 'Check if we have mpt-status installed'

    now you will find that checking raid status outputs useful (for us) information like:

    Adapter 0 -- Virtual Drive Information:
    Virtual Drive: 0 (Target Id: 0)
    Name :ServerHD
    RAID Level : Primary-6, Secondary-0, RAID Level Qualifier-3
    Size : 1.817 TB
    Sector Size : 512
    Parity Size : 930.5 GB
    State : Optimal
    Strip Size : 64 KB
    Number Of Drives : 6
    Span Depth : 1
    Default Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU
    Current Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU
    Default Access Policy: Read/Write
    Current Access Policy: Read/Write
    Disk Cache Policy : Disk's Default
    Encryption Type : None
    Is VD Cached: No

    and we see our Raid State is Optimal! Nothing to worry about.

    but - you ask - what if it goes Bad? Then it would say Degraded or Failed.

    here is a little script to email YOU when the unthinkable occurs:
    --snip--
    #!/bin/bash
    /opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -Lall -aALL > raidstate1.txt
    cat raidstate1.txt | grep "Optimal" > /dev/null
    if [[ $? -eq 1 ]];
    then
    cat raidstate1.txt | mailx -s 'Degraded RAID on '$HOSTNAME [email protected]
    fi
    --snip--
    just cron this every 10 minutes and you will get a warning when Optimal is NOT present in the output.

    enjoy!
    cdb.
     
  2. lnxgs

    lnxgs Member

    Hi,
    is it possible to have this integrated with last ISPConfig version?
    Thank you
    L.
     

Share This Page