add msmtp/zed/smartd/scrub-timers

This commit is contained in:
2022-10-19 13:09:01 +13:00
parent ae8633767a
commit 020efcc3bb
8 changed files with 77 additions and 2 deletions

View File

@ -7,6 +7,7 @@ zfs_packages:
- zfs-utils
- zfs-dkms
- mbuffer
- smartmontools
zfs_arc_min: '1073741824'
zfs_arc_max: '4294967296'
zfs_zpool_ashift: '12'

View File

@ -155,4 +155,18 @@
- mount
- receive
- rollback
- recordsize
- recordsize
# Adjust offset from 1H to 1D in zfs-scrub-monthly@{{ zfs-pool }}.timer
# TODO enable/start zfs-scrub-monthly@{{ zfs-pool }}.timer
# TODO configure /etc/zfs/zed.d/zed.rc
# TODO enable/start zfs-zed.service
# TODO possible configure /etc/conf.d/smartdargs
# TODO configure /etc/smartd.conf
# TODO enable/start smartd.service

View File

@ -0,0 +1 @@
DEVICESCAN -a -o on -S on -s (S/../.././03|L/../01/./04) -W 4,45,60 -m notificationrecipient@emailprovider.com -M exec /usr/local/bin/smartdnotify.sh

View File

@ -0,0 +1,27 @@
#! /bin/bash
# Create a file to store the message in. Give it a unique filename to avoid issues if this script runs twice simultaneously
msgFile="/root/$(uuidgen).txt"
# Clear file, set subject line and formatting
echo "Subject: $SMARTD_SUBJECT" > $msgFile
echo "Content-Type: text/html" >> $msgFile
echo "<html>" >> $msgFile
echo "<style type=\"text/css\">pre { font-family:monospace }</style>" >> $msgFile
echo "<body>" >> $msgFile
echo "<pre>" >> $msgFile
# Save the email message from STDIN:
cat >> $msgFile
# Append the output of zpool status:
/usr/sbin/zpool status >> $msgFile
# Append the output of smartctl -a to the message:
/usr/sbin/smartctl -a "$SMARTD_DEVICE" >> $msgFile
# Close HTML tags
echo "</pre></body></html>" >> $msgFile
# Now email the message to the user at address ADD:
/bin/msmtp "$SMARTD_ADDRESS" < $msgFile