티스토리 뷰

기존에 Prometheus와 Grafana를 통한 모니터링을 구현했어야했는데, 당시 설치이슈가 있어서 잠깐 미뤄두고 있었습니다. 그래서 조금 두서 없긴 하지만 먼저 Container화를 진행한 후 추후에 관련된 내용을 업로드하겠습니다. 

먼저 작업하기에 앞서서 아무 위치에 prometheus.yml 파일을 생성합니다. 

아래와 같이 입력해주세요.

#prometheus.yml

- job_name: 'prometheus'
  static_config:
  - targets: ['prometheus:9090']

- job_name: 'user-service'
  scrape_interval: 15s
  metrics_path: '/user-service/actuator/prometheus'
  static_config:
  - targets: ['apigateway-service:8000']
- job_name: 'order-service'
  scrape_interval: 15s
  metrics_path: '/order-service/actuator/prometheus'
  static_config:
  - targets: ['apigateway-service:8000']
- job_name: 'apigateway-service'
  scrape_interval: 15s
  metrics_path: '/actuator/prometheus'
  static_config: 
  -targets: ['apigateway-servicet:8000']

총 4개의 job이 있고 해당 job들은 모두 모니터링을 할 주소값입니다. Docker에서 Container화 를 시킬 예정이기에 기존에는 localhost로 작성되어 있지만, 모두 docker에 알맞게 값을 수정했습니다.

 

그리고 밑에있는 커맨드로 실행시키면 됩니다.

#Prometheus 실행

docker run -d -p 9090:9090 --network ecommerce-network --name prometheus -v D:\git-local-repo\prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus

​#Grafana 실행

docker run -d -p 3000:3000 --network ecommerce-network --name grafana grafana/grafana

 

정상적으로 실행된 것을 확인 한 후 :3000 번 포트로 접속해줍니다.

위와 같이 Grafana 서버로 접속이 된다면 성공입니다.

감사합니다.

공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/09   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
글 보관함