Grafana and Prometheus
v1.0.0Monitoring stack with Prometheus metrics collection, Node Exporter, and Grafana dashboards.
x-arcane:
icon: https://cdn.jsdelivr.net/gh/selfhst/icons@main/svg/grafana.svg
urls:
- https://grafana.com/
- https://prometheus.io/
services:
prometheus:
image: prom/prometheus:latest
container_name: prometheus
restart: unless-stopped
command:
- --config.file=/etc/prometheus/prometheus.yml
- --storage.tsdb.path=/prometheus
- --web.console.libraries=/etc/prometheus/console_libraries
- --web.console.templates=/etc/prometheus/consoles
- --web.enable-lifecycle
ports:
- "${PROMETHEUS_PORT:-9090}:9090"
volumes:
- prometheus-data:/prometheus
configs:
- source: prometheus_config
target: /etc/prometheus/prometheus.yml
labels:
com.getarcaneapp.arcane.icon: https://cdn.jsdelivr.net/gh/selfhst/icons@main/svg/prometheus.svg
node-exporter:
image: quay.io/prometheus/node-exporter:latest
container_name: node-exporter
restart: unless-stopped
command:
- --path.rootfs=/host
pid: host
volumes:
- /:/host:ro,rslave
labels:
com.getarcaneapp.arcane.icon: https://cdn.jsdelivr.net/gh/selfhst/icons@main/svg/prometheus.svg
grafana:
image: grafana/grafana-oss:latest
container_name: grafana
restart: unless-stopped
depends_on:
- prometheus
ports:
- "${GRAFANA_PORT:-3000}:3000"
environment:
GF_SECURITY_ADMIN_USER: ${GRAFANA_ADMIN_USER}
GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_ADMIN_PASSWORD}
GF_USERS_ALLOW_SIGN_UP: ${GRAFANA_ALLOW_SIGN_UP:-false}
volumes:
- grafana-data:/var/lib/grafana
configs:
- source: grafana_datasource
target: /etc/grafana/provisioning/datasources/prometheus.yml
labels:
com.getarcaneapp.arcane.icon: https://cdn.jsdelivr.net/gh/selfhst/icons@main/svg/grafana.svg
volumes:
prometheus-data:
grafana-data:
configs:
prometheus_config:
content: |
global:
scrape_interval: 15s
scrape_configs:
- job_name: prometheus
static_configs:
- targets:
- localhost:9090
- job_name: node-exporter
static_configs:
- targets:
- node-exporter:9100
grafana_datasource:
content: |
apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
access: proxy
url: http://prometheus:9090
isDefault: true
PROMETHEUS_PORT=9090
GRAFANA_PORT=3000
GRAFANA_ADMIN_USER=admin
GRAFANA_ADMIN_PASSWORD=change-this-grafana-password
GRAFANA_ALLOW_SIGN_UP=false
README
Grafana is pre-provisioned with Prometheus as a datasource. Sign in with GRAFANA_ADMIN_USER and GRAFANA_ADMIN_PASSWORD, then add dashboards for Prometheus and Node Exporter.
This stack includes Node Exporter for host metrics and mounts host paths read-only.