Halo, kalau kamu merasa tulisan saya ngebantu kamu, kamu bisa ucapkan terima kasih lewat saweria .

If you feel this website help you, you can donate at saweria .



Tools yang Saya Gunakan

  1. Dockprom

  2. Docker

  3. redis_exporter


How To

  1. Setup redis_exporter , buat file docker-compose.yml
version: '3'

services:
  redis-exporter:
    image: oliver006/redis_exporter:latest
    restart: always
    depends_on:
      - redis
    container_name: redis_exporter
    environment:
      #use this you use redis with same docker-compose with this exporter
      #REDIS_ADDR: redis://redis:6379
      REDIS_ADDR: redis://192.168.1.2:6379
      REDIS_PASSWORD: passREDISkamu
    ports:
      - "9121:9121"

Jalankan docker-compose up -d. Untuk mengecek apakah exporter sudah berhasil dijalankan, gunakan docker logs -f redis-exporter

redisexporter Running Succesfully

redisexporter Running Succesfully

  1. Selanjutnya, tambahkan job baru di file prometheus.yml
  - job_name: redis-exporter
    honor_labels: true
    honor_timestamps: true
    scrape_interval: 30s
    scrape_timeout: 30s
    metrics_path: /metrics
    scheme: http
    follow_redirects: true
    enable_http2: true
    static_configs:
    - targets:
      #redis_exporter server
      - 192.168.1.3:9121

Restart container prometheus docker restart prometheus

  1. Tambahkan rules redis baru di prometheus
wget https://raw.githubusercontent.com/samber/awesome-prometheus-alerts/master/dist/rules/redis/oliver006-redis-exporter.yml -O redis-exporter.rules
  1. Masuk ke grafana dashboard, import JSON dashboard 763 (entah kenapa ga tersedia di grafana.com)

redis_exporter Running Succesfully

redis_exporter Running Succesfully

Alert Sudah Jalan

Alert Sudah Jalan


Beberapa Permasalahan & Solusinya

Redis is Running Out of Configured Memory

Redis is Running Out of Configured Memory

  1. Redis is Running Out of Configured Memory

    Ini agak aneh, karena di sana di tulis maxmemory nya infinity/unlimited. Alert ini bisa hilang dengan cara menetapkan maxmemory di redis config

    #maxmemory, default infinity
    config get maxmemory
    config set maxmemory 3GB
    

Redis Has Too Many Connection

Redis Has Too Many Connection

2. Redis Has Too Many Connection/Too Many Client

Solusinya di redis, kita bisa menambahkan maxclient
```
#maxclient, defaul 10000
config get maxclients
config set maxclients 20000
```

Referensi:

Awesome Prometheus alerts - redis

Prometheus Redis Metrics Exporter