Grafana: Difference between revisions
Appearance
mNo edit summary |
(No difference)
|
Latest revision as of 13:34, 17 October 2025
Install Grafana on Raspberry Pi in Raspbian
Connect to InfluxDB
Howto combine Influx and Grafana (old)
Setup
grafana.ini
in /etc/grafana/grafana.ini set the admin user and password
[dashboards] # Number dashboard versions to keep (per dashboard). Default: 20, Minimum: 1 versions_to_keep = 5
service
# Start Grafana by running: sudo service grafana-server start
Autostart at boot time
sudo systemctl enable grafana-server.service sudo update-rc.d grafana-server defaults
default port: http://raspi:3000
Migration from host to host
# 1. adjust grafana.ini on target to match the one from source sudo vim /etc/grafana/grafana.ini # source DIR=/var/lib/grafana sudo scp -r $DIR user@target:incoming/ # target DIR=/var/lib/grafana sudo service grafana-server stop sudo chown -R grafana:grafana incoming/grafana sudo rm -rf $DIR sudo mv incoming/grafana $DIR sudo service grafana-server start
Queries
Display Table of Influx DB data field "active" contains 1 if a given "hostname" is online Query
WHERE time > now()-5m and field(active) != null SELECT field(active) distinct() alias(online) GROUP BY time($__interval), tag(hostname) FORMAT AS Table Min time interval = 5m
Visualization
Column Style -> Type Hidden for columns named online
Convert cummulated kWh data to hourly or daily differences
SELECT spread("kWh_total") FROM "Shelly3" WHERE ("room"::tag =~ /^$room$/) AND $timeFilter GROUP BY time($__interval) fill(null)
With "Query Options" -> "Min interval"=1h or 1d and maybe "Relative time" = now-7d
Color of fill area based on threshold (e.g. red for negative values)
Gradient mode -> Schema Color scheme -> From threshold Fill opacity -> 25