Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Docker Monitoring
  • Loading branch information
aa9863 committed Jul 15, 2024
0 parents commit cb2a79d
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 0 deletions.
61 changes: 61 additions & 0 deletions docker-compose.yaml
@@ -0,0 +1,61 @@
services:
cadvisor:
image: gcr.io/cadvisor/cadvisor:latest
container_name: cadvisor
#network_mode: "host"
ports:
- "8080:8080"
restart: unless-stopped
command:
- '-housekeeping_interval=10s'
- '-docker_only=true'
volumes:
- "/:/rootfs:ro"
- "/var/run:/var/run:rw"
- "/sys:/sys:ro"
- "/var/lib/docker/:/var/lib/docker:ro"
- "/dev/disk/:/dev/disk"
# privileged: true
devices:
- "/dev/kmsg:/dev/kmsg"
prometheus:
image: prom/prometheus
container_name: prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
ports:
- 9090:9090
restart: unless-stopped
volumes:
- ./prometheus:/etc/prometheus
- prom_data:/prometheus
extra_hosts:
- "host.docker.internal:host-gateway" #Magic to allow node exporter to see the real network

grafana:
image: grafana/grafana
container_name: grafana
ports:
- 3000:3000
restart: unless-stopped
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=grafana
volumes:
- ./grafana:/etc/grafana/provisioning/datasources
- grafana_data:/var/lib/grafana

node_exporter:
image: quay.io/prometheus/node-exporter:latest
container_name: node_exporter
command:
- '--path.rootfs=/host'
network_mode: host
pid: host
restart: unless-stopped
volumes:
- '/:/host:ro,rslave'

volumes:
prom_data:
grafana_data:
9 changes: 9 additions & 0 deletions grafana/datasource.yml
@@ -0,0 +1,9 @@
apiVersion: 1

datasources:
- name: Prometheus
type: prometheus
url: http://prometheus:9090
isDefault: true
access: proxy
editable: true
30 changes: 30 additions & 0 deletions prometheus/prometheus.yml
@@ -0,0 +1,30 @@
global:
scrape_interval: 15s
scrape_timeout: 10s
evaluation_interval: 15s
alerting:
alertmanagers:
- static_configs:
- targets: []
scheme: http
timeout: 10s
api_version: v1
scrape_configs:
- job_name: prometheus
honor_timestamps: true
scrape_interval: 15s
scrape_timeout: 10s
metrics_path: /metrics
scheme: http
static_configs:
- targets:
- localhost:9090

- job_name: cadvisor
static_configs:
- targets: ["cadvisor:8080"]

- job_name: node
static_configs:
- targets: ['host.docker.internal:9100']

0 comments on commit cb2a79d

Please sign in to comment.