Prometheus monitoring Redis cluster

PrometheusMonitoring Redis cluster, in fact, is the same routine use exporter.
exporterResponsible for collecting indicators, by httpexposure to the Prometheuspulling. granafaThese indicators show the data mapping. PrometheusData will be collected according to the rules you set an alarm to be sent to determine whether or not Alertmanager, Alertmanagerwill have to determine whether or not to send an alarm.

Alertmanager Alarms are divided into three stages

  • Inactive rule is triggered alarm will be sent to this come.
  • Pending you set the waiting time, that the rules inside for
  • Firing send an alert to the e-mail, nails or the like

Pulling away, begin monitoring Redis cluster

redis_exporter monitoring Redis cluster

What monitoring applications, the use of appropriate exporter, can be found at the official website. EXPORTERS AND INTEGRATIONS

RedisUse redis_exporterlink: redis_exporter

Support Redis 2.x - 5.x

Installation and parameters

download link

wget https://github.com/oliver006/redis_exporter/releases/download/v1.3.5/redis_exporter-v1.3.5.linux-amd64.tar.gz   
tar zxvf redis_exporter-v1.3.5.linux-amd64.tar.gz
cd redis_exporter-v1.3.5.linux-amd64/
./redis_exporter <flags>

redis_exporter Support of many parameters, useful to us on a few.

./redis_exporter --help
Usage of ./redis_exporter:
    -redis.addr string
        Address of the Redis instance to scrape (default "redis://localhost:6379")
    -redis.password string
        Password of the Redis instance to scrape
    -web.listen-address string
        Address to listen on for web interface and telemetry. (default ":9121")

Single Instance redis monitoring

nohup ./redis_exporter -redis.addr 172.18.11.138:6379 -redis.password xxxxx &

Prometheus Add a single instance

  - job_name: redis_since
    static_configs:
    - targets: ['172.18.11.138:9121']

Redis cluster monitoring program

This very strenuous, online search a lot of information, mostly single-instance monitoring, it is this cluster, but why he is not cluster password.
prometheus monitoring redis clusters

I tried the program:
two will be prompted authentication failure

level=error msg="Redis INFO err: NOAUTH Authentication required."

method one

nohup ./redis_exporter -redis.addr 172.18.11.139:7000 172.18.11.139:7001 172.18.11.140:7002 172.18.11.140:7003 172.18.11.141:7004 172.18.11.141:7005 -redis.password xxxxx &

Method Two

nohup ./redis_exporter -redis.addr redis://h:Lcsmy.312==/@172.18.11.139:7000 redis://h:Lcsmy.312==/@172.18.11.139:7001 redis://h:Lcsmy.312==/@172.18.11.140:7002 redis://h:Lcsmy.312==/@172.18.11.140:7003 redis://h:Lcsmy.312==/@172.18.11.141:7004 redis://h:Lcsmy.312==/@172.18.11.141:7005 -redis.password xxxxx &

I had wanted to take the most low method of an instance of a start redis_exporter. This way, then, there are many clusters statements are impossible, for example cluster_slot_fail. Abandon the method

nohup ./redis_exporter -redis.addr 172.18.11.139:7000  -redis.password xxxxxx  -web.listen-address 172.18.11.139:9121 > /dev/null 2>&1 &
nohup ./redis_exporter -redis.addr 172.18.11.139:7001  -redis.password xxxxxx  -web.listen-address 172.18.11.139:9122 > /dev/null 2>&1 &
nohup ./redis_exporter -redis.addr 172.18.11.140:7002  -redis.password xxxxxx  -web.listen-address 172.18.11.139:9123 > /dev/null 2>&1 &
nohup ./redis_exporter -redis.addr 172.18.11.140:7003  -redis.password xxxxxx  -web.listen-address 172.18.11.139:9124 > /dev/null 2>&1 &
nohup ./redis_exporter -redis.addr 172.18.11.141:7004  -redis.password xxxxxx  -web.listen-address 172.18.11.139:9125 > /dev/null 2>&1 &
nohup ./redis_exporter -redis.addr 172.18.11.141:7005  -redis.password xxxxxx  -web.listen-address 172.18.11.139:9126 > /dev/null 2>&1 &

Finally I had to githubmention issue. With my Chinese and English author exchanges, finally understand. . . In fact, official documents have been written.

scrape_configs:
  ## config for the multiple Redis targets that the exporter will scrape
  - job_name: 'redis_exporter_targets'
    static_configs:
      - targets:
        - redis://first-redis-host:6379
        - redis://second-redis-host:6379
        - redis://second-redis-host:6380
        - redis://second-redis-host:6381
    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-HOSTNAME>>:9121
  
  ## config for scraping the exporter itself
  - job_name: 'redis_exporter'
    static_configs:
      - targets:
        - <<REDIS-EXPORTER-HOSTNAME>>:9121

Redis cluster actual operation

start up redis_exporter

nohup ./redis_exporter -redis.password xxxxx  &

Focus
on prometheushow to configure it:

  - job_name: 'redis_exporter_targets'
    static_configs:
      - targets:
        - redis://172.18.11.139:7000
        - redis://172.18.11.139:7001
        - redis://172.18.11.140:7002
        - redis://172.18.11.140:7003
        - redis://172.18.11.141:7004
        - redis://172.18.11.141:7005
    metrics_path: /scrape
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: 172.18.11.139:9121

In this way the child will be able to collect the data cluster.

Send a few pictures:

Guess you like

Origin www.cnblogs.com/fsckzy/p/12053604.html