it-artikel:linux:lsi-megaraid-automatische-ueberwachung-des-raid-status-und-der-festplatten-per-script
Differences
This shows you the differences between two versions of the page.
it-artikel:linux:lsi-megaraid-automatische-ueberwachung-des-raid-status-und-der-festplatten-per-script [2022-08-31 12:30] – created - external edit 127.0.0.1 | it-artikel:linux:lsi-megaraid-automatische-ueberwachung-des-raid-status-und-der-festplatten-per-script [2023-01-21 14:43] (current) – removed axel.werner.1973@gmail.com | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== LSI MegaRaid - Automatische Überwachung des RAID Status und der Festplatten per Script ====== | ||
- | Es gibt zur Zeit keine vernünftige Hersteller-Lösung für dieses Problem. Daher habe ich ein eigenes Script hierfür entwickelt. | ||
- | --- // | ||
- | |||
- | ===== Requirements / Vorraussetzungen ===== | ||
- | * ein korrekt konfigurierter lokaler MTA (Exim / Postfix) zum absetzen vom Status-Emails | ||
- | * [[it-artikel: | ||
- | * awk interpreter | ||
- | |||
- | |||
- | |||
- | |||
- | ===== Installation ===== | ||
- | - Alle nachfolgend gezeigten Files und Scripte nach /etc kopieren. | ||
- | - Das *.sh Shellscript ausführbar machen | ||
- | - Den Aufruf für das Shellscript in / | ||
- | < | ||
- | #RAID System Zustandsueberwachung alle 30 Minuten | ||
- | */30 * * * * root / | ||
- | </ | ||
- | |||
- | |||
- | ===== Scripte / Files ===== | ||
- | |||
- | |||
- | ==== raid-checker.sh ==== | ||
- | <code bash|/ | ||
- | #!/bin/bash | ||
- | # | ||
- | # LSI MegaRaid HEALTH CHECK v.1.00 - 2009-04-06 - Axel Werner [mail@awerner.myhome-server.de] | ||
- | # | ||
- | # Call this script on a regulary basis like in / | ||
- | # it will check the Health Status of your LSI MegaRaid RAID System and reports Problems | ||
- | # by eMail (via Cron) of something had failed. | ||
- | # | ||
- | # | ||
- | # This script requires the two AWK Scripts raid-checker1.awk and raid-checker2.awk | ||
- | # | ||
- | |||
- | |||
- | # preset Vars to signal a FAILURE of the RAID System. | ||
- | PDSTATUS=FALSE | ||
- | LDSTATUS=FALSE | ||
- | NUMSTATUS=FALSE | ||
- | |||
- | cd /etc | ||
- | |||
- | if ! MegaCLI64 -PDList -aALL | awk -f raid-checker1.awk | grep -qEv '*: Online' | ||
- | # no Problem found - set flag that everything is OK | ||
- | PDSTATUS=TRUE | ||
- | fi | ||
- | |||
- | |||
- | if ! MegaCLI64 -LDInfo -LALL -aAll | awk -f raid-checker2.awk | grep -qEv '*: Optimal' | ||
- | # no Problem found - set flag that everything is OK | ||
- | LDSTATUS=TRUE | ||
- | fi | ||
- | |||
- | PDSOLL=`MegaCLI64 -LDInfo -LALL -aAll | grep ' | ||
- | PDIST=`MegaCLI64 -PDList -aALL | grep ' | ||
- | if [ ${PDSOLL} -eq ${PDIST} ] ; then | ||
- | # no Problem found - set flag that everything is OK | ||
- | NUMSTATUS=TRUE | ||
- | fi | ||
- | |||
- | |||
- | if [ ${PDSTATUS} = FALSE -o ${LDSTATUS} = FALSE -o ${NUMSTATUS} = FALSE ] ; then | ||
- | # Problem Found - Report Flags | ||
- | echo 'RAID @ '" | ||
- | echo | ||
- | echo ' | ||
- | echo ' | ||
- | echo 'All PDs available? | ||
- | echo ' | ||
- | echo | ||
- | echo ' | ||
- | echo '###################' | ||
- | MegaCLI64 -LDInfo -LALL -aAll | ||
- | echo ' | ||
- | echo | ||
- | echo ' | ||
- | echo '####################' | ||
- | echo | ||
- | MegaCLI64 -PDList -aALL | ||
- | echo | ||
- | echo | ||
- | echo '~~~ END OF REPORT ~~~~~~~~~~~~~~~~~~~~~~~~~~~~' | ||
- | fi | ||
- | </ | ||
- | |||
- | ==== raid-checker1.awk ==== | ||
- | < | ||
- | # | ||
- | # This file is Part of the raid-checker scripts | ||
- | # | ||
- | # This is a little AWK program that interprets MegaCLI output | ||
- | # This one interprets the PHYSICAL DRIVES | ||
- | |||
- | /Device Id/ { counter += 1; device[counter] = $3 } | ||
- | /Firmware state/ { state_drive[counter] = $3 } | ||
- | /Inquiry/ { name_drive[counter] = $3 " " $4 " " $5 " " $6 } | ||
- | END { | ||
- | for (i=1; i< | ||
- | </ | ||
- | |||
- | |||
- | ==== raid-checker2.awk ==== | ||
- | < | ||
- | # | ||
- | # This file is Part of the raid-checker scripts | ||
- | # | ||
- | # This is a little AWK program that interprets MegaCLI output | ||
- | # This one interprets the LOGICAL DRIVES | ||
- | |||
- | /Virtual Disk/ { counter += 1; device[counter] = $3 } | ||
- | /State/ { state_drive[counter] = $2 } | ||
- | END { | ||
- | for (i=1; i< | ||
- | } | ||
- | </ | ||
- | |||
- | |||
- | {{tag> |
it-artikel/linux/lsi-megaraid-automatische-ueberwachung-des-raid-status-und-der-festplatten-per-script.1661949019.txt.gz · Last modified: 2022-08-31 12:30 by 127.0.0.1