stuvusIT.smartd
smartd
This role sets up and configures smartd
.
By default, it will check and monitor all devices, but it won't send any emails.
Requirements
You need one of the following operating systems: Debian, Ubuntu, Arch Linux, or Fedora.
The command /usr/bin/mail
must be available and properly set up to send email reports if you want that.
Role Variables
This role uses a single main variable called smartd_devices
. It is a dictionary of dictionaries that defines which devices to monitor. Each key represents a drive path. You can use DEVICESCAN
to find devices. After the DEVICESCAN
entry, all following lines will be ignored by smartd, so put it at the end if you include it.
Here’s a brief overview of the options available. You can find more information for each option on the smartd man page.
Name | Mandatory / Default | Description |
---|---|---|
type |
auto |
The type of device, like ata , scsi , marvell , etc. |
nocheck |
standby,15,q |
Power mode setting. Devices in standby are checked every 15 tries, and skipped checks aren’t logged by default. |
check_type |
normal |
Use normal or permissive to ensure SMART checking happens, even if it isn’t advertised. |
ata_offline_testing |
Set to on or off to enable or disable automatic tests by the device itself. Remember to quote off in Ansible. |
|
attribute_autosave |
True |
Turns attribute autosave on or off when starting up. |
check_health_return_status |
True |
Checks the health status of the device using the SMART return status. |
report_error_types |
[error,xerror,selftest,offlinests,"scterc,0,0"] |
Types of errors to report. By default, SMART errors and failed tests are logged, and TLER is disabled. |
non_smart_settings |
["lookahead,on"] |
Options that are not SMART-related to set. |
test_schedule |
(L/../../6/01|S/../.././02) |
A REGEXP to specify when self-tests should run. By default, a short test runs daily after 1 am, and a long test runs every Sunday after 2 am. |
mail_recipients |
[] |
Email addresses to send reports to. |
mail_frequency |
diminishing |
How often to send email reports: values can be once , daily , or diminishing . |
mail_script |
Path to a script that runs along with sending email reports. | |
report_ata_failure |
True |
Reports failures of any ATA usage attributes. |
report_ata_prefail |
True |
Reports changes of any ATA prefail attributes. |
report_ata_usage |
False |
Reports changes in usage attributes. |
ignore_ata_failure_ids |
[] |
SMART IDs to ignore when checking for failures. |
ignore_ata_usage_ids |
[] |
SMART IDs to ignore for usage value changes. |
report_raw_ids |
[] |
IDs for which to force raw value reporting. Append ! to an ID to mark changes as critical. |
ata_pending_id |
197+ |
ID for pending sectors. Append + to report only increases instead of general non-zero values. |
ata_uncorrectable_id |
198+ |
Same as above for uncorrectable sectors. |
temperature_report_diff |
10 |
Temperature difference to report. Use 0 to ignore. |
temperature_report_info |
45 |
Temp threshold to start sending info reports. Use 0 to ignore. |
temperature_report_crit |
50 |
Temp threshold for critical reports to start. Use 0 to ignore. |
firmware_bugs |
[] |
List of known firmware bugs that SMARTD should avoid. |
vendor_formats |
[] |
Options to change the interpretation of raw SMART values. |
preset_mode |
use |
Set to ignore if you don’t want to use known presets for a detected drive. |
Example Playbook
- hosts: storage
roles:
- role: smartd
smartd_devices:
/dev/sda:
check_type: permissive
test_schedule: L/../../7/04
temperature_report_diff: 5
DEVICESCAN:
non_smart_settings:
- lookahead,on
- wcache,off
- standby,off
- apm,254
This setup ensures SMART checking happens even if it's not advertised on /dev/sda
. The device will be tested only after 4am every Sunday, and temperature changes of 5 degrees will be reported. All other drives will be monitored with default settings, except for the options specified.
License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
Author Information
Installs smartmontools and configures smartd
ansible-galaxy install stuvusIT.smartd