diff --git a/grafana/provisioning/dashboards/ping-speed-stats.json b/grafana/provisioning/dashboards/internet-connection.json similarity index 100% rename from grafana/provisioning/dashboards/ping-speed-stats.json rename to grafana/provisioning/dashboards/internet-connection.json diff --git a/grafana/provisioning/dashboards/power-consumption.json b/grafana/provisioning/dashboards/power-consumption.json new file mode 100644 index 0000000..c5afe52 --- /dev/null +++ b/grafana/provisioning/dashboards/power-consumption.json @@ -0,0 +1,271 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": "-- Grafana --", + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "gnetId": null, + "graphTooltip": 0, + "id": 2, + "links": [], + "panels": [ + { + "datasource": "prometheus", + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": {}, + "mappings": [], + "max": 500, + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "#EAB839", + "value": 150 + }, + { + "color": "red", + "value": 300 + } + ] + }, + "unit": "watt" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 0 + }, + "id": 6, + "options": { + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showThresholdLabels": false, + "showThresholdMarkers": true, + "text": {} + }, + "pluginVersion": "7.4.5", + "targets": [ + { + "expr": "power", + "interval": "", + "legendFormat": "Watts", + "queryType": "randomWalk", + "refId": "A" + } + ], + "title": "Power Consumption (Latest)", + "type": "gauge" + }, + { + "datasource": "prometheus", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": {}, + "mappings": [], + "max": 500, + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "#EAB839", + "value": 150 + }, + { + "color": "red", + "value": 300 + } + ] + }, + "unit": "watt" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 0 + }, + "id": 4, + "options": { + "reduceOptions": { + "calcs": [ + "mean" + ], + "fields": "", + "values": false + }, + "showThresholdLabels": false, + "showThresholdMarkers": true, + "text": {} + }, + "pluginVersion": "7.4.5", + "targets": [ + { + "expr": "power", + "interval": "", + "legendFormat": "Watts", + "queryType": "randomWalk", + "refId": "A" + } + ], + "title": "Power Consumption (Average)", + "type": "gauge" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "prometheus", + "description": "", + "fieldConfig": { + "defaults": { + "custom": {}, + "unit": "watt" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 24, + "x": 0, + "y": 8 + }, + "hiddenSeries": false, + "id": 2, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.4.5", + "pointradius": 1, + "points": true, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "power", + "interval": "", + "legendFormat": "Watts", + "queryType": "randomWalk", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Power Consumption", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:169", + "decimals": null, + "format": "watt", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "$$hashKey": "object:170", + "decimals": null, + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + } + ], + "refresh": "5m", + "schemaVersion": 27, + "style": "dark", + "tags": [ + "power" + ], + "templating": { + "list": [] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "Power consumption", + "uid": "i_aeo-uMz", + "version": 3 +} \ No newline at end of file diff --git a/prometheus/prometheus.yml b/prometheus/prometheus.yml index 1e7ce65..37a581d 100644 --- a/prometheus/prometheus.yml +++ b/prometheus/prometheus.yml @@ -1,33 +1,20 @@ -# my global config global: scrape_interval: 15s # By default, scrape targets every 15 seconds. evaluation_interval: 15s # By default, scrape targets every 15 seconds. # scrape_timeout is set to the global default (10s). - - # Attach these labels to any time series or alerts when communicating with - # external systems (federation, remote storage, Alertmanager). external_labels: monitor: 'Alertmanager' # Load and evaluate rules in this file every 'evaluation_interval' seconds. rule_files: - 'alert.rules' - # - "first.rules" - # - "second.rules" -# A scrape configuration containing exactly one endpoint to scrape: -# Here it's Prometheus itself. scrape_configs: - - job_name: 'prometheus' - - # Override the global default and scrape targets from this job every 5 seconds. scrape_interval: 5s - static_configs: - targets: ['localhost:9090'] - - job_name: 'speedtest' metrics_path: /metrics scrape_interval: 30m @@ -35,6 +22,16 @@ scrape_configs: static_configs: - targets: ['speedtest:9798'] + # This job config only works with my internet-pi configuration currently, + # if you also have the shelly plug enabled there. It will just error out + # by default if you don't have a Shelly Plug on your network. Someday I'll + # work on making this more configurable... + - job_name: 'shelly-plug' + metrics_path: /metrics + scrape_interval: 1m + static_configs: + - targets: ['172.17.0.1:9924'] + - job_name: 'ping' metrics_path: /probe scrape_interval: 5s