sorry for my bad Google.Translate)
remembered a recent topic OpenVPN client notification, and decided to try.
1. install smartmontools
opkg update
opkg install smartmontools
opkg install smartmontools-drivedb
2. update /usr/share/smartmontools/drivedb.h
mv /usr/share/smartmontools/drivedb.h /usr/share/smartmontools/drivedb.h.bak
curl -k -L -o /usr/share/smartmontools/drivedb.h https://www.smartmontools.org/export/5053/trunk/smartmontools/drivedb.h
3 add /etc/smartd_warning.sh
curl -k -L -o /etc/smartd_warning.sh https://www.smartmontools.org/export/5053/trunk/smartmontools/smartd_warning.sh.in
chmod 766 /etc/smartd_warning.sh
only I comment 3 strings in this file because there were errors in the logs:
# @ENABLE_SCRIPTPATH_TRUE@export PATH="@scriptpath@"
# @OS_WIN32_TRUE@test -z "$USERDOMAIN" ||
# @OS_WIN32_TRUE@ echo " Win domain: $USERDOMAIN"
how do I understand them for Windows?!
4. add /etc/smart.d/sendmsg.sh for foris notification
mkdir /etc/smart.d
nano /etc/smart.d/sendmsg.sh
#!/bin/bash
TYPE="$SMARTD_FAILTYPE"
MSG="$SMARTD_MESSAGE"
TFIRST="$SMARTD_TFIRST"
FULLMSG="$(echo -e "S.M.A.R.T. \\n\\nEvent type: ${TYPE} \\n${MSG} \\nEvent time: ${TFIRST}")"
/usr/bin/create_notification -s error "${FULLMSG}"
/usr/bin/notifier
exit 0
chmod +x /etc/smart.d/sendmsg.sh
5. add device to /etc/smartd.conf
my config for example:
/dev/sda -d sat -H -W 2,45,50 -m <nomailer> -M diminishing -M exec /etc/smart.d/sendmsg.sh
/dev/sdb -d sat -o on -S on -a -W 2,45,50 -n standby,q -R 5! -I 190 -I 194 -m <nomailer> -M diminishing -M exec /etc/smart.d/sendmsg.sh -s (S/../.././12|L/../../7/06)
DEVICESCAN -d removable -H -m root -M exec /etc/smart.d/sendmsg.sh
for send test messages add -M test to device string
6. add smartd to autostart
/etc/init.d/smartd enabled
7. after any changes, the program must be restarted
/etc/init.d/smartd restart
I have everything worked as it should only after rebooting the entire router, before this did not stop the disk
information on setting up the smartd.conf and the input parameters for the message sending script is taken here
This is my first guide. Please correct me if Iām somewhere wrong)