Get metrics using the command line utility smartctl for S.M.A.R.T. (Self-Monitoring, Analysis and Reporting Technology) storage devices. SMART is a monitoring system included in computer hard disk drives (HDDs) and solid-state drives (SSDs) that detects and reports on various indicators of drive reliability, with the intent of enabling the anticipation of hardware failures. See smartmontools.

SMART information is separated between different measurements: smart_device is used for general information, while smart_attribute stores the detailed attribute information if attributes = true is enabled in the plugin configuration.

If no devices are specified, the plugin will scan for SMART devices via the following command:

smartctl --scan

Metrics will be reported from the following smartctl command:

smartctl --info --attributes --health -n <nocheck> --format=brief <device>

This plugin supports smartmontools version 5.41 and above, but v. 5.41 and v. 5.42 might require setting nocheck, see the comment in the sample configuration. Also, NVMe capabilities were introduced in version 6.5.

To enable SMART on a storage device run:

smartctl -s on <device>

NVMe vendor specific attributes

For NVMe disk type, plugin can use command line utility nvme-cli. It has a feature to easy access a vendor specific attributes. This plugin supports nmve-cli version 1.5 and above: https://github.com/linux-nvme/nvme-cli. In case of nvme-cli absence NVMe vendor specific metrics will not be obtained.

Vendor specific SMART metrics for NVMe disks may be reported from the following nvme command:

nvme <vendor> smart-log-add <device>

Note that vendor plugins for nvme-cli could require different naming convention and report format.

To see installed plugin extensions, depended on the nvme-cli version, look at the bottom of:

nvme help

To gather disk vendor id (vid) id-ctrl could be used:

nvme id-ctrl <device>

Association between a vid and company can be found there: https://pcisig.com/membership/member-companies.

Devices affiliation to being NVMe or non NVMe will be determined thanks to:

smartctl --scan


smartctl --scan -d nvme


# Read metrics from storage devices supporting S.M.A.R.T.
    ## Optionally specify the path to the smartctl executable
    # path_smartctl = "/usr/bin/smartctl"
    ## Optionally specify the path to the nvme-cli executable
    # path_nvme = "/usr/bin/nvme"
    ## Optionally specify if vendor specific attributes should be propagated for NVMe disk case
    ## ["auto-on"] - automatically find and enable additional vendor specific disk info
    ## ["vendor1", "vendor2", ...] - e.g. "Intel" enable additional Intel specific disk info
    # enable_extensions = ["auto-on"]
    ## On most platforms used cli utilities requires root access.
    ## Setting 'use_sudo' to true will make use of sudo to run smartctl or nvme-cli.
    ## Sudo must be configured to allow the agent user to run smartctl or nvme-cli
    ## without a password.
    # use_sudo = false
    ## Skip checking disks in this power mode. Defaults to
    ## "standby" to not wake up disks that have stopped rotating.
    ## See --nocheck in the man pages for smartctl.
    ## smartctl version 5.41 and 5.42 have faulty detection of
    ## power mode and might require changing this value to
    ## "never" depending on your disks.
    # nocheck = "standby"
    ## Gather all returned S.M.A.R.T. attribute metrics and the detailed
    ## information from each drive into the 'smart_attribute' measurement.
    # attributes = false
    ## Optionally specify devices to exclude from reporting if disks auto-discovery is performed.
    # excludes = [ "/dev/pass6" ]
    ## Optionally specify devices and device type, if unset
    ## a scan (smartctl --scan and smartctl --scan -d nvme) for S.M.A.R.T. devices will be done
    ## and all found will be included except for the excluded in excludes.
    # devices = [ "/dev/ada0 -d atacam", "/dev/nvme0"]
    ## Timeout for the cli command to complete.
    # timeout = "30s"


It’s important to note that this plugin references smartctl and nvme-cli, which may require additional permissions to execute successfully. Depending on the user/group permissions of the user executing this plugin, you may need to use sudo.

You will need the following in your config:

  use_sudo = true

You will also need to update your sudoers file:

$ visudo
# For smartctl add the following lines:
Cmnd_Alias SMARTCTL = /usr/bin/smartctl
Defaults!SMARTCTL !logfile, !syslog, !pam_session

# For nvme-cli add the following lines:
Cmnd_Alias NVME = /path/to/nvme
Defaults!NVME !logfile, !syslog, !pam_session

To run smartctl or nvme with sudo wrapper script can be created. path_smartctl or path_nvme in the configuration should be set to execute this script.