notify users when disk is failing

This commit is contained in:
Michal Hlavinka 2011-02-17 17:04:48 +01:00
parent 3a519f746d
commit 098dac6bf5
3 changed files with 19 additions and 3 deletions

9
smartdnotify Normal file
View File

@ -0,0 +1,9 @@
#! /bin/sh
# Send mail
echo "$SMARTD_MESSAGE" | mail -s "$SMARTD_FAILTYPE" "$SMARTD_ADDRESS"
# Notify desktop user
/usr/bin/notify-send -t 0 "WARNING: Your hard drive is failing"
"Description:
$SMARTD_MESSAGE"

View File

@ -6,7 +6,7 @@ diff -up smartmontools-5.38/smartd.conf.defaultconf smartmontools-5.38/smartd.co
# are found. Most users should comment out DEVICESCAN and explicitly # are found. Most users should comment out DEVICESCAN and explicitly
# list the devices that they wish to monitor. # list the devices that they wish to monitor.
-DEVICESCAN -DEVICESCAN
+DEVICESCAN -H -m root -n standby,10,q +DEVICESCAN -H -m root -M exec /usr/lib/smartd_actions -n standby,10,q
# Alternative setting to ignore temperature and power-on hours reports # Alternative setting to ignore temperature and power-on hours reports
# in syslog. # in syslog.

View File

@ -1,7 +1,7 @@
Summary: Tools for monitoring SMART capable hard disks Summary: Tools for monitoring SMART capable hard disks
Name: smartmontools Name: smartmontools
Version: 5.40 Version: 5.40
Release: 5%{?dist} Release: 6%{?dist}
Epoch: 1 Epoch: 1
Group: System Environment/Base Group: System Environment/Base
License: GPLv2+ License: GPLv2+
@ -10,6 +10,7 @@ Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
Source1: smartd.initd Source1: smartd.initd
Source2: smartmontools.sysconf Source2: smartmontools.sysconf
Source3: smartd.service Source3: smartd.service
Source4: smartdnotify
#fedora/rhel specific #fedora/rhel specific
Patch1: smartmontools-5.38-defaultconf.patch Patch1: smartmontools-5.38-defaultconf.patch
@ -19,7 +20,8 @@ Patch2: smartmontools-5.40-megaraid.patch
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
Requires: fileutils mailx chkconfig Requires: fileutils mailx chkconfig
Requires(triggerun): systemd-units #new rpm does not handle this (yet?)
#Requires(triggerun): systemd-units
Requires(post): systemd-units Requires(post): systemd-units
Requires(preun): systemd-units Requires(preun): systemd-units
Requires(postun): systemd-units Requires(postun): systemd-units
@ -66,6 +68,7 @@ rm -f examplescripts/Makefile*
chmod a-x -R examplescripts/* chmod a-x -R examplescripts/*
install -D -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/smartmontools install -D -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/smartmontools
install -D -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT/lib/systemd/system/smartd.service install -D -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT/lib/systemd/system/smartd.service
install -D -p -m 755 %{SOURCE4} $RPM_BUILD_ROOT/%{_libexecdir}/%{name}/smartdnotify
rm -rf $RPM_BUILD_ROOT/etc/{rc.d,init.d} rm -rf $RPM_BUILD_ROOT/etc/{rc.d,init.d}
rm -rf $RPM_BUILD_ROOT/%{_docdir}/%{name} rm -rf $RPM_BUILD_ROOT/%{_docdir}/%{name}
@ -109,9 +112,13 @@ fi
%{_sbindir}/update-smart-drivedb %{_sbindir}/update-smart-drivedb
%{_sbindir}/smartctl %{_sbindir}/smartctl
%{_mandir}/man?/smart*.* %{_mandir}/man?/smart*.*
%{_libexecdir}/%{name}/smartdnotify
%{_datadir}/%{name}/drivedb.h %{_datadir}/%{name}/drivedb.h
%changelog %changelog
* Thu Feb 17 2011 Michal Hlavinka <mhlavink@redhat.com> - 1:5.40-6
- notify users when disk is failing
* Wed Feb 09 2011 Michal Hlavinka <mhlavink@redhat.com> - 1:5.40-5 * Wed Feb 09 2011 Michal Hlavinka <mhlavink@redhat.com> - 1:5.40-5
- move to systemd - move to systemd