Redis Monitor
操作步骤如下
- redis-exporter
- prometheus
- grafana
redis-exporter 启动
-
在机器对应目录下创建目录和文件
- mkdir -p /home/save/redis-exporter/conf
-
touch redis_conf.json
1 2 3 4 5
{ "redis://redis-address-1:6379": "", "redis://redis-address-2:6379": "", "redis://redis-address-3:6379": "****" }
-
docker-compose
1 2 3 4 5 6 7 8 9 10 11
version: "3" services: redis-monitor: container_name: redis-monitor image: oliver006/redis_exporter ports: - "9121:9121" command: "-redis.password-file=/opt/redis_conf.json" volumes: - /home/save/redis-exporter/conf/redis_conf.json:/opt/redis_conf.json restart: "always"
-
启动
- docker-compose up -d
- docker-compose ps
- docker-compose logs
prometheus
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
scrape_configs:
- job_name: "prometheus"
static_configs:
- targets: ["prometheus:9991"]
- job_name: "redis_exporter_targets"
static_configs:
- targets:
- redis://redis-address-1:6379
- redis://redis-address-2:6379
- redis://redis-address-3:6379
metrics_path: /scrape
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: redis-exporter-address:9121
- job_name: "redis_exporter"
static_configs:
- targets:
- "redis-exporter-address:9122"
grafana
- 在面板 /dashboard/import
- 创建三种方法 GrafanaLabs Address
最后结果
This post is licensed under
CC BY 4.0
by the author.