61 lines
1.5 KiB
Markdown

# Grafana
*These instructions are a work in progress, and some parts may be broken.*
You can do this on the same machine as Influx; just make sure you add another DNS `A` record if you are using a reverse proxy.
Create `grafana.ini`:
```ini
[server]
domain = grafana.example.com
root_url = https://grafana.example.com/
```
SSH in to `grafana.example.com`.
`mkdir grafana`
`chown -R ubuntu:root grafana`
```bash
docker run -d -p 3000:3000 --name=grafana \
--user "1000" \
--volume "$PWD/grafana:/var/lib/grafana" \
--volume "$PWD/grafana.ini:/etc/grafana/grafana.ini" \
--restart always \
grafana/grafana-oss
```
It is possible that the container would set its permission on its own (i.e. `chown` not required.)
Add a Caddy entry in `/etc/caddy/Caddyfile`:
```conf
grafana.example.com {
reverse_proxy :3000
}
```
Reload Caddy with `systemctl reload caddy`.
Go to <https://grafana.example.com> in a browser to confirm it works, and do initial setup.
## Connect to InfluxDB
Create a read/write token for the bucket in InfluxDB and keep it handy.
Menu -> Connections -> Data Sources -> type InfluxDB
Once on the InfluxDB data source screen, select "Flux" as the query language.
Enter the URL: <https://influx.example.com>
Uncheck "Basic auth".
Under "InfluxDB Details" enter the Influx organization the bucket is in, the token you created in InfluxDB earlier, and the bucket name.
Then "Save & test" to make sure it's working.
Finally, you can create a dashboard that uses the data source and format it however you like.