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.

Link to this comparison view

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.1it-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. 
- --- //[[mail@awerner.myhome-server.de|Axel Werner]] 2009-04-08 17:13// 
- 
-===== Requirements / Vorraussetzungen ===== 
-  * ein korrekt konfigurierter lokaler MTA (Exim / Postfix) zum absetzen vom Status-Emails 
-  * [[it-artikel:linux:lsi-megaraid-cli-utility-fuer-sas-raid-controller|MegaCLI Kommandozeilen Tool]] 
-  * 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 /etc/crontab einfügen. z.B.  
-<code|/etc/crontab> 
-#RAID System Zustandsueberwachung alle 30 Minuten 
-*/30 * * * * root /etc/raid-checker.sh 
-</code>  
- 
- 
-===== Scripte / Files ===== 
- 
- 
-==== raid-checker.sh ==== 
-<code bash|/etc/raid-checker.sh> 
-#!/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 /etc/crontab or similar. 
-# 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' > /dev/null ; then 
- # 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' > /dev/null ; then 
- # no Problem found - set flag that everything is OK 
- LDSTATUS=TRUE 
-fi 
- 
-PDSOLL=`MegaCLI64 -LDInfo -LALL -aAll | grep '^Number Of Drives:' | cut -f2 -d':'` 
-PDIST=`MegaCLI64 -PDList -aALL | grep '^Firmware state:' | wc -l` 
-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 @ '"${HOSTNAME}"' - WARNING: RAID SYSTEM IS NO LONGER OPTIMAL! CHECK THE HARDWARE!' 
- echo 
- echo 'Logical Drives OK?  = '${LDSTATUS} 
- echo 'Physical Drives OK? = '${PDSTATUS} 
- echo 'All PDs available?  = '${NUMSTATUS} 
- echo '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' 
- echo 
- echo 'Logical Drives View' 
- echo '###################' 
- MegaCLI64 -LDInfo -LALL -aAll 
- echo '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' 
- echo 
- echo 'Physical Drives View' 
- echo '####################' 
- echo 
- MegaCLI64 -PDList -aALL 
- echo 
- echo 
- echo '~~~ END OF REPORT ~~~~~~~~~~~~~~~~~~~~~~~~~~~~' 
-fi 
-</code> 
- 
-==== raid-checker1.awk ==== 
-<code|/etc/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<=counter; i+=1) printf ( "Device %02d (%s) status is: %s <br/>\n", device[i], name_drive[i], state_drive[i]); } 
-</code> 
- 
- 
-==== raid-checker2.awk ==== 
-<code|/etc/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<=counter; i+=1) printf ( "Logical Drive %02d status is: %s <br/>\n", device[i], state_drive[i]);  
- } 
-</code> 
- 
- 
-{{tag>lsi raid linux cli MegaRaid sas MegaCLI monitoring hardware}} 
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