章工运维 章工运维
首页
  • linux
  • windows
  • 中间件
  • 监控
  • 网络
  • 存储
  • 安全
  • 防火墙
  • 数据库
  • 系统
  • docker
  • 运维工具
  • other
  • elk
  • K8S
  • ansible
  • Jenkins
  • GitLabCI_CD
  • 随笔
  • 面试
  • 工具
  • 收藏夹
  • Shell
  • python
  • golang
友链
  • 索引

    • 分类
    • 标签
    • 归档
    • 首页 (opens new window)
    • 关于我 (opens new window)
    • 图床 (opens new window)
    • 评论 (opens new window)
    • 导航栏 (opens new window)
周刊
GitHub (opens new window)

章工运维

业精于勤,荒于嬉
首页
  • linux
  • windows
  • 中间件
  • 监控
  • 网络
  • 存储
  • 安全
  • 防火墙
  • 数据库
  • 系统
  • docker
  • 运维工具
  • other
  • elk
  • K8S
  • ansible
  • Jenkins
  • GitLabCI_CD
  • 随笔
  • 面试
  • 工具
  • 收藏夹
  • Shell
  • python
  • golang
友链
  • 索引

    • 分类
    • 标签
    • 归档
    • 首页 (opens new window)
    • 关于我 (opens new window)
    • 图床 (opens new window)
    • 评论 (opens new window)
    • 导航栏 (opens new window)
周刊
GitHub (opens new window)
  • linux

  • windows

  • 中间件

  • 网络

  • 安全

  • 存储

  • 防火墙

  • 数据库

  • 系统

  • docker

  • other

  • 监控

    • zabbix

    • prometheus

      • prometheus监控、告警与存储
      • 使用docker-compose搭建promethes+grafana监控系统
      • prometheus添加钉钉消息告警
      • alertmanager实现某个时间段静默某些告警项
      • prometheus设置表达式触发告警
      • 监控MySQL运行状态:MySQLD Exporter
      • alertmanager设置定时静默告警脚本
      • 构建高大上的黑盒监控平台
      • prometheus使用一个redis_exporter监控所有redis实例
        • alertmanager-webhook与API
    • 运维
    • 监控
    • prometheus
    章工运维
    2023-06-30
    目录

    prometheus使用一个redis_exporter监控所有redis实例

    # 部署一个支持多实例的redis_exporter

    官方仓库:https://github.com/oliver006/redis_exporter

    version: "3.2"
    services:
      redis-exporter:
        image: oliver006/redis_exporter:v1.51.0 
        container_name: redis-exporter
        restart: unless-stopped
        command:
          - "-redis.password-file=/redis_passwd.json"
        volumes:
          - /usr/share/zoneinfo/PRC:/etc/localtime
          - ./redis_passwd.json:/redis_passwd.json
        expose:
          - 9121
        ports:
          - "9121:9121"
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15

    新建一个redis的实例地址与密码文件,/data/redis-exporter/redis_passwd.json:

    {
      "redis://xxxxxxxxxxx.dcs.huaweicloud.com:6379":"",
      "redis://aaaaaaaa.cn-south-1.dcs.myhuaweicloud.com:6379":"q1azw2sx"
    }
    
    1
    2
    3
    4
    • docker-compose中挂载配置文件文件的本地路径注意根据实际情况修改。
    • 配置文件的格式为json,每行一个实例的信息格式为:"redis://实例地址端口":"redis密码"
    • 实例地址端口请查看云REDIS列表或自建redis管理的实例字段。
    • 如redis无密码,保留空双引号即可""。

    启动:docker-compose up -d

    # 在prometheus加入redis_exporter配置

    配置如下

      - job_name: 'redis_exporter_targets'
        static_configs:
          - targets:
            - redis://xxxx:16379
        metrics_path: /scrape
        relabel_configs:
          - source_labels: [__address__]
            target_label: __param_target
          - source_labels: [__param_target]
            target_label: instance
          - target_label: __address__
            replacement: xxxx:9121
    
      ## config for scraping the exporter itself
      - job_name: 'redis_exporter'
        static_configs:
          - targets:
            - xxxx:9121
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18

    # 在grafana配置可以查看的模板

    GRAFANA:Redis Exporter Dashboard 中文版 (opens new window)

    模板id号:17507

    b860aa425eb68102.png


    参考链接 (opens new window)

    微信 支付宝
    上次更新: 2024/12/30, 21:04:26

    ← 构建高大上的黑盒监控平台 alertmanager-webhook与API→

    最近更新
    01
    shell脚本模块集合
    05-13
    02
    生活小技巧(认知版)
    04-29
    03
    生活小技巧(防骗版)
    04-29
    更多文章>
    Theme by Vdoing | Copyright © 2019-2025 | 点击查看十年之约 | 鄂ICP备2024072800号
    • 跟随系统
    • 浅色模式
    • 深色模式
    • 阅读模式