smartd, a daemon that polls your drives and runs an alert hook when a monitored condition changes. This guide covers a full monitoring build: smartd alerts, scheduled self-tests, Prometheus metrics and a wear forecast. It is a third-party stack. Microsoft documents no native smartd or Prometheus integration for Windows 11, so test everything on your own machine.The source guide pitches the build at about 70 minutes. Treat that as a rough estimate for a first setup, not a promise. Some version claims in the original are also unverified, and I flag those below.
What continuous monitoring adds
SMART data is a snapshot, and the useful signal for flash storage is the direction of travel. A Percentage Used value of 40% means little by itself. A value that went from 31% to 40% in six weeks tells you something about your replacement date.
The build has three layers, each answering a different question:
- smartd runs locally with no network and alerts on events. Examples are a failed health check, a nonzero critical-warning bit, a new self-test error or a temperature limit being crossed.
- A Prometheus exporter turns SMART fields into time series you can graph, compare across machines and alert on. The community
smartctl_exporterreads smartctl's JSON output. It requires smartmontools 7.0 or newer, because JSON export arrived in 7.0. (That requirement is stated in the exporter's README, which was part of the source packet rather than this search.) - A forecast script converts a coarse 1% wear step into an estimated date.
The overall PASSED verdict is the weakest signal here. A drive can report PASSED while its media-error counter climbs or its spare capacity shrinks. Alerting on individual fields catches trouble earlier.
None of this replaces backups. A controller can die without warning, and firmware bugs, power surges and accidental deletion never appear in SMART output.
Prerequisites and version checks
- Permissions: smartctl needs root or administrator rights. The exporter's own FAQ explains that SATA access via ATA pass-through commands is blocked for non-root users.
- Version: run
smartctl --versionand read the first line. Anything from 7.0 up works for the exporter. Distribution packages can lag upstream. - Release status: the smartmontools download page confirms 7.5 was released on April 30, 2025. I could not confirm the original's claim that 7.5 is still the newest stable release on November 21, 2026, so check the project site yourself.
- Exporter release: the exporter's releases page lists 0.15.0 as the latest, with changes including extra temperature values, endurance and verify-error metrics, and handling of NVMe devices behind bridges. Release dates on that page are inconsistent. The header says 2026-09-01 and the asset timestamps say 2026-10-06. Don't rely on a specific date.
- Alert delivery: you need a working mail command, a webhook URL that accepts a JSON POST, or both.
- Inventory: write down every host and its drive count. You will use that list to check coverage later.
Install from your distribution first, because the package brings the service unit and a default smartd.conf. On Windows, use the installer from the official smartmontools site. According to the project's INSTALL documentation, the "Full" install type adds the installation directory to the User PATH variable. Verify the PATH in a new PowerShell window with smartctl --version. Files land under C:\Program Files\smartmontools\bin.
Step 1: Capture a baseline
Run these as root or from an elevated prompt:
smartctl --scanlists devices and their types.smartctl -H /dev/nvme0gives the quick verdict.smartctl -a /dev/nvme0gives the full report.smartctl -a -j /dev/nvme0 > baseline.jsonsaves machine-readable JSON to compare against later.
The -d type on each scan line is what you paste into smartd.conf if auto-detection fails. smartctl's exit code is a bitmask. For example, bit 3 (value 8) means SMART status returned DISK FAILING. Bits 6 and 7 (values 64 and 128) mean the error log and self-test log contain errors. Values add together, so 192 means both. Scripts should read this bitmask rather than the plain success or failure of the process, because smartctl often exits non-zero while still printing valid data.
Step 2: Know which fields predict trouble
smartmontools' NVMe source prints the SMART/Health log with these fields:
| Field | Why it matters | Suggested alert |
|---|---|---|
| Critical Warning | Bit field for low spare, temperature, reliability, read-only mode | Any nonzero value |
| Available Spare vs. Threshold | Reserve blocks remaining | At or below the drive's own threshold |
| Percentage Used | Estimated share of rated endurance consumed | Warn around 80%, then forecast |
| Media and Data Integrity Errors | Errors the controller could not correct | Any increase |
| Data Units Written | Host writes, in units of 512,000 bytes | Rate far above normal workload |
| Unsafe Shutdowns | Power loss without clean shutdown | Increase with no explanation |
Percentage Used can exceed 100 without the drive dying. Treat 100 as a planning date, not a countdown to data loss.
SATA drives report numbered vendor-specific attributes instead. Names and raw-value meanings vary by drive. The usual watch list is reallocated sectors, uncorrectable errors and the vendor's wear attribute. A rising CRC error count more often points at the cable or port than at the flash.
Step 3: Write smartd.conf
Back up the original file first. On Windows it sits next to the binaries and uses the same syntax. Use one line per device so SATA and NVMe each get the directives that suit them. The source guide's example is:
/dev/sda -d sat -a -o on -S on -W 4,55,65 \
-s (S/../.././02|L/../../7/03) \
-m <nomailer> -M exec /usr/local/bin/smartd-notify.sh
/dev/nvme0 -d nvme -H -W 4,65,75 \
-s (S/../.././02|L/../../7/03) \
-m <nomailer> -M exec /usr/local/bin/smartd-notify.sh
Treat this as a template and validate it against your own version. A few notes on it:
- Pick the
-Wtemperature limits from your drive's datasheet. The values above are the source guide's examples. <nomailer>with-M execis the documented way to run your own script. The Debian man page describes this: with the special address<nomailer>, the executable is run in a shell with no STDIN and no command-line arguments.- smartd passes information to the script through environment variables. Debian's man page lists SMARTD_DEVICE, set to the device path, along with others such as SMARTD_DEVICETYPE. The failure-type and full-message variables used by the source script, SMARTD_FAILTYPE and SMARTD_FULLMESSAGE, also appear in smartd's documentation. Check
man smartd.confon your build for the exact list. - If you use a single
DEVICESCANline, put explicit device lines before it. The Ubuntu community wiki notes that after DEVICESCAN the rest of the file is ignored. - If the script prints anything to stdout or stderr, smartd treats that as a sign something is going wrong. Keep the script quiet and have it log to syslog.
Step 4: Schedule self-tests
The -s directive takes a regular expression in the form T/MM/DD/d/HH. S means short test and L means long test. The day-of-week field runs from 1 (Monday) to 7 (Sunday). So S/../.././02 is a short test every day at 02:00, and L/../../7/03 is a long test every Sunday at 03:00.
Before enabling any schedule, check that the drive supports it with smartctl -c /dev/sda. NVMe self-test support depends on both the drive and the build. smartmontools' NVMe code checks a capability flag and prints that self-tests are not supported when it is absent. If your NVMe drive lacks the capability, drop -s from that line and rely on the health and critical-warning checks. Schedule long tests for quiet periods, and on laptops, while the machine is on mains power.
To preview what smartd thinks your schedule is, run smartd -q showtests -c /etc/smartd.conf. This is the source guide's suggestion. I did not verify it independently, so confirm it against your version's man page.
Step 5: Start the service and fire a test alert
On Red Hat-family and Arch systems the unit is typically smartd.service. On Debian and Ubuntu it is smartmontools.service, with smartd as an alias. If enabling by alias fails, use the real name. After edits, reload with systemctl reload. Check the journal for one "Device:" line per drive. A missing drive means the path or type in the config is wrong.
On Windows, smartd can be installed as a service from an elevated prompt in the install folder. The project's INSTALL document says the package ships smartd_warning.cmd, a PowerShell mailer script and a sample mailer config. Windows therefore has built-in alert hooks beyond the PowerShell port the source guide suggests.
Test the pipeline before you trust it. Add -M test to one device line. Per the man page, test sends a single test email immediately upon smartd startup. The same page warns that smartd will also send the normal email warnings enabled with -m, in addition to the single test email. Reload, then check syslog, your inbox and your chat channel. If syslog shows the message but your inbox doesn't, the fault is in the mail relay or webhook, not in smartd.
Remove -M test afterwards. Otherwise every service restart sends another test message. The Ubuntu wiki adds a warning for the case where a test misfires. You may need to boot into recovery mode and remove the -M test option from /etc/smartd.conf. Reading that in context, the risk applies if the test action itself breaks boot.
For quick debugging, run one polling pass in the foreground with smartd -d -q onecheck. The mankier smartd.conf page also recommends running smartd in debug mode with the -d flag, using -M test, if you have mail problems.
Alert fatigue is a real problem. The -M directive has repeat-control options: once sends one warning per problem type, daily is the default, and diminishing spaces reminders out. Per the man page, once sends only one warning email for each type of disk problem detected.
Step 6: Export metrics to Prometheus
The exporter's README documents these defaults and options:
- The default listen address is
:9633, and the metrics path is/metrics. - The smartctl path defaults to
/usr/sbin/smartctl. Windows users must pass the path explicitly with--smartctl.path. - Devices are scanned automatically unless you pass
--smartctl.device. - TLS and basic authentication are supported through
--web.config.file. - The default poll interval is 60 seconds, set with
--smartctl.interval.
Bind to 127.0.0.1 if Prometheus reaches the host through a local agent or tunnel. Otherwise bind to the LAN address and protect the port with TLS and authentication.
Before writing any alert rules, read the live metrics: curl -s [url]http://127.0.0.1:9633/metrics[/url] | grep -i nvme. Metric names can change between exporter versions. The source guide's rule examples use names such as smartctl_device_media_errors, smartctl_device_percentage_used and smartctl_device_available_spare. Confirm that each one exists on your build before you rely on it.
The rules worth having:
- SMART status failed for a few minutes.
- Any nonzero critical-warning value.
- Media errors increasing over 24 hours. Leave off a
for:delay so a single new error pages you at once. - Available spare at or below its own threshold.
- Percentage Used at or above 80%.
- A
predict_linearrule for projected 100% within 90 days. It stays quiet until about two weeks of history accumulate, and it may flicker because wear moves in whole-number steps. - Exporter target down.
Validate with promtool check rules and promtool check config. Then confirm every host shows as UP on the Targets page and every rule is inactive.
Step 7: The wear forecast script, and its limits
The source guide includes a Python script that logs one row per drive per day and estimates days until Percentage Used reaches 100. It needs 7 or more days of history and uses the last 30 days of rows. I did not run it, and the source packet flags several caveats:
- It covers NVMe only. It reads the NVMe health block and skips drives without it. Despite the guide's "every SATA and NVMe drive" language, it does not forecast SATA endurance.
- The written-bytes arithmetic is unverified. The script multiplies Data Units Written by 512,000. The smartmontools source confirms that unit, but check the JSON your installed version emits before trusting the terabytes figure.
- The snippets as published had formatting defects. Some code in the original text was run together and duplicated. Review and test any copy before deploying it.
- The result is a planning estimate, not a prediction. Integer wear steps make early estimates swing wildly.
If you run it from a systemd timer with an OnFailure= companion unit, exercise the full path end to end. A broken environment variable or webhook there silently defeats the warning.
Step 8: Run it for a week, then tune
- Count alerts by type in the journal.
- Re-run
smartctl -a -jand compare power-on hours, unsafe shutdowns and writes against the baseline. - Adjust temperature limits to your drive's rated range, or fix airflow.
- Add
-M diminishingor-M onceto quiet repeat reminders. - Compare the Prometheus target list against your inventory. A drive that never reports is the one that will surprise you.
- Log the date and any threshold changes.
Repeat at one month, then quarterly. Also keep the drive database fresh. The project docs say update-smart-drivedb refreshes it on Linux, and the Windows package provides update-smart-drivedb.ps1.
Common failure points
| Symptom | Likely cause | Fix |
|---|---|---|
| "Permission denied" | Not running as root or admin | Use sudo or an elevated prompt |
| Drive missing from scan | Controller or USB bridge hides it | Pass -d explicitly, for example sat |
| smartd starts but never alerts | <nomailer> set without -M exec, or a script path typo | Fix the path, make the script executable, run it by hand |
| Test reaches syslog but not email | No mail transport | Install and test a mailer separately |
| No NVMe metrics in exporter | smartmontools older than 7.0, or missing privileges | Upgrade, check exporter logs |
| Target shows DOWN | Wrong bind address, port or firewall | Fix the listen address and test with curl |
| Behind a hardware RAID controller | Virtual disk hides drives | Use the controller device type, such as megaraid,N |
The exporter documents megaraid device types for this case. The exporter's 0.13.0 notes mention megaraid support, and its 0.15.0 notes mention improved handling of NVMe behind bridges. USB enclosures may need an explicit type, but whether a given bridge passes NVMe admin commands through varies by chip.
Should you bother?
For a one-off check on a single machine, CrystalDiskInfo or smartctl -a is faster. Monitoring earns its keep on drives you can't afford to learn about late: a home server's boot disk, a build machine's scratch NVMe, or a small-office fleet. For one or two machines, smartd and a notify script are plenty. Prometheus pays off when you want months of history, cross-host comparison or trend alerts.
The honest caveat is that SMART reports only what a drive chooses to expose. It is a useful early-warning layer for slow failures, not a guarantee. Keep verified backups, and treat an 80% wear alert as the cue to clone, buy and migrate while the drive still works.
References
- smartmontools SSD Alerts: 12 Steps, 70 Min - shattered.io shattered.io · 2026-11-21T09:30:27+00:00
- smartd.conf: SMART Disk Monitoring Daemon Configuration File mankier.com
- smartmontools: smartd.cpp Source File smartmontools.org