Version information
This version is compatible with:
- Puppet Enterprise 2025.5.x, 2025.4.x, 2025.3.x, 2025.2.x, 2025.1.x, 2023.8.x, 2023.7.x, 2023.6.x, 2023.5.x, 2023.4.x, 2023.3.x, 2023.2.x, 2023.1.x, 2023.0.x, 2021.7.x, 2021.6.x, 2021.5.x, 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x, 2019.8.x
- Puppet >= 6.21.0 < 9.0.0
- CentOS,OracleLinux,RedHat,Scientific,Debian,Ubuntu, FreeBSD, Fedora, SLES
Start using this module
Add this module to your Puppetfile:
mod 'deric-smartd', '2.1.0'
Learn more about managing modules with a PuppetfileDocumentation
puppet-smartd
Simplified smartd
configuration management with Puppet.
Usage
include smartd
and confgure e-mail nofifications for all disks:
smartd::defaults: '-a -m root@domain.org'
this would generate a smartd.conf
based on smartd::disks
(by default $facts['disks']
is used):
DEFAULT -a -m root@domain.org
/dev/sda -d ata
/dev/sdb -d ata
Main class smartd
supports following attributes:
defaults
Shared configuration directives can be specified e.g. common email-m root@my.org
. Accepts string or an array or strings.disks
Fact or Hash containing devices declarationrules
Appliedsmartd
options to disks definition.devicescan
When enabled will automatically detect all matching devices (restricted byoptions
). Default:false
options
DEVICESCAN options, e.g.-d removable
will ignore errors on removable devices. Requiresdevicescan: true
. Accepts string or an array or strings.
By default Puppet built-in $facts['disks']
is used (accessible also via facter -y disks
), e.g.:
nvme0n1:
model: "SAMSUNG MZQL2960HCJR-00A07"
serial: "S64FNE0R503522"
size: 894.25 GiB
size_bytes: 960197124096
type: ssd
that can be used to generate configuration (at least simple list of devices). Though any other fact or hardcoded hash of disks might be used.
The rules
parameter can be used to define e.g. model/vendor specific rules that might be generalized.
smartd::rules:
- attr: model # attr value match disk attributes, e.g. vendor, type, etc. might be used
match: SAMSUNG MZ7
options: -I 173 # ignore wear_level_count for disks matching this model
Match device name using special key $name
:
smartd::rules:
- attr: $name
match: ^nvme # regexp match
options: -H # will append all matching rules
- attr: type
match: ssd
options: -l error
this would output (assuming NVMe has attribute type with value ssd
)
/dev/nvme0n1 -H -l error
Ignore device completely (will be ommited from the list):
smartd::rules:
- attr: vendor
match: DELL
action: ignore
Apply megaraid
device type
smartd::rules:
- atrr: model
match: PERC
options: -d megaraid,0
Configuration parameters
See man smartd.conf for full configuration specification.
-a
equivalent of-H -f -t -l error -l selftest -l selfteststs -C 197 -U 198
-m
email address for notifications-d
device typeauto
,ata
,scsi
,nvme
,ignore
,removable
-H
perform S.M.A.R.T health check, i.e.smartctl -H /dev/sda
-i
ignore failure of Usage Attributes (e.g. percent of lifetime used)
Examples
Will scan for all devices, and then monitor them. It will send one email warning per device for any problems that are found.
smartd::devicescan: true
smartd::options: '-H -d ata -m root@example.com'
this would produce config:
DEVICESCAN -H -d ata -m root@example.com
that will ensure that smartd
will check SMART health status on all ata
drives daily.
Common configuration will be applied for all disks defined bellow (in the config).
smartd::defaults:
- '-a -R5! -W 2,40,45 -I 194 -s L/../../7/00'
- '-m admin@example.com'
Limitations
Written for Puppet 6 and newer, backward compatibility with older versions hasn't been tested.
Reference
Table of Contents
Classes
smartd
: Manage smartd daemon configuration
Functions
Data types
Smartd::Config
: for passing configuration
Classes
smartd
Generate rules for S.M.A.R.T attributes monitoring
Examples
include smartd
Parameters
The following parameters are available in the smartd
class:
disks
rules
package_name
package_ensure
manage_package
manage_service
config_file
service_name
service_ensure
devicescan
options
defaults
package_options
disks
Data type: Hash
Hash with devices (device name => {attributes})
Default value: pick($facts['disks'], {})
rules
Data type: Array[Hash]
An array of Hashes containing rules for assiging flags
Default value: []
package_name
Data type: String
Smartmontools package name
package_ensure
Data type: String
Standard Puppet's package ensure, valid values e.g. 'present','latest','absent','purged' Default: present
Default value: 'present'
manage_package
Data type: Boolean
Whether Smartmontools package should be managed by this module
Default value: true
manage_service
Data type: Boolean
Whether smartd service should be managed
Default value: true
config_file
Data type: Stdlib::Absolutepath
Path to main smartd config file
service_name
Data type: String
smart daemon service name
service_ensure
Data type: Stdlib::Ensure::Service
Service state, either 'running' or 'stopped' Default: 'running'
Default value: 'running'
devicescan
Data type: Boolean
Whether enable automatic disk detection. Default: false
Default value: false
options
Data type: Smartd::Config
Arguments passed to devicescan devices
Default value: undef
defaults
Data type: Smartd::Config
Common arguments for all devices
Default value: undef
package_options
Data type: Optional[Array]
Install options passed to package installer
Default value: undef
Functions
smartd::apply_rules
Type: Ruby 4.x API
The smartd::apply_rules function.
smartd::apply_rules(Hash $disks, Array $rules)
The smartd::apply_rules function.
Returns: Array
Applied rules to disks config
disks
Data type: Hash
rules
Data type: Array
Data types
Smartd::Config
for passing configuration
Alias of
Optional[Variant[
Array[String],
String
]]
Changelog
All notable changes to this project will be documented in this file.
Release 2.1.0 [2025-09-03]
- Avoid forcing
-d ata
type to ata devices (can be done using rules)
Release 2.0.0 [2025-09-03]
- Deep merge for
smartd::rules
- Add support for Debian 13, Ubuntu 24.04, RedHat 9
- Drop Debian 10, CentOS 7 support
Release 1.1.0 [2024-11-03]
- Replace
stdlib::ensure_packages
withensure_resources
which doesn't require stdlib >=9 - Use hierarchical facts in tests
Release 1.0.0 [2024-06-21]
Breaking changes
- use namespaced Puppet 4.x functions (require stdlib >= 9)
Release 0.5.0 [2023-12-10]
Features
- Puppet 8 support
- Debian 12 support
Bugfixes
- Fixed module dependencies
- Optional param defaults to
undef
Release 0.4.0 [2022-10-20]
Features
- Support passing package install options
Release 0.3.0 [2022-09-20]
Bugfixes
- Fixed service name on Debian 10
- Fixed array options serialization
Release 0.2.0 [2022-09-15]
Bugfixes
- Changed semantics of rules from Hash to Array of Hashes in order to support multiple rules over the same attribute
- Debian service is called
smartmontools
butsmartd
works as an alias
Release 0.1.0 [2022-09-15]
Features
- Support matching disk attributes and appending smard config flags
- Support matching by device name
- Ignore certain devices
Known Issues
Dependencies
- puppetlabs/stdlib (>= 8.6.0 < 10.0.0)