| 1 | plugin_name: go.d.plugin |
| 2 | modules: |
| 3 | - meta: |
| 4 | id: collector-go.d.plugin-smartctl |
| 5 | plugin_name: go.d.plugin |
| 6 | module_name: smartctl |
| 7 | monitored_instance: |
| 8 | name: S.M.A.R.T. |
| 9 | link: "https://linux.die.net/man/8/smartd" |
| 10 | icon_filename: "smart.png" |
| 11 | categories: |
| 12 | - data-collection.storage |
| 13 | keywords: |
| 14 | - smart |
| 15 | - S.M.A.R.T. |
| 16 | - SCSI devices |
| 17 | - ATA devices |
| 18 | related_resources: |
| 19 | integrations: |
| 20 | list: [] |
| 21 | info_provided_to_referring_integrations: |
| 22 | description: "" |
| 23 | overview: |
| 24 | data_collection: |
| 25 | metrics_description: | |
| 26 | This collector monitors the health status of storage devices by analyzing S.M.A.R.T. (Self-Monitoring, Analysis, and Reporting Technology) counters. |
| 27 | It relies on the [`smartctl`](https://linux.die.net/man/8/smartctl) CLI tool but avoids directly executing the binary. |
| 28 | Instead, it utilizes `ndsudo`, a Netdata helper specifically designed to run privileged commands securely within the Netdata environment. |
| 29 | This approach eliminates the need to use `sudo`, improving security and potentially simplifying permission management. |
| 30 | |
| 31 | Executed commands: |
| 32 | - `smartctl --json --scan` |
| 33 | - `smartctl --json --all {deviceName} --device {deviceType} --nocheck {powerMode}` |
| 34 | method_description: "" |
| 35 | supported_platforms: |
| 36 | include: [Linux, BSD] |
| 37 | exclude: [] |
| 38 | multi_instance: false |
| 39 | additional_permissions: |
| 40 | description: "" |
| 41 | default_behavior: |
| 42 | auto_detection: |
| 43 | description: "" |
| 44 | limits: |
| 45 | description: "" |
| 46 | performance_impact: |
| 47 | description: "" |
| 48 | setup: |
| 49 | prerequisites: |
| 50 | list: |
| 51 | - title: Install smartmontools (v7.0+) |
| 52 | description: | |
| 53 | Install `smartmontools` version 7.0 or later using your distribution's package manager. Version 7.0 introduced the `--json` output mode, which is required for this collector to function properly. |
| 54 | - title: For Netdata running in a Docker container |
| 55 | description: | |
| 56 | **Provide access to storage devices**. |
| 57 | |
| 58 | Netdata requires the `SYS_RAWIO` capability and access to the storage devices to run the `smartctl` collector inside a Docker container. Here's how you can achieve this: |
| 59 | |
| 60 | - `docker run` |
| 61 | |
| 62 | ```bash |
| 63 | docker run --cap-add SYS_RAWIO --device /dev/sda:/dev/sda ... |
| 64 | ``` |
| 65 | |
| 66 | - `docker-compose.yml` |
| 67 | |
| 68 | ```yaml |
| 69 | services: |
| 70 | netdata: |
| 71 | cap_add: |
| 72 | - SYS_PTRACE |
| 73 | - SYS_ADMIN |
| 74 | - SYS_RAWIO # smartctl |
| 75 | devices: |
| 76 | - "/dev/sda:/dev/sda" |
| 77 | ``` |
| 78 | |
| 79 | > **Multiple Devices**: These examples only show mapping of one device (/dev/sda). You'll need to add additional `--device` options (in docker run) or entries in the `devices` list (in docker-compose.yml) for each storage device you want Netdata's smartctl collector to monitor. |
| 80 | |
| 81 | > **NVMe Devices**: Do not map NVMe devices using this method. Netdata uses a [dedicated collector](https://github.com/netdata/netdata/tree/master/src/go/plugin/go.d/collector/nvme#readme) to monitor NVMe devices. |
| 82 | configuration: |
| 83 | file: |
| 84 | name: go.d/smartctl.conf |
| 85 | options: |
| 86 | description: | |
| 87 | The following options can be defined globally: update_every. |
| 88 | folding: |
| 89 | title: Config options |
| 90 | enabled: true |
| 91 | list: |
| 92 | - name: update_every |
| 93 | description: Netdata chart update interval (seconds). Collector may use cached data if this is less than **poll_devices_every**. |
| 94 | default_value: 10 |
| 95 | required: false |
| 96 | group: Collection |
| 97 | - name: timeout |
| 98 | description: "`smartctl` binary execution timeout (seconds)." |
| 99 | default_value: 5 |
| 100 | required: false |
| 101 | group: Collection |
| 102 | - name: scan_every |
| 103 | description: Device discovery interval using `smartctl --scan` (seconds). Set 0 to scan only once at startup. |
| 104 | default_value: 900 |
| 105 | required: false |
| 106 | group: Collection |
| 107 | - name: poll_devices_every |
| 108 | description: Device polling interval (seconds). Data is cached for this interval. |
| 109 | default_value: 300 |
| 110 | required: false |
| 111 | group: Collection |
| 112 | |
| 113 | - name: device_selector |
| 114 | description: "Pattern to match the 'info name' of devices as reported by `smartctl --scan --json`." |
| 115 | default_value: "*" |
| 116 | required: false |
| 117 | group: Target |
| 118 | - name: extra_devices |
| 119 | description: "Manually specify devices not auto-detected by `smartctl --scan`. Each entry must include both a name and a type." |
| 120 | default_value: "[]" |
| 121 | required: false |
| 122 | group: Target |
| 123 | |
| 124 | - name: concurrent_scans |
| 125 | description: "Number of devices to scan concurrently. Set 0 for sequential scanning (default). Helps performance when monitoring many devices." |
| 126 | default_value: 0 |
| 127 | required: false |
| 128 | group: Performance |
| 129 | - name: no_check_power_mode |
| 130 | description: "Skip data collection when device is in low-power mode (avoids unnecessary spin-up)." |
| 131 | default_value: standby |
| 132 | required: false |
| 133 | group: Performance |
| 134 | detailed_description: | |
| 135 | Valid arguments: |
| 136 | |
| 137 | | Mode | Description | |
| 138 | |---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |
| 139 | | never | Check the device always. | |
| 140 | | sleep | Skip check if device is in SLEEP mode. | |
| 141 | | standby | Skip check if device is in SLEEP or STANDBY mode (prevents spin-up). | |
| 142 | | idle | Skip check if device is in SLEEP, STANDBY, or IDLE mode (not recommended since disks may still be spinning). | |
| 143 | examples: |
| 144 | folding: |
| 145 | title: Config |
| 146 | enabled: true |
| 147 | list: |
| 148 | - name: Custom devices poll interval |
| 149 | description: Allows you to override the default devices poll interval (data collection). |
| 150 | config: | |
| 151 | jobs: |
| 152 | - name: smartctl |
| 153 | poll_devices_every: 60 # Collect S.M.A.R.T statistics every 60 seconds |
| 154 | - name: Concurrent scanning for multiple devices |
| 155 | description: | |
| 156 | This example demonstrates enabling concurrent scanning to improve performance when monitoring many devices. |
| 157 | config: | |
| 158 | jobs: |
| 159 | - name: smartctl |
| 160 | concurrent_scans: 4 # Scan up to 4 devices concurrently |
| 161 | - name: Extra devices |
| 162 | description: | |
| 163 | This example demonstrates using `extra_devices` to manually add a storage device (`/dev/sdc`) not automatically detected by `smartctl --scan`. |
| 164 | config: | |
| 165 | jobs: |
| 166 | - name: smartctl |
| 167 | extra_devices: |
| 168 | - name: /dev/sdc |
| 169 | type: jmb39x-q,3 |
| 170 | troubleshooting: |
| 171 | problems: |
| 172 | list: [] |
| 173 | alerts: [] |
| 174 | metrics: |
| 175 | folding: |
| 176 | title: Metrics |
| 177 | enabled: false |
| 178 | description: "" |
| 179 | availability: [] |
| 180 | scopes: |
| 181 | - name: controller |
| 182 | description: These metrics refer to the Storage Device. |
| 183 | labels: |
| 184 | - name: device_name |
| 185 | description: Device name |
| 186 | - name: device_type |
| 187 | description: Device type |
| 188 | - name: model_name |
| 189 | description: Model name |
| 190 | - name: serial_number |
| 191 | description: Serial number |
| 192 | metrics: |
| 193 | - name: smartctl.device_smart_status |
| 194 | description: Device smart status |
| 195 | unit: status |
| 196 | chart_type: line |
| 197 | dimensions: |
| 198 | - name: passed |
| 199 | - name: failed |
| 200 | - name: smartctl.device_ata_smart_error_log_count |
| 201 | description: Device ATA smart error log count |
| 202 | unit: logs |
| 203 | chart_type: line |
| 204 | dimensions: |
| 205 | - name: error_log |
| 206 | - name: smartctl.device_power_on_time |
| 207 | description: Device power on time |
| 208 | unit: seconds |
| 209 | chart_type: line |
| 210 | dimensions: |
| 211 | - name: power_on_time |
| 212 | - name: smartctl.device_temperature |
| 213 | description: Device temperature |
| 214 | unit: Celsius |
| 215 | chart_type: line |
| 216 | dimensions: |
| 217 | - name: temperature |
| 218 | - name: smartctl.device_power_cycles_count |
| 219 | description: Device power cycles |
| 220 | unit: cycles |
| 221 | chart_type: line |
| 222 | dimensions: |
| 223 | - name: power |
| 224 | - name: smartctl.device_read_errors_rate |
| 225 | description: Device read errors |
| 226 | unit: errors/s |
| 227 | chart_type: line |
| 228 | dimensions: |
| 229 | - name: corrected |
| 230 | - name: uncorrected |
| 231 | - name: smartctl.device_write_errors_rate |
| 232 | description: Device write errors |
| 233 | unit: errors/s |
| 234 | chart_type: line |
| 235 | dimensions: |
| 236 | - name: corrected |
| 237 | - name: uncorrected |
| 238 | - name: smartctl.device_verify_errors_rate |
| 239 | description: Device verify errors |
| 240 | unit: errors/s |
| 241 | chart_type: line |
| 242 | dimensions: |
| 243 | - name: corrected |
| 244 | - name: uncorrected |
| 245 | - name: smartctl.device_smart_attr_{attribute_name} |
| 246 | description: Device smart attribute {attribute_name} |
| 247 | unit: '{attribute_unit}' |
| 248 | chart_type: line |
| 249 | dimensions: |
| 250 | - name: '{attribute_name}' |
| 251 | - name: smartctl.device_smart_attr_{attribute_name}_normalized |
| 252 | description: Device smart attribute {attribute_name} normalized |
| 253 | unit: value |
| 254 | chart_type: line |
| 255 | dimensions: |
| 256 | - name: '{attribute_name}' |