On 21 Aug 2010, at 14:25, Alex Schuster wrote:
...
I want to monitor the power status of my hard drives, so I wrote a
little
script that gives me this output:
sda: standby
sdb: standby
sdc: active/idle 32°C
sdd: active/idle 37°C
This script is called every minute via an fcron entry, output goes
into a
log file, and I use the file monitor plasmoid to watch this log file
in
KDE.
It's working fine, but also monitor my syslog in another file monitor
plamoid, and now I get lots of these entries:
Aug 21 14:21:06 [fcron] pam_unix(fcron:session): session opened for
user root by (uid=0)
Aug 21 14:21:06 [fcron] Job /usr/local/sbin/hdstate >> /var/log/
hdstate started for user root (pid 24483)
Aug 21 14:21:08 [fcron] Job /usr/local/sbin/hdstate >> /var/log/
hdstate completed
Aug 21 14:21:08 [fcron] pam_unix(fcron:session): session closed for
user root
#!/bin/bash
while true
do
for drive in a b c d
do
/usr/sbin/smartctl /dev/sd$drive --whatever >> /var/log/hdstate
done
sleep 60
done
I would personally update more often than this, and my concern would
be that if the process fails then your plasmoid isn't showing the
correct data.
I presume this is the same with your current setup: if cron dies then
the current temperature will not be read to file, and the plasmoid
will continue reading the last lines in /var/log/hdstate - the drive
can overheat without you knowing about it.
So I would expect there to be a better "plasmid" for this task. I'm
completely unfamiliar with plasmids, but what you really want is a
plasmid that itself runs a script and displays the stdout on your
screen. That way if there's no data, or an error, then _you see that
in the plasmid_, instead of silently ignoring it (as you may be at
present).
The easiest (but dumb) way to handle this is to add the date to your
plasmid's display so that at least you can see that something's wrong
if it doesn't match the clock. A better way is not to have to watch a
status monitor at all, and just have a script running that emails you
if the temperature is above a specified range.
Stroller.