FrameWork/Spring Cloud
Prometheus + Grafana
태윤2
2021. 9. 18. 22:59
Prometheus
- Metrics를 수집하고 모니터링 및 알람에 사용되는 오픈소스 애플리케이션
- 2016년부터 CNCF에서 관리되는 2번째 공식 프로젝트
- Level DB -> Time Series Database(TSDB)
- Pull 방식의 구조와 다양한 Metric Exporter 제공
- 시계열 DB에 Metrics 저장 -> 조회 가능(Query)
Grafana
- 데이터 시각화, 모니터링 및 분석을 위한 오픈소스 애플리케이션
- 시계열 데이터를 시각화하기 위한 대시보드 제공
Prometheus 설치, 설정
- 설치
https://prometheus.io/download/
- prometheus.yml 파일 수정
- targer 지정
- metircs_path를 통해 metrics를 가져옴
- targets은 gateway를 통해 가져오기 때문에 ip주소와 포트를 입력
- localhost:9090으로 접속
Prometheus Dashboard
- http://127.0.0.1:9000
Grafana 설치, 설정
- 설치
https://grafana.com/grafana/download
- 실행
- http://127.0.0.1:3000 접속
- admin/admin 로그인
Promtheus - Grafana 연동
- conifg 에서 data source 추가
- Grafana Dashboard
- JVM(Micrometer)
- Prometheus
- Spring Cloud Gateway
- Add data source
- Prometheus가 기동 되고 있는 IP와 포트 번호 입력 (127.0.0.1:9090)
- dashboard 설정 (https://grafana.com/grafana/dashboards에서 대쉬보드 설치 후 추가)
- JVM 대시보드 선택후 ID값 입력
- Prometheus 2.0 Overview 추가
- Spring Cloud Gateway Dashboard 추가
- 설정 변경(Gateway)
prometheus에서 가져오는 정보를 설정에 입력 후 job name을 설정한 값에 입력해서 커스텀해서 필요한정보를 시각화해서 사용가능