首页 > 其他 > 详细

手动部署 Docker+Grafana+Prometheus系统监控之Redis

时间:2019-10-27 00:06:24      阅读:169      评论:0      收藏:0      [点我收藏+]

监控规划图

技术分享图片

使用Docker 创建两台Redis

docker run -d --name redis1 redis
docker run -d --name redis2 redis

查看redis的部署地址

docker inspect (docker ps -a | grep redis | awk '{print $1}') | grep IPAddress

部署redis_exporter收集redis数据

docker run -d --name redis_exporter_1 -p 9121:9121 oliver006/redis_exporter --redis.addr=172.17.0.2:6379
docker run -d --name redis_exporter_2 -p 9122:9121 oliver006/redis_exporter --redis.addr=172.17.0.3:6379

添加prometheus配置文件

global:
  scrape_interval: 15s
  evaluation_interval: 15s

# Attach these labels to any time series or alerts when communicating with
# external systems (federation, remote storage, Alertmanager).
  external_labels:
    monitor: "prometheus-stack-monitor"

# Load and evaluate rules in this file every 'evaluation_interval' seconds.
#rule_files:
# - "first.rules"
# - "second.rules"

scrape_configs:
# scrape Prometheus itself
  - job_name: prometheus
    scrape_interval: 10s
    scrape_timeout: 5s
    static_configs:
      - targets: ["localhost:9090"]

# scrape Redis Enterprise
  - job_name: redis-enterprise
    scrape_interval: 3s
    scrape_timeout: 3s
    static_configs:
      - targets: ['172.17.0.4:9121','172.17.0.7:9121']

targets中为redis_exporter的地址和端口号,多个逗号分隔

部署prometheus

docker run -d --name prome -p 9090:9090 -v /prometheus/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus

prometheus配置文件需要使用绝对位置

部署grafana

docker run -d --name=grafana -p 3000:3000 grafana/grafana

添加prometheus数据源

技术分享图片

下载redis模板 且导入到 grafana

效果图

技术分享图片

手动部署 Docker+Grafana+Prometheus系统监控之Redis

原文:https://www.cnblogs.com/alin-qu/p/11746128.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!