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 859 forks source link

Using password file with isCluster enabled trigger: ERRO[10984] Cluster refresh failed: redisc: all nodes failed #835

Closed chetratep closed 8 months ago

chetratep commented 9 months ago

Describe the problem When using password file with isCluster enabled, cluster client is created without password when receiving incoming scrape request. When using password file with url scheme redis:// is required. However in connectToRedisCluster https://github.com/oliver006/redis_exporter/blob/master/exporter/redis.go#L69-L81 removed the URL scheme before creating RedisDialOptions. The removal of the scheme in the url make searching password from the file hit nothing (https://github.com/oliver006/redis_exporter/blob/master/exporter/redis.go#L35). Because in the password file the URL(Keys) has scheme included.

Error is in below:

DEBU[10984] Creating cluster object
DEBU[10984] Running refresh on cluster object
ERRO[10984] Cluster refresh failed: redisc: all nodes failed
NOAUTH Authentication required.

What version of redis_exporter are you running? Please run redis_exporter --version if you're not sure what version you're running.

[ ] 1.54.0

Running the exporter ./redis_exporter -redis.password-file=pwd-file.json --is-cluster -redis.addr redis://xxxxxx:6379

Expected behavior When creating the RedisDialOptions, the URI should include the scheme as well.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Note: The workaround is to specify the -redis.password=xxxx .

oliver006 commented 9 months ago

~Can't you just change the entry in the password file to omit the redis:// scheme?~

nvm - I see your explanation, the scheme is stripped. Makes sense.