Prometheus

[Prometheus] Redis_exporter 연동 (Linux)

Dev.Congsik 2024. 8. 26. 15:01
728x90

 

 

 

  • prometheus에서 redis 서버를 모니터링 하기 위해서는 시스템 메트릭을 수집하기 위한 redis_exporter가 필요하다.

 

  • redis_exporter 다운로드
wget https://github.com/oliver006/redis_exporter/releases/download/v1.24.0/redis_exporter-v1.24.0.linux-amd64.tar.gz

 

-> 다운로드 링크 :https://github.com/oliver006/redis_exporter/releases

 

Releases · oliver006/redis_exporter

Prometheus Exporter for ValKey & Redis Metrics. Supports ValKey and Redis 2.x, 3.x, 4.x, 5.x, 6.x, and 7.x - oliver006/redis_exporter

github.com

 

  • 압축 해제
tar xzvf redis_exporter-v1.24.0.linux-amd64.tar.gz

 

 

  • 서비스 등록 (redis 서버 #1~#3)
vi /etc/systemd/system/redis_exporter.service

[Unit]
Description=Redis Exporter
Wants=network-online.target
After=network-online.target

[Service]
User=root
Group=root
Type=simple
ExecStart=/root/install/redis_exporter-v1.58.0.linux-amd64/redis_exporter \    //redis_exporter 실행파일 경로
    -web.listen-address ":9121" \   //exporter 리스너 포트
    -redis.addr "redis://192.168.59.134:6379" \   //redis 서버 주소:redis 서버 포트

[Install]
WantedBy=multi-user.target

 

  • 적용 및 서비스 시작
systemctl daemon-reload
systemctl start redis_exporter.service
systemctl enable redis_exporter.service

 

  • prometheus.yml 수정 진행
  #redis cluster 메트릭 수집설정
  - job_name: 'redis_exporter1'
    static_configs:
      - targets: ['192.168.59.134:9121']
  - job_name: 'redis_exporter2'
    static_configs:
      - targets: ['192.168.59.135:9121']
  - job_name: 'redis_exporter3'
    static_configs:
      - targets: ['192.168.59.136:9121']

 

  • promtool로 config 유효성 검사 진행

→ 해당 툴로 yml 문법 오류나 오타 등 점검 가능, 유효성 검사 기능

 

  • prometheus 재기동
systemctl restart prometheus

 

  • prometheus 서버에서 redis_exporter 확인

728x90

'Prometheus' 카테고리의 다른 글

[Prometheus] mysqld_exporter 연동 (Linux)  (0) 2024.08.26
[Prometheus] Node-exporter 연동 (Linux)  (0) 2024.08.26
Prometheus?  (0) 2024.08.26