vault backup: 2024-02-17 21:37:47

This commit is contained in:
2024-02-17 21:37:47 +08:00
parent f84b62fc8a
commit cd377937a8
8 changed files with 71 additions and 0 deletions

View File

@@ -0,0 +1,71 @@
# 設定
```yaml
version: "3"
services:
grafana:
image: grafana/grafana:latest
container_name: grafana
restart: always
user: "1000" # needs to be `id -u` // alternatively chown the grafana/data dir to 472:472
ports:
- "8081:3000" # expose for localhost
links:
- influxdb
volumes:
- ./data/grafana/data:/var/lib/grafana # data path
- ./data/grafana/provisioning:/etc/grafana/provisioning
- ./data/grafana/grafana.ini:/etc/grafana/grafana.ini
environment:
- GF_INSTALL_PLUGINS=grafana-clock-panel,grafana-simple-json-datasource
influxdb:
image: influxdb
ports:
- "8082:8086"
volumes:
- ./data/influxdb/data:/var/lib/influxdb2
telegraf:
image: telegraf
user: telegraf:992 # Get 992 by `stat -c '%g' /var/run/docker.sock`, depend on system
depends_on:
- influxdb
links:
- influxdb
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./data/telegraf/telegraf.conf:/etc/telegraf/telegraf.conf:ro
environment:
- HOST_PROC=/proc
- HOST_SYS=/sys
- HOST_ETC=/etc
```
## 設定 InfluxDB
先把 docker 建立起來,然後打開 influxdb[http://awinpi4:8082](http://awinpi4:8082/)),建立帳號、密碼、資料庫名稱。如下:
![[20240217_212138_chrome_1894x1254.png]]
之後會出現一串Token如下這個要記起來。
![[20240217_212319_chrome_1894x1254.png]]
## 設定 telegraf
然後打開 `./data/telegraf/telegraf.conf` ,找到 `[[outputs.influxdb_v2]]` 這個區塊,把 `token` 的值改為剛剛那一串。
然後重啟 docker compose。
# 設定 InfluxDB 的 dashboard
到 [https://github.com/influxdata/community-templates#templates](https://github.com/influxdata/community-templates#templates) 挑一個 template例如 [# Raspberry Pi System Template](https://github.com/influxdata/community-templates/tree/master/raspberry-pi),找到他的網址,如下:
![[20240217_213108_chrome_1864x1044.png]]
複製這一行,然後到 InfluxDB 的 template 去把它 import 進來。如下:
![[20240217_213237_chrome_2753x1254.png]]
![[20240217_213311_chrome_2753x1254.png]]
接著 Dashboards 就會出現一個 Raspberry Pi System 的 dashboard 了。
![[20240217_213343_chrome_1624x1120.png]]

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 199 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 946 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB