Prometheus + Grafana - Redis ๊ตฌ์ถ•

2023. 7. 31. 10:31ใ†๊ฐœ๋ฐœ/Monitoring

728x90
๋ฐ˜์‘ํ˜•
๐Ÿ’ก ์ค€๋น„๋ฌผ : ubuntu, redis, Prometheus, Grafana

 

๋ชจ๋‹ˆํ„ฐ๋ง ๋Œ€์ƒ ์„ค์ •

Redis ์„ค์น˜

Redis ์„ค์น˜

Redis exporter ์„ค์น˜

wget <https://github.com/oliver006/redis_exporter/releases/download/v1.24.0/redis_exporter-v1.24.0.linux-amd64.tar.gz>
# ์••์ถ• ํ•ด์ œ ๋ฐ ํŒŒ์ผ ๋ณต์‚ฌ
tar -zxvf redis_exporter-v1.24.0.linux-amd64.tar.gz
cd redis_exporter-v1.24.0.linux-amd64
cp redis_exporter /usr/bin/ # root ๊ณ„์ •

Systemd ๋“ฑ๋ก ๋ฐ ์‹คํ–‰

vim /etc/systemd/system/redis_exporter.service
# redis_exporter.service
[Unit]
Description=Redis Exporter
Wants=network-online.target
After=network-online.target

[Service]
User=root
Group=root
Type=simple
ExecStart=/usr/bin/redis_exporter \\
    -web.listen-address ":9121" \\
    -redis.addr "redis://IP ์ฃผ์†Œ:6379" \\

[Install]
WantedBy=multi-user.target
systemctl daemon-reload 
systemctl enable redis_exporter
systemctl start redis_exporter # ์‹คํ–‰
curl -XGET <http://localhost:9121/metrics> # ์ •์ƒ ํ™•์ธ

Prometheus.yml ์ถ”๊ฐ€ ์ˆ˜์ •

- job_name: "redis"
    static_configs:
        - targets: "119.207.74.103:9121"

Prometheus.yml ์ฒดํฌ

./promtool check config prometheus.yml
systemctl restart prometheus # ์žฌ๊ธฐ๋™

ํ™•์ธ

Prometheus ์ •์ƒ ์—ฐ๊ฒฐ ํ™•์ธ

๋Œ€์‹œ๋ณด๋“œ ๊ตฌ์„ฑ

์ด๋ฏธ ๋งŒ๋“ค์–ด์ ธ ์žˆ๋Š” Redis ๋Œ€์‹œ๋ณด๋“œ๋ฅผ ๋“ฑ๋ก

Import ํด๋ฆญ

URL : https://grafana.com/grafana/dashboards/11835

URL ์„ Import via grafana.com ์— ๋„ฃ๋Š”๋‹ค.

๋งˆ์ง€๋ง‰ Prometheus์— ์„ค์ •์„ ๋“ฑ๋ก ํ•œ๋’ค Import ๋ฒ„ํŠผ ํด๋ฆญ

๊ตฌ์„ฑ ์™„๋ฃŒ

 

728x90
๋ฐ˜์‘ํ˜•

'๊ฐœ๋ฐœ > Monitoring' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

Prometheus + Grafana - RabbitMQ ๊ตฌ์ถ•  (0) 2023.07.31
Prometheus + Grafana - ์—ฐ๊ฒฐ  (0) 2023.07.31
Prometheus, Grafana - ์ด๋ก   (0) 2023.07.31