Code

smart: add a SMART plugin
authorVincent Bernat <vincent@bernat.im>
Fri, 7 Nov 2014 14:13:27 +0000 (15:13 +0100)
committerVincent Bernat <Vincent.Bernat@exoscale.ch>
Mon, 10 Nov 2014 21:14:05 +0000 (22:14 +0100)
commit5e77bd677c549c4c1f81b8b8f7d78b8fd193749a
tree10e1cdf47154613402db4da66daf4a90d2764cc4
parent3b618a331d47fa5868f414b42439f7a0f08667cd
smart: add a SMART plugin

This plugin uses libatasmart:
 http://0pointer.de/blog/projects/being-smart.html

As libatasmart is Linux-only, the plugin is therefore Linux-only
too. The disks are discovered through libudev.

Each SMART attribute is extracted. The current value, worst value,
threshold value (if any) are recorded. Those are normalized
values (between 0 and 255, higher is better). For some values, it makes
more sense to record the raw value. libatasmart is converting this raw
value to something sensible. We record that form. Sometimes, this is
just the raw value but sometimes this is converted to another scale (for
example, the temperature). People should know what each attribute means
before using those values. Otherwise, the normalized values are better.

Four values are (power-on time, power cycle count, bad sectors and
temperature) are also recorded on their own. Those are usually the
values that the user care about the most.

Here is an excerpt of the plugin output with the CSV plugin (the SSD
disk on my laptop doesn't provide a temperature sensor):

    .
    └── zoro.exoscale.ch
        └── smart-sda
            ├── smart_attribute-attribute-173-2014-11-10
            ├── smart_attribute-attribute-174-2014-11-10
            ├── smart_attribute-available-reserved-space-2014-11-10
            ├── smart_attribute-end-to-end-error-2014-11-10
            ├── smart_attribute-erase-fail-count-2014-11-10
            ├── smart_attribute-power-cycle-count-2014-11-10
            ├── smart_attribute-power-on-hours-2014-11-10
            ├── smart_attribute-power-on-seconds-2-2014-11-10
            ├── smart_attribute-program-fail-count-2014-11-10
            ├── smart_attribute-reallocated-sector-count-2014-11-10
            ├── smart_attribute-reported-uncorrect-2014-11-10
            ├── smart_attribute-total-lbas-read-2014-11-10
            ├── smart_attribute-total-lbas-written-2014-11-10
            ├── smart_attribute-udma-crc-error-count-2014-11-10
            ├── smart_attribute-unused-reserved-blocks-2014-11-10
            ├── smart_attribute-used-reserved-blocks-chip-2014-11-10
            ├── smart_badsectors-2014-11-10
            ├── smart_powercycles-2014-11-10
            └── smart_poweron-2014-11-10

    $ cat zoro.exoscale.ch/smart-sda/smart_attribute-total-lbas-read-2014-11-10
    epoch,current,worst,threshold,pretty
    1415613266.376,100.000000,100.000000,0.000000,281018.000000
    1415613276.395,100.000000,100.000000,0.000000,281018.000000
    1415613286.384,100.000000,100.000000,0.000000,281051.000000
    1415613296.383,100.000000,100.000000,0.000000,281051.000000
README
configure.ac
src/Makefile.am
src/collectd.conf.in
src/collectd.conf.pod
src/smart.c [new file with mode: 0644]
src/types.db