Skip to content

Commit

Permalink
Updated the docs
Browse files Browse the repository at this point in the history
  • Loading branch information
rickard-von-essen committed Feb 20, 2017
1 parent 0bb0fe4 commit a788a25
Showing 1 changed file with 51 additions and 24 deletions.
75 changes: 51 additions & 24 deletions plugins/inputs/smart/README.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,57 @@
# Telegraf S.M.A.R.T. plugin

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)[1] that detects and reports on various indicators of drive reliability, with the intent of enabling the anticipation of hardware failures.
See smartmontools(https://www.smartmontools.org/).
See smartmontools (https://www.smartmontools.org/).

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

```
smartctl --scan
```

On some platforms (e.g. Darwin/macOS) this doesn't return a useful list of devices and you must instead specify which devices to collect metrics from in the configuration file.

Metrics will be reported from the following `smartctl` command:

```
smartctl --info --attributes --nocheck=standby --format=brief <device>
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.

To enable SMART on a storage device run:

```
smartctl -s on <device>
```

## Measurements

- smart:
- smart_device:

* Tags:
- `capacity`
- `device`
- `device_model`
- `serial_no`
- `capacity`
- `enabled`
- `health`
- `serial_no`
* Fields:
- `exit_status`

- smart_attribute:

* Tags:
- `device`
- `fail`
- `flags`
- `id`
- `name`
- `flags`
- `fail`
* Fields:
- `exit_status`
- `raw_value`
- `threshold`
- `value`
- `worst`
- `threshold`
- `raw_value`

### Flags

Expand All @@ -52,25 +68,36 @@ The interpretation of the tag `flags` is:
```toml
# Read metrics from storage devices supporting S.M.A.R.T.
[[inputs.smart]]
## optionally specify the path to the smartctl executable
## Optionally specify the path to the smartctl executable
# path = "/usr/bin/smartctl"
#
## optionally specify devices to exclude from reporting.
# exclude = [ "/dev/pass6" ]
## Skip checking disks in this power mode. Defaults to
## "standby" to not wake up disks that have stoped rotating.
## See --nockeck 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 storage device.
# nocheck = "standby"
#
## Optionally specify devices to exclude from reporting.
# excludes = [ "/dev/pass6" ]
#
## optionally specify devices, if unset all S.M.A.R.T. devices
## will be included
# devices = [ "/dev/ada0" ]
## Optionally specify devices and device type, if unset
## a scan (smartctl --scan) for S.M.A.R.T. devices will
## done and all found will be included except for the
## excluded in excludes.
# devices = [ "/dev/ada0 -d atacam" ]
```

To run `smartctl` with `sudo` create a wrapper script and use `path` in
the configuration to execute that.

## Output

When retrieving stats from the local machine (no server specified):
Example output from an _Apple SSD_:
```
> smart,serial_no=WD-WMC4N0900000,id=1,name=Raw_Read_Error_Rate,flags=POSR-K,fail=-,host=example,device=/dev/ada0,device_model=WDC\ WD30EFRX-68EUZN0,capacity=3000592982016,enabled=Enabled value=200i,worst=200i,threshold=51i,raw_value=0i 1486892929000000000
> smart,serial_no=WD-WMC4N0900000,device=/dev/ada0,device_model=WDC\ WD30EFRX-68EUZN0,capacity=3000592982016,enabled=Enabled,id=3,name=Spin_Up_Time,flags=POS--K,fail=-,host=example value=181i,worst=180i,threshold=21i,raw_value=5916i 1486892929000000000
> smart,device_model=WDC\ WD30EFRX-68EUZN0,capacity=3000592982016,enabled=Enabled,name=Start_Stop_Count,flags=-O--CK,fail=-,device=/dev/ada0,serial_no=WD-WMC4N0900000,id=4,host=example value=100i,worst=100i,threshold=0i,raw_value=18i 1486892929000000000
> smart,enabled=Enabled,device_model=WDC\ WD30EFRX-68EUZN0,id=5,name=Reallocated_Sector_Ct,capacity=3000592982016,device=/dev/ada0,serial_no=WD-WMC4N0900000,flags=PO--CK,fail=-,host=example value=200i,worst=200i,threshold=140i,raw_value=0i 1486892929000000000
> smart,serial_no=WD-WMC4N0900000,capacity=3000592982016,enabled=Enabled,name=Seek_Error_Rate,host=example,device=/dev/ada0,id=7,flags=-OSR-K,fail=-,device_model=WDC\ WD30EFRX-68EUZN0 value=200i,worst=200i,threshold=0i,raw_value=0i 1486892929000000000
> smart,flags=-O--CK,device_model=WDC\ WD30EFRX-68EUZN0,capacity=3000592982016,enabled=Enabled,id=9,name=Power_On_Hours,fail=-,host=example,device=/dev/ada0,serial_no=WD-WMC4N0900000 value=65i,worst=65i,threshold=0i,raw_value=25998i 1486892929000000000
> smart_attribute,device=/dev/rdisk0,id=194,name=Temperature_Celsius,flags=-O---K,fail=-,host=STIZ0039.lan exit_status=0i,value=64i,worst=21i,threshold=0i,raw_value=36i 1487632495000000000
> smart_attribute,device=/dev/rdisk0,id=197,name=Current_Pending_Sector,flags=-O---K,fail=-,host=STIZ0039.lan exit_status=0i,value=100i,worst=100i,threshold=0i,raw_value=0i 1487632495000000000
> smart_attribute,device=/dev/rdisk0,id=199,name=UDMA_CRC_Error_Count,flags=-O-RC-,fail=-,host=STIZ0039.lan exit_status=0i,value=200i,worst=200i,threshold=0i,raw_value=0i 1487632495000000000
> smart_device,device_model=APPLE\ SSD\ SM256E,serial_no=S0X5NZBC422720,capacity=251000193024,enabled=Enabled,health=PASSED,host=STIZ0039.lan,device=/dev/rdisk0 exit_status=0i 1487632495000000000
```

0 comments on commit a788a25

Please sign in to comment.