smart-energy-monitor/software/dashboard/README.md

31 lines
1.1 KiB
Markdown
Raw Normal View History

2023-02-23 17:13:02 +01:00
# Grafana
2023-02-23 17:17:18 +01:00
Grafana is amn open source analytics and interactive visualization toll. It provides charts, graphs, and alerts for the web when connected to supported data sources.
As a visualization tool, Grafana is a popular component in monitoring stacks, often used in combination with time series databases such as InfluxDB.
## Connection
To connect Grafana to our Influx-DB, you have to create a `token`in Influx-DB.
![Token](../flow/docs/images/influx-create-token.png)
You can use this token to create a connection from Grafana to Influx-DB.
![Connection](./docs/images/database-connection.png)
2023-02-23 17:28:54 +01:00
After having a connection to a database you can easily create an own dashboard in Grafana.
2023-02-23 17:27:22 +01:00
Here's the demo snippet (directly copyied from Influx Data Explorer) and the screen shot
```
from(bucket: "test")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "msg")
|> filter(fn: (r) => r["_field"] == "value")
|> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
|> yield(name: "mean")
```
![Example Dashboard](./docs/images/grafana-example-dashboard.png)