Infrastructure/Docker

Docker-compose Container Monitoring (cAdvisor, node-exporter, prometheus-cadvisor)

rajent 2020. 11. 18. 19:57
728x90

Container monitoring을 Kubernetes가 아닌 docer-compose 환경에서 돌리도록 yml작성했습니다.

Kubernetes환경에서 설정하는 방법은 이전글 참고하세요.
2020/11/18 - K8S 환경에서 Container monitoring하기 ( cAdvisor + Prometheus + Grafana )

 

K8S 환경에서 Container monitoring하기 ( cAdvisor + Prometheus + Grafana )

개념에 대해서는 알만한 사람은 다아시는 조대협님 블로그를 참고했고요. 그외 참고한 블로그 링크를 남깁니다. https://bcho.tistory.com/1270 쿠버네티스 #14 - 모니터링 (2/3) Prometheus 쿠버네티스 #14 모

rajent.tistory.com

같이 올리는 service를 추가해서 올리시면 되니 참고하세요.

version:'3'

services:
    cadvisor:
      image: google/cadvisor
      container\_name: cadvisor
      ports:
        -"8080:8080"
      volumes:
        - /:/rootfs:ro
        - /var/run:/var/run:rw
        - /sys:/sys:ro
        - /var/lib/docker/:/var/lib/docker:ro
      restart: always

    node-exporter:
      image: prom/node-exporter:v0.14.0
      container\_name: node-exporter
      ports:
        -"9000:9100"
      restart: always
      volumes:
        - /proc:/host/proc:ro
        - /sys:/host/sys:ro
        - /:/rootfs:ro

    prometheus-cadvisor:
      image: prom/prometheus:v1.7.0
      container\_name: prometheus-cadvisor
      ports:
        -"9100:9090"
      volumes:
        - $GIT\_ROOT/prometheus/:/etc/prometheus/
        - $GIT\_ROOT/prometheus\_data:/prometheus
      command:
        - --config.file=/etc/prometheus/prometheus.yml

      links:
        - cadvisor:cadvisor
        - node-exporter:node-exporter

      restart: always

      depends\_on:  
        - cadvisor