프로메테우스는 현재 돌아가는 서버 cpu 사용량, ram 사용량, 프로세스 사용량 등의 여러가지 메트릭스들을 수집하는 것을 도와주는 오픈소스 툴입니다.
receivers:
- name: 'slack_notifications'
slack_configs:
- api_url: 'https://hooks.slack.com/services/your/slack/webhook'
channel: '#alerts'
send_resolved: true
Grafana는 위에서 prometheus로 부터 받은 메트릭스정보를 보기 쉽게 정리해줍니다
Grafana에서는 위처럼 보기 편한 대시보드를 제공하기 때문에, 시각적으로 훨씬 눈에 잘 보입니다
쿼리문을 통해서 정보를 가져올 수도 있는데, 쿼리문이 엄청 직관적이라 쓰기가 편한듯?
참고로 위의 그라파나 대시보드는 그라파나 랩이라는 대시보드를 모아둔 저장소에 있습니다
PromQL을 통해서 정보를 Grafana는 받습니다.→일종의 Get방식
https://grafana.com/grafana/dashboards/1860-node-exporter-full/
wget https://github.com/prometheus/prometheus/releases/download/v2.54.1/prometheus-2.54.1.linux-amd64.tar.gz
tar -xvf prometheus-2.54.1.linux-amd64.tar.gz
sudo apt-get update
sudo apt-get install grafana
wget https://github.com/prometheus/node_exporter/releases/download/v1.8.2/node_exporter-1.8.2.linux-amd64.tar.gz
tar -xvf node_exporter-1.8.2.linux-amd64.tar.gz
cd node_exporter-1.8.2.linux-amd64
devroute-job
(http://ip주소:9090/metrics**)**: Prometheus 서버 자체의 성능 및 상태를 모니터링하는 메트릭을 수집.
devroute-server
(http://ip주소:8080/actuator/prometheus): Spring Boot 애플리케이션의 상태와 성능을 모니터링하는 Actuator 메트릭을 수집.
node
(http://ip주소:9100/actuator/prometheus**)**: 서버의 하드웨어 및 운영 체제 상태(CPU, 메모리, 디스크, 네트워크 등)를 모니터링하는 메트릭을 수집.→ nodeexporter를 통해서 수집.
scrape_configs:
# Prometheus 자체 모니터링 (자체 메트릭 수집)
- job_name: 'prometheus'
static_configs:
- targets: ['ip주소:9090']
# Node Exporter 모니터링
- job_name: 'node_exporter'
static_configs:
- targets: ['ip주소:9100'] # Node Exporter의 엔드포인트
# Spring Boot 애플리케이션 모니터링
- job_name: 'spring_boot'
static_configs:
- targets: ['ip주소:8080'] # Spring Boot Actuator Prometheus 엔드포인트
이 단계가 바로 service discovey 로 대체가 가능한 부분
Prometheus와 Grafana는 서버 모니터링을 위한 강력한 도구 조합인듯합니다. Prometheus는 서버의 성능 메트릭을 수집하고 경고를 관리하며, Grafana는 수집된 데이터를 시각적으로 보여줌으로써 서버 모니터팅을 제공합니다. 이 두 도구를 사용하면 서버의 CPU, 메모리, 디스크 사용량, 네트워크 트래픽 등을 실시간으로 모니터링할 수 있으며, 경고 알림을 통해 시스템 장애를 사전에 감지하고 대응할 수 있습니다. 이러한 시스템은 IT 인프라의 효율적 관리와 문제 해결에 매우 유용하며, 자동화된 서비스 디스커버리 및 시각화를 통해 관리의 편의성을 극대화할 수 있습니다.