Prometheus+Grafana+redis_exporter 监控 Redis 服务

Prometheus Grafana DevOps About 1,577 words

redis_exporter 下载地址

https://github.com/oliver006/redis_exporter/releases

后台启动

nohup /root/exporter/redis_exporter-v1.33.0/redis_exporter > redis_exporter.out 2>&1 &

开机启动

编辑

vim /etc/systemd/system/redis_exporter.service

内容:ExecStart需要修改为redis_exporter二进制文件的绝对路径

[Unit]
Description=redis_exporter
Documentation=https://github.com/oliver006/redis_exporter
After=network.target

[Service]
Type=simple
User=root
ExecStart= /root/exporter/redis_exporter-v1.33.0/redis_exporter
Restart=on-failure

[Install]
WantedBy=multi-user.target

设为开机启动

sudo systemctl enable redis_exporter.service

启动redis_exporter

sudo systemctl start redis_exporter.service

redis_exporter 默认端口

http://localhost:9121

修改 Prometheus 配置

prometheus.yml文件中修改。

scrape_configs:
  ## config for the multiple Redis targets that the exporter will scrape
  - job_name: 'redis_exporter_targets'
    static_configs:
      - targets:
        - redis://192.168.0.100:6379
    metrics_path: /scrape
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: 192.168.0.100:9121

  ## config for scraping the exporter itself
  - job_name: 'redis_exporter'
    static_configs:
      - targets:
        - 192.168.0.100:9121

重启 Prometheus

重启后可查看redis_exporter是否上线。

http://localhost:9090/targets

Grafana Dashboard

Redis Dashboard for Prometheus Redis Exporter 1.x:https://grafana.com/grafana/dashboards/763

开源地址

https://github.com/oliver006/redis_exporter

Views: 1,855 · Posted: 2022-02-24

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb/LiteNote

扫描下方二维码关注公众号和小程序↓↓↓

扫描下方二维码关注公众号和小程序↓↓↓


Today On History
Browsing Refresh