You are not logged in.
Pages: 1
In Kubuntu, I could make smartmontools run as a daemon and pop-up a window if there were any issues with my hard drives. This was very useful. Several times, I was informed that my hard drives were running dangerously hot, so I could slow down whatever I was doing at the time.
In Arch, it seems that vanilla smartmontools can only mail users and log when there are issues, which is obviously a lot slower. Is there a way to get a pop-up window as in (K)ubuntu?
FWIW I think (K)ubuntu relies on a script called smartd-runner. I tried to copy it to Arch, but not surprisingly, it failed. I also tried gsmartcontrol from the Arch repos, but this didn't appear to have an "instantaneous-warning" feature either.
Last edited by Salkay (2014-07-25 13:06:27)
Offline
So I just read through the Ubuntu docs you just linked and they were pretty thorough. Since arch doesn't have a `smart-notifier` package, your best bet, if you happen to be savy at scripting/programming, is to roll your own and use the libnotify or zenity bubble pop-ups.
You can tell smartd to run your script instead of running the mail command. If you are not so savy at scripting, then you can try to porting the `smartd-runner` script over.
You will need to copy the directory /etc/smartmontools/run.d/ and the scripts in it and makes sure that the scripts are compatible and meet any necessary dependencies. This sentence from the ubuntu doc is especially revealing
/usr/share/smartmontools/smartd-runner is a script that basically saves the report to a temporary file, and then runs anything it finds in /etc/smartmontools/run.d/; take a look there to understand what you already have (there should be a script that mails the report).
Then you can follow the steps in the docs under the Personal Computer header that tells you how to create custom notificiations.
Good Luck.
Offline
Thanks for the reply fungle, and apologies for my delay in replying. I've been pretty busy recently, so I haven't had a chance to look at this. I'll definitely post back with more details once I have a try.
Offline
Okay, so I cobbled together a script that works. It's pretty hacky, and has things in it that shouldn't be hard-coded, but it does work. Firstly, edit the configuration file at /etc/smartd.conf. The only uncommented line should be
DEVICESCAN -m root -M test -M exec /usr/local/bin/smartd_alert
Then, create the following script at /usr/local/bin/smartd_alert. This uses yad, but as fungle says, you could use other notifications if you like. This script will pop up a message, and also mail you when smartd encounters a warning.
#!/usr/bin/env bash
NOTIFIEDUSER=<!!YOUR_USERNAME_HERE!!>
message="$(cat $1)"
sudo -u $NOTIFIEDUSER DISPLAY=:0 yad --center --title=Smartmontools --text="$message" --button=OK:0 --image "dialog-warning" --sticky
# 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
echo "$message" | /usr/bin/mail -s 'Smartmontools warning' $NOTIFIEDUSER
Give it executable permissions, then restart smartd with
$ sudo systemctl restart smartd.service
Hopefully, you should get the popup and the mail immediately. If it works fine, then turn off "testing mode" by re-editing /etc/smartd.conf and removing "-M test". i.e. it should read
DEVICESCAN -m root -M exec /usr/local/bin/smartd_alert
Finally, restart smartd.service.
Thanks again for the help, fungle!
Offline
Pages: 1