[update] 🔴 Quick Wins 시스템 메트릭 컬럼 불일치 수정 다른 방법을 제시

This commit is contained in:
hwansae91 2025-09-20 11:11:38 +09:00
parent 9b9a7c14db
commit f0ea61c8f3

View File

@ -125,3 +125,63 @@ backend/
2. 메트릭 데이터 수집 정상 동작 확인 2. 메트릭 데이터 수집 정상 동작 확인
3. 그래프에 실제 데이터 표시 검증 3. 그래프에 실제 데이터 표시 검증
4. 성능 최적화 및 에러 핸들링 개선 4. 성능 최적화 및 에러 핸들링 개선
## (*update*) `node-exporter` + `Prometheus` + `Grafana` 를 이용한 compute 자원 모니터링
해당 문서는 직접 개발하는 방식이 아닌 기존에 널리 쓰이는</br>
`node-exporter` + `Prometheus` + `Grafana`를 이용하여</br>
cpu, memory disk 등을 수집하는 방식이다.</br>
</br>
먼저 docker 및 물리적 서버로 동작시에는 아래와 같은 구조로 이용된다.
```text
┌───────────────────────────────┐
│ PC #1
│ ┌────────────────────────┐ │
│ │ Container: node-exporter│ │
│ │ - CPU, MEM, Disk, Net │ │
│ │ - Prometheus metrics │ │
│ └───────────┬────────────┘ │
└──────────────┼───────────────┘
│ (HTTP /metrics)
┌───────────────────────────────┐
│ PC #2
│ ┌────────────────────────┐ │
│ │ Container: node-exporter│ │
│ │ - CPU, MEM, Disk, Net │ │
│ │ - Prometheus metrics │ │
│ └───────────┬────────────┘ │
└──────────────┼───────────────┘
┌─────────────────────────────────────────┐
│ 중앙 서버 (또는 PC #1) │
│ ┌─────────────┐ │
│ │ Prometheus │<── scrape ──────────────┘
│ │ (metrics DB)│ /metrics from each node
│ └───────┬─────┘
│ │
│ ┌─────▼─────┐
│ │ Grafana │ (Dashboards)
│ │ - Prometheus 연결
│ │ - CPU/MEM/DISK/NET 시각화
│ └───────────┘
└─────────────────────────────────────────┘
```
해당 구조는 PC가 2대일 때를 가정했으며 중앙서버를 별도의 PC로 정의할 경우에는 PC가 3대인 모습이다.</br>
해당 PC 는 K8s의 구조로 변경될 시에는 별도의 worker node로 대체해서 생각하면 된다.
여기에서 각각의 역할은 아래와 같다.
- node-exporter : 각 PC의 cpu, memory 등을 수집한다. docker인 경우 각각의 컨테이너의 로그도 수집한다.
- Prometheus: 각 node-exporter 에서 수집된 로그를 저장하며 PQL이라는 쿼리를 통해 로그를 조건에 맞게 추출할 수 있다.
- Grafana: Prometheus에서 저장된 로그를 단지 시각화 하는 방식이다.
설치방법은 아래의 `ref`에 남겨놓았다.
ref
- https://grafana.com/docs/grafana/latest/getting-started/get-started-grafana-prometheus: 기본적인 문서
- https://medium.com/%40shyamsandeep28/installation-of-prometheus-grafana-with-node-exporter-8ce3c97d968c: 좀더 세부적인 설정이 가미된 문서
- 그 이외에는 편의에 맞게 블로그에서 참고하여 형식에 맞게 수정하면 된다.