oliver006 / redis_exporter

Prometheus Exporter for ValKey & Redis Metrics. Supports ValKey and Redis 2.x, 3.x, 4.x, 5.x, 6.x, and 7.x
https://github.com/oliver006/redis_exporter
MIT License
3.03k stars 858 forks source link

redis_exporter is not supporting multiple '-redis.addr' entries #870

Closed Udayendu closed 5 months ago

Udayendu commented 5 months ago

Describe the problem If 5 redis processes running with their own ports starting from 7001 to 7005 and when I am passing the multiple redis address entries, redis_exporter is only listening to the last entry of the address. Eg:

/usr/bin/redis_exporter -web.listen-address  localhost:9997 -redis.addr redis://localhost:7001 -redis.addr redis://localhost:7002  -redis.addr redis://localhost:7003  -redis.addr redis://localhost:7004  -redis.addr redis://localhost:7005

If I am using the above command, redis_exporter is only showing the data for process running on 7005 port.

What version of redis_exporter are you running?

INFO[0000] Redis Metrics Exporter v1.56.0    build date: 2023-12-28-04:40:03    sha1: 8b2b2e9c48844500ebcf449a864dc152b14998cb    Go: go1.20.10    GOOS: linux    GOARCH: amd64

Running the exporter

/usr/bin/redis_exporter -web.listen-address :9997 -redis.addr redis://localhost:7001 -redis.addr redis://localhost:7002  -redis.addr redis://localhost:7003  -redis.addr redis://localhost:7004  -redis.addr redis://localhost:7005

Environment

Expected behavior It should allow the metrics from all the redis ports.

Additional context For a single port, it's working perfectly but not able to handle the multiple ports.

oliver006 commented 5 months ago

Have a look at the documentation on how to scrape multiple Redis instances with one exporter.

Udayendu commented 5 months ago

Thanks @oliver006 . After using /usr/bin/redis_exporter -web.listen-address localhost:9997, I am able to start the exporter and using scrape able to call multiple redis instances.

NirmalP29 commented 1 month ago

/usr/local/bin/redis_exporter_1.55.0 -web.listen-address 0.0.0.0:9121 -redis.addr rediss://:pass@0.0.0.0:6379 -redis.addr rediss://:pass@0.0.0.0:6380 -redis.addr rediss://:pass@0.0.0.0:6381 --skip-tls-verification

This is not working for me @Udayendu @oliver006. Can you please help here? I am using 1.55.0.

oliver006 commented 1 month ago

@NirmalP29 - have a look at the documentation on how to scrape multiple targets with one exporter, there's an entire section in the docs

Udayendu commented 1 month ago

@NirmalP29, I have around 32 redis processes running on a single cluster node. I am using a custom systemd script with the following entry in it:

/usr/bin/redis_exporter -web.listen-address ":9997" -include-system-metrics=true 

Then at the prometheus side, using the redis cluster node ip and port 9997, capturing all the process's usage. My systemd file is looking something like below:

[Unit]
Description=Redis Exporter
Wants=network-online.target
After=network-online.target

[Service]
User=root
Group=root
Type=simple
ExecStart=/usr/bin/redis_exporter -web.listen-address ":9997" -include-system-metrics=true 

[Install]
WantedBy=multi-user.target

As per @oliver006 , you should take a look into https://github.com/oliver006/redis_exporter?tab=readme-ov-file#prometheus-configuration-to-scrape-multiple-redis-hosts as well.

Hope this should help you.