SmartMonTools

Aus Info-Theke
Version vom 12. März 2023, 08:00 Uhr von Hamatoma (Diskussion | Beiträge) (→‎Konfiguration)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Zur Navigation springen Zur Suche springen


Installation

apt install smartmontools

Konfiguration

  • /etc/smartd.conf
# default: siehe unten /etc/smartmontools/run.d/10mail
DEVICESCAN -d removable -n standby -m root -M exec /usr/share/smartmontools/smartd-runner
# Alternative:
/dev/sda -a -m destination.email@gmail.com -M test
-d TYPE 	Specifies the device type between ata, scsi etc…
-H 	Checks the SMART health status of the disk
-l TYPE 	Monitors SMART log (error or selftest)
-s REGEX 	Specifies regular expression to schedule self-tests
-m ADDRESS 	Sends an email notification at the specified address
-M TYPE 	Works only when the -m directive is provided and modifies its behavior
-f 	Monitors the failure of “usage” attributes
-t 	Works like a shortcut for -p and -u, so reports changes in “Prefailure” and “Usage” attributes
-C ID 	Reports if the count of pending sectors is something other than 0
-U ID 	Reports if the number of offline uncorrectable sectors is not 0
-a 	Works like a shortcut for -H -f -t -l error -l selftest -C 197 -U 198
  • /etc/smartmontools/run.d/10mail
#!/bin/bash -e
# Send mail if /usr/bin/mail exists
if ! [ -x /usr/bin/mail ]; then
	echo "Your system does not have /usr/bin/mail.  Install the mailx or mailutils package" 
	exit 1
fi
input=$1
shift
/usr/bin/mail "$@" < $input

Testmail senden

systemctl restart smartd