prometheus consul docker redis_exporter 自動注冊配置


0、啟動redis_exporter

redis_exporter:

version: '2'
services:
redis_exporter:
image: oliver006/redis_exporter
container_name: redis_exporter_test
ports:
- 9121
network_mode: host
environment:
- REDIS_ADDR=10.x.x.x:6379
- REDIS_PASSWORD=password

 1、配置prometheus

scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
- job_name: 'consul-prometheus'
consul_sd_configs:
- server: '10.10.10.xxx:8500'
#services: ['redis*', 'kafka*', 'mysql*']

 

 

 

2、consul

#啟動consul

nohup /usr/sbin/consul agent -bind=10.x.x.x -server -ui  -bootstrap-expect 1 -data-dir=/data/consul/ -node=n1 -client=0.0.0.0 &

#增加

#curl -X PUT -d '{"id": "redis-xxx","name": "redis-xxx","address": "127.0.0.1","port": 9121,"tags": ["test"],"checks": [{"http": "http://127.0.0.1:9121/","interval": "5s"}]}' http://127.0.0.1:8500/v1/agent/service/register
 
 
grafana就可以看數據 了
 
 
###如果要刪除
 
 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM