Created
February 11, 2022 00:53
-
-
Save gobenji/576593ab5e5fd5b2d131627b01164f54 to your computer and use it in GitHub Desktop.
Modified /etc/smartmontools/run.d/10mail to workaround https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=900244
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 | |
# workaround debian bug 900244 | |
if [[ $SMARTD_MESSAGE == "Device: /dev/nvme1, number of Error Log entries increased from"* ]] && \ | |
[ $(/usr/sbin/nvme error-log -o json "$SMARTD_DEVICE" | \ | |
jq '.errors | map(select(.status_field | | |
IN(0, 8194, 16388) | not)) | length') -eq 0 ]; then | |
echo "Spurious error count increase, not sending mail." | |
exit | |
fi | |
input=$1 | |
shift | |
/usr/bin/mail "$@" < $input |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From my observations, the apparently spurious error log entries have status_field values 0x2002 or 0x4004. The second part of the condition checks that those are the only entries before suppressing the email notification.
I think the meaning of status_field is according to the following bits nvme.h