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

Alt text

๋ฐ์ดํ„ฐ์†Œ์Šค๋ฅผ ์ถ”๊ฐ€ํ•˜์ž.

connection >> datasource >> add datasource

pick the prometheus

Alt text

http://prometheus:9090๋ฅผ ์‚ฌ์šฉํ•˜์ž.

Alt text

save and test

์ •์ƒ์ ์œผ๋กœ ์—ฐ๊ฒฐ๋˜๋ฉด ์•„๋ž˜์™€ ๊ฐ™์ด ๋‚˜์˜จ๋‹ค.

Alt text

dashboard๋ฅผ ์ถ”๊ฐ€

menu >> dashboard >> import

์šฐ๋ฆฌ๋Š” ์ด๊ฒƒ์„ ์ด์šฉํ• ๊ฒƒ์ด๋‹ค. https://grafana.com/grafana/dashboards/1860-node-exporter-full/

1860์„ ์ž…๋ ฅํ•˜๊ณ  load๋ฅผ ๋ˆ„๋ฅธ๋‹ค.

Alt text
Alt text

datasource๋ฅผ ์„ ํƒํ•˜๊ณ  import๋ฅผ ๋ˆ„๋ฅธ๋‹ค.

Alt text

data๊ฐ€ ์ž˜ ๋ณด์ธ๋‹ค.

Last updated

Was this helpful?