diff --git a/README.md b/README.md index 5895d6c..e1cbbd0 100644 --- a/README.md +++ b/README.md @@ -42,3 +42,9 @@ All configuration is done with environment variables. - `SMARTCTL_REFRESH_INTERVAL`: (Optional) The refresh interval of the metrics. A larger value reduces CPU usage. The default is `60` seconds. - `SMARTCTL_EXPORTER_PORT`: (Optional) The address the exporter should listen on. The default is `9902`. - `SMARTCTL_EXPORTER_ADDRESS`: (Optional) The address the exporter should listen on. The default is to listen on all addresses. + +## Grafana dashboard + +There is a reference Grafana dashboard in [grafana/grafana_dashboard.json](./grafana/grafana_dashboard.json). + +![](./grafana/grafana_dashboard.png) diff --git a/grafana/grafana_dashboard.json b/grafana/grafana_dashboard.json new file mode 100644 index 0000000..3c5a02c --- /dev/null +++ b/grafana/grafana_dashboard.json @@ -0,0 +1,629 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "target": { + "limit": 100, + "matchAny": false, + "tags": [], + "type": "dashboard" + }, + "type": "dashboard" + } + ] + }, + "description": "", + "editable": true, + "fiscalYearStartMonth": 0, + "gnetId": 9846, + "graphTooltip": 0, + "id": 42, + "links": [ + { + "icon": "external link", + "tags": [ + "system" + ], + "type": "dashboards" + } + ], + "liveNow": false, + "panels": [ + { + "datasource": { + "type": "prometheus", + "uid": "fmMKqssGk" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "auto", + "displayMode": "auto", + "filterable": false, + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "#EAB839", + "value": 1 + }, + { + "color": "red", + "value": 2 + } + ] + }, + "unit": "none" + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": ".*_.*" + }, + "properties": [ + { + "id": "custom.displayMode", + "value": "color-background" + } + ] + } + ] + }, + "gridPos": { + "h": 7, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 27, + "links": [], + "maxDataPoints": 100, + "options": { + "footer": { + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "frameIndex": 1, + "showHeader": true, + "sortBy": [ + { + "desc": false, + "displayName": "instance" + } + ] + }, + "pluginVersion": "9.0.0", + "targets": [ + { + "exemplar": true, + "expr": "smartprom_reallocated_sector_ct_raw", + "format": "table", + "hide": false, + "instant": true, + "interval": "", + "intervalFactor": 1, + "legendFormat": "", + "refId": "A" + }, + { + "exemplar": true, + "expr": "smartprom_reported_uncorrect_raw", + "format": "table", + "hide": false, + "instant": true, + "interval": "", + "intervalFactor": 1, + "legendFormat": "", + "refId": "B" + }, + { + "exemplar": true, + "expr": "smartprom_command_timeout_raw", + "format": "table", + "hide": false, + "instant": true, + "interval": "", + "intervalFactor": 1, + "legendFormat": "", + "refId": "C" + }, + { + "exemplar": true, + "expr": "smartprom_current_pending_sector_raw", + "format": "table", + "hide": false, + "instant": true, + "interval": "", + "intervalFactor": 1, + "legendFormat": "", + "refId": "D" + }, + { + "exemplar": true, + "expr": "smartprom_offline_uncorrectable_raw", + "format": "table", + "hide": false, + "instant": true, + "interval": "", + "intervalFactor": 1, + "legendFormat": "", + "refId": "E" + } + ], + "title": "Error Metrics", + "transformations": [ + { + "id": "merge", + "options": {} + }, + { + "id": "groupBy", + "options": { + "fields": { + "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" + } + } + } + }, + { + "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", + "job": "" + } + } + } + ], + "type": "table" + }, + { + "datasource": { + "type": "prometheus", + "uid": "fmMKqssGk" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "auto", + "displayMode": "auto", + "filterable": false, + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "#EAB839", + "value": 50 + }, + { + "color": "red", + "value": 60 + } + ] + }, + "unit": "none" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "temperature_celsius" + }, + "properties": [ + { + "id": "custom.displayMode", + "value": "color-background" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "power_on_hours" + }, + "properties": [ + { + "id": "unit", + "value": "h" + } + ] + } + ] + }, + "gridPos": { + "h": 7, + "w": 24, + "x": 0, + "y": 7 + }, + "id": 37, + "links": [], + "maxDataPoints": 100, + "options": { + "footer": { + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "frameIndex": 1, + "showHeader": true, + "sortBy": [ + { + "desc": false, + "displayName": "instance" + } + ] + }, + "pluginVersion": "9.0.0", + "targets": [ + { + "exemplar": true, + "expr": "smartprom_temperature_celsius_raw", + "format": "table", + "hide": false, + "instant": true, + "interval": "", + "intervalFactor": 1, + "legendFormat": "", + "refId": "A" + }, + { + "exemplar": true, + "expr": "smartprom_power_cycle_count_raw", + "format": "table", + "hide": false, + "instant": true, + "interval": "", + "intervalFactor": 1, + "legendFormat": "", + "refId": "B" + }, + { + "exemplar": true, + "expr": "smartprom_power_on_hours_raw", + "format": "table", + "hide": false, + "instant": true, + "interval": "", + "intervalFactor": 1, + "legendFormat": "", + "refId": "C" + } + ], + "title": "Info Metrics", + "transformations": [ + { + "id": "merge", + "options": {} + }, + { + "id": "groupBy", + "options": { + "fields": { + "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" + } + } + } + }, + { + "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)": "temperature_celsius", + "Value #B": "reported_uncorrect", + "Value #B (sum)": "power_cycle_count", + "Value #C (sum)": "power_on_hours", + "Value #D (sum)": "current_pending_sector", + "Value #E (sum)": "offline_uncorrectable", + "job": "" + } + } + } + ], + "type": "table" + }, + { + "datasource": { + "type": "prometheus", + "uid": "fmMKqssGk" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "links": [], + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "celsius" + }, + "overrides": [] + }, + "gridPos": { + "h": 11, + "w": 24, + "x": 0, + "y": 14 + }, + "id": 36, + "links": [], + "options": { + "legend": { + "calcs": [ + "mean", + "lastNotNull", + "max", + "min" + ], + "displayMode": "table", + "placement": "bottom" + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "8.5.0", + "targets": [ + { + "exemplar": true, + "expr": "smartprom_temperature_celsius_raw", + "format": "time_series", + "interval": "", + "intervalFactor": 2, + "legendFormat": "{{instance}} // {{drive}}", + "refId": "A" + } + ], + "title": "Temperature", + "type": "timeseries" + } + ], + "refresh": "", + "schemaVersion": 36, + "style": "dark", + "tags": [ + "system" + ], + "templating": { + "list": [] + }, + "time": { + "from": "now-24h", + "to": "now" + }, + "timepicker": { + "refresh_intervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ], + "time_options": [ + "5m", + "15m", + "1h", + "6h", + "12h", + "24h", + "2d", + "7d", + "30d" + ] + }, + "timezone": "", + "title": "SMART Exporter", + "uid": "hmXXiWPnk", + "version": 9, + "weekStart": "" +} \ No newline at end of file diff --git a/grafana/grafana_dashboard.png b/grafana/grafana_dashboard.png new file mode 100644 index 0000000..1693ab1 Binary files /dev/null and b/grafana/grafana_dashboard.png differ