실전프로젝트 6주차 ( 테스트 모니터링 구축)

전은규·2021년 11월 29일
0

3개의 node 에 설치 (node-exporter,cadvisor)

docker container exec -it manager sh
docker container exec -it worker01 sh
docker container exec -it worker02 sh

$ docker run -d -p 9100:9100 --name node-exporter prom/node-exporter:v0.14.0

$ docker run --volume=/:/rootfs:ro \
--volume=/var/run:/var/run:rw \
--volume=/sys:/sys:ro \
--volume=/var/lib/docker/:/var/lib/docker:ro \
--volume=/dev/disk/:/dev/disk:ro \
--publish=8080:8080 --detach=true \
--name=cadvisor \
google/cadvisor:v0.27.0

manager 노드에서 vi prometheus.yml 만들어서 작성

global:

    scrape_interval: 5s

    external_labels:

        monitor: 'my-monitor'

scrape_configs:

    - job_name: 'node-exporter'

      static_configs:

          - targets: ['172.18.0.3:9100', '172.18.0.5:9100', '172.18.0.4:9100']

manager 노드에서 vi prometheus.yml 만들어서 작성

global:

    scrape_interval: 5s

    external_labels:

        monitor: 'my-monitor'

scrape_configs:

    - job_name: 'node-exporter'

      static_configs:

          - targets: ['172.18.0.3:8080', '172.18.0.5:8080', '172.18.0.4:8080']

명령어 실행
$ docker run -d --name prometheus -h prometheus \
-v $(pwd)/prometheus.yml:/etc/prometheus/prometheus.yml \
prom/prometheus:v1.7.0 -config.file=/etc/prometheus/prometheus.yml

$ docker run -d --name prometheus-cadvisor \
-h prometheus-cadvisor \
-v $(pwd)/prometheus-cadvisor.yml:/etc/prometheus/prometheus.yml \
prom/prometheus:v1.7.0 -config.file=/etc/prometheus/prometheus.yml

$ docker run -d --name grafana -h grafana \
-e GF_SECURITY_ADMIN_PASSWORD=pass \
-p 8000:3000 --link prometheus:prometheus \
--link prometheus-cadvisor:prometheus-cadvisor \
grafana/grafana:4.4.3

profile
성장하는개발자

0개의 댓글