diff --git a/docker-compose.yml b/docker-compose.yml index c345ca6..a9ae6ac 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -34,12 +34,37 @@ services: container_name: prometheus ports: - 9090:9090 - command: "--config.file=/prometheus/prometheus.yaml" + command: "--config.file=/etc/prometheus/prometheus.yaml" volumes: - - ./config/prometheus.yaml:/prometheus/prometheus.yaml:ro + - ./prometheus:/etc/prometheus - prometheus-data:/prometheus restart: unless-stopped + node_exporter: + image: quay.io/prometheus/node-exporter:v1.8.0 + container_name: node_exporter + command: "--path.rootfs=/host" + pid: host + restart: unless-stopped + volumes: + - /:/host:ro,rslave + + cadvisor: + image: gcr.io/cadvisor/cadvisor:v0.49.1 + container_name: cadvisor + ports: + - 8080:8080 + volumes: + - /:/rootfs:ro + - /var/run:/var/run:ro + - /sys:/sys:ro + - /var/lib/docker/:/var/lib/docker:ro + - /dev/disk/:/dev/disk:ro + devices: + - /dev/kmsg + privileged: true + restart: unless-stopped + volumes: caddy-data: grafana-data: diff --git a/prometheus/prometheus.yaml b/prometheus/prometheus.yaml index 8f41942..b63c030 100644 --- a/prometheus/prometheus.yaml +++ b/prometheus/prometheus.yaml @@ -1,27 +1,18 @@ global: - scrape_interval: 15s # By default, scrape targets every 15 seconds. + scrape_interval: 15s - # Attach these labels to any time series or alerts when communicating with - # external systems (federation, remote storage, Alertmanager). - # external_labels: - # monitor: 'codelab-monitor' - -# A scrape configuration containing exactly one endpoint to scrape: -# Here it's Prometheus itself. scrape_configs: - # The job name is added as a label `job=` to any timeseries scraped from this config. - job_name: 'prometheus' - # Override the global default and scrape targets from this job every 5 seconds. scrape_interval: 5s static_configs: - targets: ['localhost:9090'] - # Example job for node_exporter - # - job_name: 'node_exporter' - # static_configs: - # - targets: ['node_exporter:9100'] - # Example job for cadvisor - # - job_name: 'cadvisor' - # static_configs: - # - targets: ['cadvisor:8080'] + - job_name: 'node_exporter' + static_configs: + - targets: ['node_exporter:9100'] + + + - job_name: 'cadvisor' + static_configs: + - targets: ['cadvisor:8080']