From 29f29966e83f3bb4179dc6aae396068a0a6e3283 Mon Sep 17 00:00:00 2001 From: Tobias Date: Mon, 18 May 2026 19:38:34 +0100 Subject: [PATCH] Update README.md --- README.md | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f770092..db8efe8 100644 --- a/README.md +++ b/README.md @@ -72,29 +72,46 @@ This provides information about the array itself including the array's usable si ## Automated Monitoring -To automate monitoring of the RAID array's health and drive status I created a Bash script ran every 3 hours with cronjobs to email me, [utilizing my self hosted mail accounts](https://git.tobiastime.xyz/Tobias/Mail-Server). +To automate monitoring of the RAID array's health and drive status I created a Bash script, ran every 3 hours with cronjobs, which emails me [utilizing my self hosted mail accounts](https://git.tobiastime.xyz/Tobias/Mail-Server). -It will sent a notification if any drive has a S.M.A.R.T alert or if the RAID array's health is reported as anything but optimal via MegaCLI. +It will sent a notification if any drive has a S.M.A.R.T alert, if the RAID array's health or battery health is reported as anything but optimal via MegaCLI. This saves me having to manually monitor and check the health of the drives and array, but will still bring anything requiring direct intervention to my attention affording me apt time to respond before an incident occurs. +Moreover it logs the controller's current temperature to a centralized log file, managed via logrotate, to assist in spotting any premature fan issues. + Script: ``` bash #/bin/bash -#If any drive returns yes for a S.M.A.R.T alert email my account tobias@tobiastime.xyz +#If any drive returns yes for a S.M.A.R.T alert email me megacli -PDList -aALL | grep -i 's.m.a.r.t' | grep -i 'yes' &&\ \ echo -e "To: tobias@tobiastime.xyz\nFrom: snorlax@tobiastime.xyz\nSubject: RAID Drives\nA RAID Drive on Snorlax has had a flagged S.M.A.R.T alert at $(date)" | ssmtp tobias@tobiastime.xyz -#If raid health is anything but optimal email my account tobias@tobiastime.xyz +#If raid health is anything but optimal email me raidhealth=$(megacli -LDInfo -Lall -aALL | awk 'NR==11 {print $3}') [ "$raidhealth" != "Optimal" ] && \ echo -e "To: tobias@tobiastime.xyz\nFrom: snorlax@tobiastime.xyz\nSubject: RAID Array\nMegaCLI has reported the RAID array is not currently operating in an optimal state at $(date)" | ssmtp tobias@tobiastime.xyz + +#If the battery health is anything but optimal email me + +batteryhealth=$(megacli -AdpBbuCmd -aALL | awk 'NR==8 {print $3}') + +[ "$batteryhealth" != "Optimal" ] && \ +echo -e "To: tobias@tobiastime.xyz\nFrom: snorlax@tobiastime.xyz\nSubject: RAID Array\nMegaCLI has reported the RAID card's battery is no longer in an optimal state of health at $(date)" | ssmtp tobias@tobiastime.xyz + +#Write current RAID controller temp to log file + +logfile=/var/log/raidtemp.log + +raidtemp=$(megacli -AdpAllInfo -aAll | grep -i 'roc temperature' | awk '{print $4, $5, $6}') + +echo "The RAID controller's temperature is "$raidtemp" at $(date)" >> "$logfile" ``` Crontab Entry: @@ -105,6 +122,20 @@ Crontab Entry: This runs the check every 3 hours. +Logrotate Configuration File: + +``` +/var/log/raidtemp.log { + rotate 4 + weekly + compress + missingok + notifempty + create 644 myuser myuser +} + +``` + ## Hardware Images PCIe RAID card before USB fan was bound to heat sink: