Comment 5 for bug 16386

Revision history for this message
trollord (trollenlord) wrote :

I did some hacking on this area. Observations:
- Libnotification -style popups are nearly perfect for signaling an average Joe of an upcoming problem.
- Best way would be to notify all the users via dbus.SystemBus() and notification-daemon. However for security etc reasons notification-daemon does not listen on System bus.
- There doesn't seem to be any other plausible way (from besides what I did) of root'd daemons signaling all users available, at least to me.
- Root priviledges are not required for all operations but it makes my solution quite nicely doable.
- Running a daemon for all the logged on users is silly waste of resources.
- Not running smartd might cause delays in noticing errors OR it will consume (a tiny amount) of resources if you poll manually with smartctl.
- SMARTD itself detects on modern computers /dev/sd* as "scsi" and fails utterly. 99% of the brand new hardware uses SATA(2), which actually requires -d ata parameter! This is a *MAJOR* bug in smartd. The way I see around it is to regenerate smartd.conf smartly before starting it up with an other script. OR, submit a bug to upstream and wait until 2050 or so for it to get fixed. I'd make an other python or shell script myself, run it at /etc/init.d/smartmontools start right before trying to start smartd.
- My solution seems to be working for me, and would take only a little bit of further development to be ready for inclusion in default Ubuntu installations.

The solution that actually works is:
- Fix the sata/scsi/ata problem, I did it manually myself!
- Use a "mailer script" that smartd knows how to run when problems arise, -M exec smart-alerter.py (you put that stuff to smartd.conf)
- The script gets automatically that smart problem information via environment variables that smartd sets
- The script finds out what users are potentially "real"
- ... forks once for all of them
- ... setuids (!)
- ... uses dbus to send notification, it really actually works awesomely AND is with tiny adjustments usable also by KDE/XFCE etc
- ... dies.

It is simple, passive, working. Comments from some real developers?