diff --git a/deploys/ops-manual/07-monitoring.md b/deploys/ops-manual/07-monitoring.md index 8a01bea..d68182c 100644 --- a/deploys/ops-manual/07-monitoring.md +++ b/deploys/ops-manual/07-monitoring.md @@ -8,12 +8,14 @@ ``` 운영서버 (node_exporter:9100) --스크래핑--> CI/CD (Prometheus:9090) --> Grafana:3100 +개발서버 (node_exporter:9100) --스크래핑--> CI/CD (Prometheus:9090) --> Grafana:3100 CI/CD (node_exporter:9100) --스크래핑--> CI/CD (Prometheus:9090) --> Grafana:3100 ``` - **Grafana 대시보드:** https://monitor.sam.it.kr - **Prometheus 쿼리:** CI/CD 서버에서 http://localhost:9090 - **운영서버 메트릭:** 운영서버에서 http://localhost:9100/metrics +- **개발서버 메트릭:** 개발서버에서 http://localhost:9100/metrics --- @@ -38,25 +40,39 @@ scrape_configs: - targets: ['localhost:9100'] labels: server: 'cicd' + + - job_name: 'sam-dev' + static_configs: + - targets: ['114.203.209.83:9100'] + labels: + server: 'development' ``` ### 스크래핑 대상 추가 ```bash -# 1. 설정 파일 편집 +# 1. 대상 서버에 node_exporter 설치 (미설치 시) +# 바이너리: https://github.com/prometheus/node_exporter/releases +# 서비스: /etc/systemd/system/node_exporter.service +# 포트: 9100 (기본) + +# 2. 대상 서버 방화벽에서 CI/CD IP 허용 +sudo ufw allow from 110.10.147.46 to any port 9100 comment 'Prometheus scraping from CI/CD' + +# 3. CI/CD 서버에서 설정 파일 편집 sudo vim /etc/prometheus/prometheus.yml -# 2. 새 대상 추가 예시 -# - job_name: 'sam-dev' +# 4. 새 대상 추가 예시 +# - job_name: 'sam-new' # static_configs: -# - targets: ['114.203.209.83:9100'] +# - targets: ['<서버IP>:9100'] # labels: -# server: 'development' +# server: '<환경명>' -# 3. 문법 검사 +# 5. 문법 검사 promtool check config /etc/prometheus/prometheus.yml -# 4. 서비스 리로드 +# 6. 서비스 리로드 sudo systemctl restart prometheus ```