Skip to content

Commit

Permalink
Update Grafana Dashboard and Readme (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
ngosang authored Aug 21, 2022
1 parent 932ba11 commit e1f9b34
Show file tree
Hide file tree
Showing 5 changed files with 257 additions and 9 deletions.
24 changes: 20 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,34 @@ Docker image is here: <https://hub.docker.com/r/matusnovak/prometheus-smartctl>
The architectures supported by this image are: linux/386, linux/amd64, linux/arm/v6, linux/arm/v7, linux/arm64/v8, linux/ppc64le, linux/s390x

Example docker-compose.yml:

```yml
version: '3'
services:
smartctl-metrics:
smartctl-exporter:
image: matusnovak/prometheus-smartctl:latest
restart: unless-stopped
container_name: smartctl-exporter
privileged: true
ports:
- 9902:9902
- "9902:9902"
restart: unless-stopped
```
Your metrics will be available at <http://localhost:9902/metrics>
The exported metrics looks like these:
```shell
smartprom_smart_passed{drive="/dev/sda",model_family="Seagate BarraCuda 3.5 (SMR)",model_name="ST6000DM003-2CY296",serial_number="WCT362XM",type="sat"} 1.0
smartprom_raw_read_error_rate{drive="/dev/sda",model_family="Seagate BarraCuda 3.5 (SMR)",model_name="ST6000DM003-2CY296",serial_number="WCT362XM",type="sat"} 83.0
smartprom_raw_read_error_rate_raw{drive="/dev/sda",model_family="Seagate BarraCuda 3.5 (SMR)",model_name="ST6000DM003-2CY296",serial_number="WCT362XM",type="sat"} 2.23179896e+08
smartprom_power_on_hours{drive="/dev/sda",model_family="Seagate BarraCuda 3.5 (SMR)",model_name="ST6000DM003-2CY296",serial_number="WCT362XM",type="sat"} 73.0
smartprom_power_on_hours_raw{drive="/dev/sda",model_family="Seagate BarraCuda 3.5 (SMR)",model_name="ST6000DM003-2CY296",serial_number="WCT362XM",type="sat"} 24299.0
smartprom_airflow_temperature_cel{drive="/dev/sda",model_family="Seagate BarraCuda 3.5 (SMR)",model_name="ST6000DM003-2CY296",serial_number="WCT362XM",type="sat"} 60.0
smartprom_airflow_temperature_cel_raw{drive="/dev/sda",model_family="Seagate BarraCuda 3.5 (SMR)",model_name="ST6000DM003-2CY296",serial_number="WCT362XM",type="sat"} 40.0
...
```

## Configuration

All configuration is done with environment variables.
Expand All @@ -52,4 +67,5 @@ All configuration is done with environment variables.

There is a reference Grafana dashboard in [grafana/grafana_dashboard.json](./grafana/grafana_dashboard.json).

![](./grafana/grafana_dashboard.png)
![](./grafana/grafana_dashboard_1.png)
![](./grafana/grafana_dashboard_2.png)
242 changes: 237 additions & 5 deletions grafana/grafana_dashboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,232 @@
],
"liveNow": false,
"panels": [
{
"datasource": {
"type": "prometheus",
"uid": "fmMKqssGk"
},
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"align": "auto",
"displayMode": "auto",
"filterable": false,
"inspect": false
},
"mappings": [
{
"options": {
"0": {
"index": 1,
"text": "ERROR"
},
"1": {
"index": 2,
"text": "OK"
},
"-1": {
"index": 0,
"text": "UNKNOWN"
}
},
"type": "value"
}
],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "red",
"value": null
},
{
"color": "red",
"value": 0
},
{
"color": "green",
"value": 1
}
]
},
"unit": "none"
},
"overrides": [
{
"matcher": {
"id": "byRegexp",
"options": "health"
},
"properties": [
{
"id": "custom.displayMode",
"value": "color-background"
}
]
}
]
},
"gridPos": {
"h": 7,
"w": 24,
"x": 0,
"y": 0
},
"id": 38,
"links": [],
"maxDataPoints": 100,
"options": {
"footer": {
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"frameIndex": 1,
"showHeader": true,
"sortBy": [
{
"desc": false,
"displayName": "instance"
}
]
},
"pluginVersion": "9.0.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "fmMKqssGk"
},
"exemplar": true,
"expr": "smartprom_smart_passed",
"format": "table",
"hide": false,
"instant": true,
"interval": "",
"intervalFactor": 1,
"legendFormat": "",
"refId": "A"
}
],
"title": "SMART Health",
"transformations": [
{
"id": "groupBy",
"options": {
"fields": {
"Value": {
"aggregations": [
"last"
],
"operation": "aggregate"
},
"Value #A": {
"aggregations": [
"sum"
],
"operation": "aggregate"
},
"Value #B": {
"aggregations": [
"sum"
],
"operation": "aggregate"
},
"Value #C": {
"aggregations": [
"sum"
],
"operation": "aggregate"
},
"Value #D": {
"aggregations": [
"sum"
],
"operation": "aggregate"
},
"Value #E": {
"aggregations": [
"sum"
],
"operation": "aggregate"
},
"drive": {
"aggregations": [],
"operation": "groupby"
},
"instance": {
"aggregations": [],
"operation": "groupby"
},
"model_family": {
"aggregations": [],
"operation": "groupby"
},
"model_name": {
"aggregations": [],
"operation": "groupby"
},
"serial_number": {
"aggregations": [],
"operation": "groupby"
},
"type": {
"aggregations": [],
"operation": "groupby"
}
}
}
},
{
"id": "organize",
"options": {
"excludeByName": {
"Time": true,
"__name__": false,
"backup_id": true,
"backup_type": true,
"client_hostname": false,
"client_id": true,
"client_os_version": true,
"client_username": true,
"client_version": true,
"instance": false,
"job": true,
"snapshot_id": true
},
"indexByName": {
"Time": 0,
"Value #A": 5,
"Value #B": 6,
"__name__": 1,
"drive": 3,
"instance": 2,
"job": 4
},
"renameByName": {
"Value": "",
"Value #A": "reallocated_sector_ct",
"Value #A (sum)": "reallocated_sector_ct",
"Value #B": "reported_uncorrect",
"Value #B (sum)": "reported_uncorrect",
"Value #C (sum)": "command_timeout",
"Value #D (sum)": "current_pending_sector",
"Value #E (sum)": "offline_uncorrectable",
"Value (last)": "health",
"job": ""
}
}
}
],
"type": "table"
},
{
"datasource": {
"type": "prometheus",
Expand Down Expand Up @@ -94,7 +320,7 @@
"h": 7,
"w": 24,
"x": 0,
"y": 0
"y": 7
},
"id": 27,
"links": [],
Expand Down Expand Up @@ -335,7 +561,7 @@
"h": 7,
"w": 24,
"x": 0,
"y": 7
"y": 14
},
"id": 37,
"links": [],
Expand Down Expand Up @@ -547,7 +773,7 @@
"h": 11,
"w": 24,
"x": 0,
"y": 14
"y": 21
},
"id": 36,
"links": [],
Expand All @@ -570,12 +796,18 @@
"pluginVersion": "8.5.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "fmMKqssGk"
},
"editorMode": "code",
"exemplar": true,
"expr": "smartprom_temperature_celsius_raw",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
"legendFormat": "{{instance}} // {{drive}}",
"legendFormat": "{{instance}} {{drive}}",
"range": true,
"refId": "A"
}
],
Expand Down Expand Up @@ -624,6 +856,6 @@
"timezone": "",
"title": "SMART Exporter",
"uid": "hmXXiWPnk",
"version": 9,
"version": 10,
"weekStart": ""
}
Binary file removed grafana/grafana_dashboard.png
Binary file not shown.
Binary file added grafana/grafana_dashboard_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added grafana/grafana_dashboard_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e1f9b34

Please sign in to comment.