HEX
Server: nginx/1.29.3
System: Linux 11979.bigscoots-wpo.com 6.8.0-88-generic #89-Ubuntu SMP PREEMPT_DYNAMIC Sat Oct 11 01:02:46 UTC 2025 x86_64
User: nginx (1068)
PHP: 7.4.33
Disabled: exec,system,passthru,shell_exec,proc_open,proc_close,popen,show_source,cmd# Do not modify this line # 1684243876
Upload Files
File: //bigscoots/dedicated/raid_manager.sh
#!/bin/bash

if lspci | grep -iq 'megaraid\|lsi\|broadcom'; then
    echo "✅ MegaRAID controller detected. Proceeding with StorCLI setup."

    # Safe working directory
    cd /tmp

    wget -O storcli.zip "https://www.dropbox.com/scl/fi/hqltapekkmssy9xqy60t7/007.3205.0000.0000_MR7.32_Storcli.zip?rlkey=juv9d6g19wkuiykbfzebvvvag&dl=0"
    unzip -o storcli.zip
    unzip -o storcli_rel/Unified_storcli_all_os.zip

    rpm -ivh "Unified_storcli_all_os/Linux/storcli-007.3205.0000.0000-1.noarch.rpm" || \
    rpm -Uvh "Unified_storcli_all_os/Linux/storcli-007.3205.0000.0000-1.noarch.rpm"

    ln -sf /opt/MegaRAID/storcli/storcli64 /bin/storcli64
    storcli64 -v

    # Load Slack function
    source /bigscoots/includes/common.sh

    controller="/c0"
    output=$(storcli64 $controller /eall /sall show)

    # Grab the PD list block
    start_line=$(echo "$output" | grep -n "^EID:Slt" | cut -d: -f1)
    end_line=$(echo "$output" | grep -n "^EID=Enclosure Device ID" | cut -d: -f1)
    ((end_line--)) # Adjust for clean end

    pd_list=$(echo "$output" | sed -n "${start_line},${end_line}p")

    # Look for drive problems
    problem_lines=$(echo "$pd_list" | grep -E 'Failed|Offln|Msng|UBad|Uncfg' || true)

    message="*RAID Physical Drive List:*\n\`\`\`$pd_list\`\`\`"

    if [[ -n "$problem_lines" ]]; then
        send_slack_alert "#test" ":rotating_light:" "RAID Alert" "$(hostname -f)" "$message"
    else
        echo "✅ All drives healthy. No alert sent."
    fi
else
    echo "❌ No MegaRAID controller found. Skipping StorCLI install."
fi