Metrics
Prometheus & Grafana
docker-compose file:
services:
prometheus:
image: prom/prometheus
container_name: prometheus
ports:
- "9090:9090"
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
restart: unless-stopped
node-exporter:
image: prom/node-exporter
container_name: node-exporter
ports:
- "9100:9100"
restart: unless-stopped
grafana:
image: grafana/grafana
container_name: grafana
ports:
- "3000:3000"
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=admin
restart: unless-stopped
Prometheus configuration file:
global:
scrape_interval: 15s
scrape_configs:
- job_name: 'node-exporter'
static_configs:
- targets: ['node-exporter:9100']
Access server:
Prometheus will be available at http://
Configure Grafana
Log into Grafana and add Prometheus as a data source (http://prometheus:9090). Import or create dashboards to visualize CPU, memory, disk, and network usage.
Embed Grafana panels in Mkdocs
Use Grafana's "Share Panel" feature to get the embed link for a specific panel. Add the panel to your MkDocs pages using Markdown with HTML.
Example:
# Server Monitoring Dashboard
<iframe src="http://<your-server-ip>:3000/d-solo/<dashboard-id>/<panel-id>?orgId=1&refresh=5s" width="100%" height="400"></iframe>
Optional. Secure Grafana
Set up a reverse proxy (e.g., using Nginx) and enable HTTPS for secure access. Configure authentication in Grafana if needed.