diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..dd73f46 --- /dev/null +++ b/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: diff --git a/grafana/datasource.yml b/grafana/datasource.yml new file mode 100644 index 0000000..d7b8286 --- /dev/null +++ b/grafana/datasource.yml @@ -0,0 +1,9 @@ +apiVersion: 1 + +datasources: +- name: Prometheus + type: prometheus + url: http://prometheus:9090 + isDefault: true + access: proxy + editable: true diff --git a/prometheus/prometheus.yml b/prometheus/prometheus.yml new file mode 100644 index 0000000..4252189 --- /dev/null +++ b/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'] +