diff options
Diffstat (limited to '')
-rw-r--r-- | collectors/python.d.plugin/smartd_log/README.md | 22 | ||||
-rw-r--r-- | collectors/python.d.plugin/smartd_log/smartd_log.chart.py | 19 |
2 files changed, 27 insertions, 14 deletions
diff --git a/collectors/python.d.plugin/smartd_log/README.md b/collectors/python.d.plugin/smartd_log/README.md index 6f4dda50c..a1b41f408 100644 --- a/collectors/python.d.plugin/smartd_log/README.md +++ b/collectors/python.d.plugin/smartd_log/README.md @@ -1,8 +1,14 @@ -# smartd_log +<!-- +title: "Storage devices monitoring with Netdata" +custom_edit_url: https://github.com/netdata/netdata/edit/master/collectors/python.d.plugin/smartd_log/README.md +sidebar_label: "S.M.A.R.T. attributes" +--> -Module monitor `smartd` log files to collect HDD/SSD S.M.A.R.T attributes. +# Storage devices monitoring with Netdata -**Requirements:** +Monitors `smartd` log files to collect HDD/SSD S.M.A.R.T attributes. + +## Requirements - `smartmontools` @@ -97,7 +103,15 @@ Otherwise, all the smartd `.csv` files may get written to `/var/lib/smartmontool `smartd` appends logs at every run. It's strongly recommended to use `logrotate` for smartd files. -## configuration +## Configuration + +Edit the `python.d/smartd_log.conf` configuration file using `edit-config` from the Netdata [config +directory](/docs/configure/nodes.md), which is typically at `/etc/netdata`. + +```bash +cd /etc/netdata # Replace this path with your Netdata config directory, if different +sudo ./edit-config python.d/smartd_log.conf +``` ```yaml local: diff --git a/collectors/python.d.plugin/smartd_log/smartd_log.chart.py b/collectors/python.d.plugin/smartd_log/smartd_log.chart.py index f121ab2e0..8f10a5351 100644 --- a/collectors/python.d.plugin/smartd_log/smartd_log.chart.py +++ b/collectors/python.d.plugin/smartd_log/smartd_log.chart.py @@ -5,13 +5,11 @@ import os import re - from copy import deepcopy from time import time -from bases.collection import read_last_line from bases.FrameworkServices.SimpleService import SimpleService - +from bases.collection import read_last_line INCREMENTAL = 'incremental' ABSOLUTE = 'absolute' @@ -59,7 +57,6 @@ ATTR_VERIFY_ERR_COR = 'verify-total-err-corrected' ATTR_VERIFY_ERR_UNC = 'verify-total-unc-errors' ATTR_TEMPERATURE = 'temperature' - RE_ATA = re.compile( '(\d+);' # attribute '(\d+);' # normalized value @@ -265,7 +262,7 @@ CHARTS = { 'line'], 'lines': [], 'attrs': [ATTR5], - 'algo': INCREMENTAL, + 'algo': ABSOLUTE, }, 'reserved_block_count': { 'options': [None, 'Reserved Block Count', 'percentage', 'wear', 'smartd_log.reserved_block_count', 'line'], @@ -533,7 +530,9 @@ def handle_error(*errors): return method(*args) except errors: return None + return on_call + return on_method @@ -653,10 +652,10 @@ class Service(SimpleService): current_time = time() for disk in self.disks[:]: if any( - [ - not disk.alive, - not disk.log_file.is_active(current_time, self.age), - ] + [ + not disk.alive, + not disk.log_file.is_active(current_time, self.age), + ] ): self.disks.remove(disk.raw_name) self.remove_disk_from_charts(disk) @@ -673,7 +672,7 @@ class Service(SimpleService): return len(self.disks) - def create_disk_from_file(self, full_name, current_time): + def create_disk_from_file(self, full_name, current_time): if not full_name.endswith(CSV): self.debug('skipping {0}: not a csv file'.format(full_name)) return None |