Skip to main content

The smartd check

Project description

smartd

Overview

This integration monitors S.M.A.R.T. disk health by reading state files written by the smartd daemon (part of smartmontools). It collects key disk health attributes such as temperature, reallocated sectors, power-on hours, and pending sector counts, and reports the overall health status of each drive as a service check.

Unlike other approaches that shell out to smartctl (which requires root privileges), this integration reads the state files that smartd already maintains, making it work without any privilege escalation.

Setup

Prerequisites

smartd must be persisting state files

This integration reads the per-drive state files that smartd writes on every poll cycle. smartd does not persist state files by default — it must be launched with the -s <prefix> argument, where <prefix> is usually /var/lib/smartmontools/smartd. so that files land as /var/lib/smartmontools/smartd.<MODEL>-<SERIAL>.<type>.state.

Distros handle this differently:

  • Debian / Ubuntu: the packaged systemd unit already passes -s /var/lib/smartmontools/smartd. via /etc/default/smartmontools. Nothing to do.
  • Arch Linux (and anything else running smartd as just smartd -n): state persistence is not enabled by default. Create /etc/conf.d/smartd with:
    SMARTD_ARGS='-s /var/lib/smartmontools/smartd.'
    
    Then mkdir -p /var/lib/smartmontools && systemctl restart smartd. State files will start appearing on the next poll cycle (default every 30 minutes).

To verify smartd is persisting state, wait a poll cycle after starting smartd and check that /var/lib/smartmontools/smartd.*.state files exist and contain lines like ata-smart-attribute.0.id = 1.

If the integration can't find any state files it will emit a CRITICAL smartd.can_read service check with a message pointing back to this section. If a state file exists but has no SMART attribute data yet (normal right after smartd starts), smartd.disk_health will report UNKNOWN for that drive until the next poll cycle populates the file.

File permissions

The dd-agent user must have read access to the state files. They are typically world-readable with 644 permissions, so no special configuration is needed.

Installation

The integration is published to PyPI. The Datadog Agent does not use public PyPI directly, so install it by downloading the wheel and handing it to the Agent's integration install command.

# Download the wheel using the Agent's embedded pip
/opt/datadog-agent/embedded/bin/pip download --no-deps -d /tmp datadog-smartd

# Install the downloaded wheel into the Agent
datadog-agent integration install --local-wheel /tmp/datadog_smartd-*.whl

# Drop the example config into place and edit as needed
mkdir -p /etc/datadog-agent/conf.d/smartd.d
cp /opt/datadog-agent/embedded/lib/python*/site-packages/datadog_checks/smartd/data/conf.yaml.example \
   /etc/datadog-agent/conf.d/smartd.d/conf.yaml

Configuration

Edit /etc/datadog-agent/conf.d/smartd.d/conf.yaml to configure the check:

init_config:

instances:
  - smartd_state_dir: /var/lib/smartmontools
    min_collection_interval: 120

Then restart the Agent.

Validation

Run the Agent's status subcommand and look for smartd under the Checks section:

datadog-agent status

Or run the check directly:

datadog-agent check smartd

Data Collected

Metrics

See metadata.csv for a list of metrics provided by this integration.

Service Checks

smartd.disk_health: Returns OK if the drive is healthy, WARNING if reallocated sectors, pending sectors, or offline uncorrectable counts are non-zero, CRITICAL if a normalized attribute value reaches 0.

smartd.can_read: Returns OK if smartd state files were found and parsed successfully, CRITICAL otherwise.

Events

The smartd integration does not include any events.

Support

For help, open an issue on the GitHub repository.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

datadog_smartd-0.1.5.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

datadog_smartd-0.1.5-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file datadog_smartd-0.1.5.tar.gz.

File metadata

  • Download URL: datadog_smartd-0.1.5.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for datadog_smartd-0.1.5.tar.gz
Algorithm Hash digest
SHA256 e27c5973db314544791c122b0bccd34bb7a958b577258bcfab518953824a1f88
MD5 abfdb3e1e6177f39ae5d9b643db73b9b
BLAKE2b-256 e09ad24d9e02f711544721c97dcbe9d3bee92505feeb999a4e433e321b17113e

See more details on using hashes here.

Provenance

The following attestation bundles were made for datadog_smartd-0.1.5.tar.gz:

Publisher: release.yml on jaredledvina/datadog-smartd

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file datadog_smartd-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: datadog_smartd-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for datadog_smartd-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 d5c3f72140371d7b2fa55c6a62fb7608513ddb7a1237f546ea252d2a2878d5fa
MD5 d9de22573d13455f468f70a5eacd42b3
BLAKE2b-256 27c85d471532c040c2ee5efa81ad3aa9b5b89779bcc39b7fff76bab2a5727d8c

See more details on using hashes here.

Provenance

The following attestation bundles were made for datadog_smartd-0.1.5-py3-none-any.whl:

Publisher: release.yml on jaredledvina/datadog-smartd

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page