Configure smartmontools

This commit is contained in:
Wojciech Kozlowski 2022-08-30 18:38:37 +02:00
parent ac80331067
commit 900a72301c
3 changed files with 34 additions and 10 deletions

View File

@ -347,3 +347,31 @@
state: restarted state: restarted
when: when:
apcupsd_conf is changed 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

View File

@ -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"

View File

@ -18,7 +18,7 @@
# Directives listed below, which will be applied to all devices that # Directives listed below, which will be applied to all devices that
# 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 -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 # Alternative setting to ignore temperature and power-on hours reports
# in syslog. # 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 # If the test string DEVICESCAN is the first uncommented text
# then smartd will scan for devices. # then smartd will scan for devices.
# DEVICESCAN may be followed by any desired Directives. # 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