Add Shelly Plug power-consumption dashboard and prometheus scraper.

This commit is contained in:
Jeff Geerling 2021-04-17 15:23:30 -05:00
parent 33dfa4f8a8
commit 9d2efe0277
3 changed files with 281 additions and 13 deletions

View File

@ -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
}

View File

@ -1,33 +1,20 @@
# my global config
global: global:
scrape_interval: 15s # By default, scrape targets every 15 seconds. scrape_interval: 15s # By default, scrape targets every 15 seconds.
evaluation_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). # 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: external_labels:
monitor: 'Alertmanager' monitor: 'Alertmanager'
# Load and evaluate rules in this file every 'evaluation_interval' seconds. # Load and evaluate rules in this file every 'evaluation_interval' seconds.
rule_files: rule_files:
- 'alert.rules' - 'alert.rules'
# - "first.rules"
# - "second.rules"
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs: scrape_configs:
- job_name: 'prometheus' - job_name: 'prometheus'
# Override the global default and scrape targets from this job every 5 seconds.
scrape_interval: 5s scrape_interval: 5s
static_configs: static_configs:
- targets: ['localhost:9090'] - targets: ['localhost:9090']
- job_name: 'speedtest' - job_name: 'speedtest'
metrics_path: /metrics metrics_path: /metrics
scrape_interval: 30m scrape_interval: 30m
@ -35,6 +22,16 @@ scrape_configs:
static_configs: static_configs:
- targets: ['speedtest:9798'] - 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' - job_name: 'ping'
metrics_path: /probe metrics_path: /probe
scrape_interval: 5s scrape_interval: 5s