1. install prometheus and grafana
simple version
source code : https://github.com/teamsmiley/devops-public/tree/main/monitoring/1.simple-version
docker-compose up -d
구조 설명
prometheus , grafana , node-exporter 가 실행된다.
prometheus
promethes/promehteus.yaml
파일에 설정을 해주고 docker에/etc/prometheus/prometheus.yaml
로 마운트 해준다.--config.file=
를 이용하여 설정파일을 지정해준다.
grafana
password를 설정해준다.
node exporter
cpu/memory/disk 등의 사용량을 수집하는 agent이다.
prometheus가 Node exporter를 수집하도록 설정을 해준다.
- job_name: 'node-exporter'
static_configs:
- targets: ['node-exporter:9100']
이렇게 하면 프로메테우스가 30초마다 node-exporter에 접속하여 메트릭을 가져온다.
이제 이걸 prometheus에 time series로 저장한다.
grafana에서 이걸 그래프로 그려준다.
url
prometheus : http://localhost:9090
grafana : http://localhost:3000
node-exporter : http://localhost:9100

데이터소스를 추가하자.
connection >> datasource >> add datasource
pick the prometheus

http://prometheus:9090
를 사용하자.

save and test
정상적으로 연결되면 아래와 같이 나온다.

dashboard를 추가
menu >> dashboard >> import
우리는 이것을 이용할것이다. https://grafana.com/grafana/dashboards/1860-node-exporter-full/
1860을 입력하고 load를 누른다.


datasource를 선택하고 import를 누른다.

data가 잘 보인다.
Last updated
Was this helpful?