From 900a72301ca3dc21945950c21518ffd445b0e835 Mon Sep 17 00:00:00 2001 From: Wojciech Kozlowski Date: Tue, 30 Aug 2022 18:38:37 +0200 Subject: [PATCH] Configure smartmontools --- machine.yml | 28 ++++++++++++++++++++++++++++ root/etc/default/smartmontools | 9 --------- root/etc/smartd.conf | 7 ++++++- 3 files changed, 34 insertions(+), 10 deletions(-) delete mode 100644 root/etc/default/smartmontools diff --git a/machine.yml b/machine.yml index ecf615a..efa811e 100644 --- a/machine.yml +++ b/machine.yml @@ -347,3 +347,31 @@ state: restarted when: apcupsd_conf is changed + + # ---------------------------------------------------------------------------------------------- + # Disk monitoring. + # ---------------------------------------------------------------------------------------------- + + - name: Install smartmontools + apt: + name: smartmontools + + - name: Smartd configuration + copy: + src: ./root/etc/smartd.conf + dest: /etc/smartd.conf + mode: 0644 + register: smartd_conf + + - name: Enable/start smartmontools + service: + name: smartmontools + enabled: yes + state: started + + - name: Restart smartmontools + service: + name: smartmontools + state: restarted + when: + smartd_conf is changed diff --git a/root/etc/default/smartmontools b/root/etc/default/smartmontools deleted file mode 100644 index 6a8a6e2..0000000 --- a/root/etc/default/smartmontools +++ /dev/null @@ -1,9 +0,0 @@ -# Defaults for smartmontools initscript (/etc/init.d/smartmontools) -# This is a POSIX shell fragment - -# List of devices you want to explicitly enable S.M.A.R.T. for -# Not needed (and not recommended) if the device is monitored by smartd -#enable_smart="/dev/hda /dev/hdb" - -# uncomment to pass additional options to smartd on startup -#smartd_opts="--interval=1800" diff --git a/root/etc/smartd.conf b/root/etc/smartd.conf index 7c80e21..9409ed1 100644 --- a/root/etc/smartd.conf +++ b/root/etc/smartd.conf @@ -18,7 +18,7 @@ # Directives listed below, which will be applied to all devices that # are found. Most users should comment out DEVICESCAN and explicitly # list the devices that they wish to monitor. -DEVICESCAN -d removable -n standby -m root -M exec /usr/share/smartmontools/smartd-runner +#DEVICESCAN -d removable -n standby -m root -M exec /usr/share/smartmontools/smartd-runner # Alternative setting to ignore temperature and power-on hours reports # in syslog. @@ -147,3 +147,8 @@ DEVICESCAN -d removable -n standby -m root -M exec /usr/share/smartmontools/smar # If the test string DEVICESCAN is the first uncommented text # then smartd will scan for devices. # DEVICESCAN may be followed by any desired Directives. + +/dev/sda -a -o on -S on -s (S/../../4/04|L/../14/./06) -m root -M exec /usr/share/smartmontools/smartd-runner -M test +/dev/sdb -a -o on -S on -s (S/../../5/04|L/../15/./06) -m root -M exec /usr/share/smartmontools/smartd-runner -M test +/dev/sdc -a -o on -S on -s (S/../../4/04|L/../14/./06) -m root -M exec /usr/share/smartmontools/smartd-runner -M test +/dev/sdd -a -o on -S on -s (S/../../5/04|L/../15/./06) -m root -M exec /usr/share/smartmontools/smartd-runner -M test