https://twofootdog.tistory.com/22
Actuator & Prometheus를 활용한 Spring Boot 애플리케이션 모니터링
이번 글에서는 Actuator와 Prometheus를 활용하여 쿠버네티스 클러스터 내에서 실행 중인 스프링부트 애플리케이션 모니터링을 하는 방법에 대해 알아볼 것이다. Prometheus Server도 쿠버네티스 클러스
twofootdog.tistory.com
https://jongmin92.github.io/2019/12/04/Spring/prometheus/
SpringBoot Application의 monitoring 시스템 구축하기
Spring Boot를 사용하고 있는 애플리케이션에서 이전에 살펴본 Micrometer를 이용해서 metric을 생성하고 Prometheus를 이용해 수집, 그리고 Grafana로 시각화하는 시스템을 만들어보자.
jongmin92.github.io
Spring boot에 prometheus dependency 추가
https://twofootdog.tistory.com/22
Actuator & Prometheus를 활용한 Spring Boot 애플리케이션 모니터링
이번 글에서는 Actuator와 Prometheus를 활용하여 쿠버네티스 클러스터 내에서 실행 중인 스프링부트 애플리케이션 모니터링을 하는 방법에 대해 알아볼 것이다. Prometheus Server도 쿠버네티스 클러스
twofootdog.tistory.com
https://jongmin92.github.io/2019/12/04/Spring/prometheus/
SpringBoot Application의 monitoring 시스템 구축하기
Spring Boot를 사용하고 있는 애플리케이션에서 이전에 살펴본 Micrometer를 이용해서 metric을 생성하고 Prometheus를 이용해 수집, 그리고 Grafana로 시각화하는 시스템을 만들어보자.
jongmin92.github.io
- prometheus dependency를 추가 안했어서 추가 후 다시 아래 내용 진행
https://pythaac.tistory.com/448
[EagleEye][서비스구현] Spring boot with K8s
https://pythaac.tistory.com/437 [EagleEye][서비스구현] Spring boot with Docker https://spring.io/guides/gs/spring-boot-docker/ Spring Boot with Docker this guide is designed to get you productive as..
pythaac.tistory.com
- 변경사항 다시 적용
- 삭제하고 다시 적용해야하는 듯
>> kubectl delete pod {fast-service | normal-service | slow-service}
>> kubectl apply -f deployment.yaml
- 삭제하고 다시 적용해야하는 듯
- 변경사항 확인
- http://{호스트:포트}/actuator 에서 prometheus가 나오는지 확인
ServiceMonitor 설정
GitHub - prometheus-operator/prometheus-operator: Prometheus Operator creates/configures/manages Prometheus clusters atop Kubern
Prometheus Operator creates/configures/manages Prometheus clusters atop Kubernetes - GitHub - prometheus-operator/prometheus-operator: Prometheus Operator creates/configures/manages Prometheus clus...
github.com
https://stackoverflow.com/questions/52991038/how-to-create-a-servicemonitor-for-prometheus-operator
How to create a ServiceMonitor for prometheus-operator?
Recently, prometheus-operator has been promoted to stable helm chart (https://github.com/helm/charts/tree/master/stable/prometheus-operator). I'd like to understand how to add a custom applicatio...
stackoverflow.com
https://iamonkar.dev/prometheus-k8s/
Monitoring applications in K8s with Prometheus
Versions used Docker for desktop: 2.3.0 Kubernetes: 1.16.5 Prometheus: helm-chart v9.0 (2.22) Spring boot: 2.3.4 Java : 11 Sample Application with metrics in Prometheus format We need a sample application in any language which emits metrics in Prometheus f
iamonkar.dev
https://github.com/prometheus-operator/prometheus-operator/issues/2799
"INVALID" is not a valid start token error springboot metrics · Issue #2799 · prometheus-operator/prometheus-operator
Hi , we are trying to scrape default springboot metrics to prometheus . We use prom operator and here is my service and servicemonitor and deployment file Servicemonitor.yaml apiVersion: monitoring...
github.com
- deployment.yaml에 ServiceMonitor를 추가할거임
- Deployment와 Service에 원하는 이름으로 namespace도 추가하기 (여기서는 test)
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: monitoring-fast-service
labels:
# app은 Service와 맞추기
app: fast-service
release: prometheus
# namespace는 prometheus가 실행중인 ns로 설정
namespace: prometheus
spec:
selector:
matchLabels:
# app은 Service와 맞추기
app: fast-service
endpoints:
- interval: 15s
# Spring boot에서 actuator / prometheus dependency를 추가했다면 아래 path로 요청해야함
path: '/actuator/prometheus'
# 위 Service의 port: name으로 설정 (숫자로 입력하면 안됨)
port: 8080-8080
scheme: http
namespaceSelector:
matchNames:
# Service가 실행중인 ns로 설정
- test
- 발생할 수 있는 에러
- [에러] Prometheus Targets에 생성되지 않음
- [해결] yaml 작성에 문제가 있을 때
- ex) namespace를 prometheus가 동작중인 곳으로 설정하지 않았을 때
- ex) metadata: labels: release: proemetheus를 삽입하지 않았을 때 - [에러] 처음에는 connection refused가 발생할 수 있음
- [해결] 아직 앱이 준비되지 않은 상태에서 scrape하여 발생하므로 기다리기 - [에러] "INVALID" in not a valid start token
- [해결] path가 '/actuator/prometheus'인지, 정상 동작하는지 확인
- 아래와 같이 metrics의 format이 존재하므로, /actuator 또는 /actuator/metrics 등으로 사용 불가
- [에러] Prometheus Targets에 생성되지 않음
https://prometheus.io/docs/instrumenting/exposition_formats/#text-format-example
Exposition formats | Prometheus
An open-source monitoring system with a dimensional data model, flexible query language, efficient time series database and modern alerting approach.
prometheus.io
- 동작 확인
- Prometheus 접속 > Targets
'만들기 > EagleEye' 카테고리의 다른 글
[EagleEye][환경세팅] K8s Promehteus metrics 연결 문제 해결 (connection refused, connection reset by peer) (0) | 2022.05.17 |
---|---|
[EagleEye][환경세팅] Grafana - Prometheus 연동 (0) | 2022.05.17 |
[EagleEye][환경세팅] Kubernetes Prometheus-stack 설치 (0) | 2022.05.17 |
[EagleEye][환경세팅] Helm 설치 (0) | 2022.05.16 |
[EagleEye][환경세팅] 쿠버네티스 설치 4 - 애드온 설치 (Dashboard, Metric Server, Prometheus and Grafana 설명) (0) | 2022.05.16 |