HOWTO: smartd autotest disk and foris notification

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 

3 add /etc/

curl -k -L -o /etc/ 
chmod 766 /etc/

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/ for foris notification

mkdir /etc/smart.d
nano /etc/smart.d/

FULLMSG="$(echo -e "S.M.A.R.T. \\n\\nEvent type: ${TYPE} \\n${MSG} \\nEvent time: ${TFIRST}")"
/usr/bin/create_notification -s error "${FULLMSG}"
exit 0

chmod +x /etc/smart.d/

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/
/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/ -s (S/../.././12|L/../../7/06)
DEVICESCAN -d removable -H -m root -M exec /etc/smart.d/

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)


The only thing I did not find for complete happiness is this update-smart-drivedb. I could not even find the path to the file drivedb.h. Can you tell me where to find them, or do I need to recompile a package with support? Since my SSD appeared not so long ago in the base of devices, and I can not update it.

Thanks to @czlada for the solution. Post updated.