使用Grafana來視覺化Prometheus蒐集到的metrics
Setup
Grafana Container (use docker-compose)
如果不想手動設定帳密可以把環境變數移除,那就會使用預設帳密admin
grafana:
image: grafana/grafana:8.1.5
restart: unless-stopped
volumes:
- ./grafana/data:/var/lib/grafana
- ./grafana/provisioning:/etc/grafana/provisioning
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD__FILE=/run/secrets/admin_password
- GF_USERS_ALLOW_SIGN_UP=false
ports:
- 3000:3000
secrets:
- source: gf_admin_password
target: admin_password
secrets:
gf_admin_password:
file: ./grafana/secrets/admin_password
用檔案來存密碼會比直接將密碼寫在yaml檔內更安全一點,如果喜歡直接把密碼用環境變數儲存或是直接寫到yaml檔內的話,可以把yaml檔改寫成