Closed imatthew-nq closed 1 year ago
-config-command
is for changing the name of the CONFIG
command, not for proving a config file.
You have to pass the Redis address parameter directly (using -redis.addr
et al) and you can't connect to two instances with one exporter, use an exporter for each instance.
Thank you for your quick answer oliver006 I can connect to two redis instances via two redis_exporter, am I right? And is it possible to change exporter_addr for each instance to scrape with Prometheus? for example in config-file which passes to redis_exporter_1.service to gets master instance metrics use exporter_addr: ":9121" and for the other redis_exporter_2.service use exporter_addr: ":9122" to gets slave instance metrics?
I got the answer and I wanted to share it with you In one of the instances I created two services and each one of those services contains below contents:
#redis_exporter_master.service and it scraped on port:9121
Description=Redis Exporter Master
After=network.target
[Service]
Type=simple
User=redis
Group=redis
WorkingDirectory=/opt/prometheus/redis_exporter/
ExecReload=/bin/kill -HUP $MAINPID
ExecStart=/opt/prometheus/redis_exporter/redis_exporter -redis.addr redis://172.16.1.21:7000 -redis.password-file pass.json
SyslogIdentifier=redis_exporter
Restart=always
[Install]
WantedBy=multi-user.target
For the slave instance on the same server, I created and pass some more parameters on the service section:
#redis_exporter_slave.service and it scraped on port:9122
Description=Redis Exporter Slave
After=network.target
[Service]
Type=simple
User=redis
Group=redis
WorkingDirectory=/opt/prometheus/redis_exporter/
ExecReload=/bin/kill -HUP $MAINPID
ExecStart=/opt/prometheus/redis_exporter/redis_exporter -redis.addr redis://172.16.1.21:7001 -redis.password-file pass2.json -web.listen-address :9122
SyslogIdentifier=redis_exporter
Restart=always
[Install]
WantedBy=multi-user.target
pass.json context is:
{
"redis://172.16.1.21:7000": "[PASSWORD]"
}
pass2.json context is:
{
"redis://172.16.1.21:7001": "[PASSWORD]"
}
Both Services of redis_exporter work like a charm. Thank you for your help.
Good to hear you got it figured out!
Describe the problem In a redis cluster built on 5 instances and each instance runs master and slave on different ports and the whole cluster has credential authentication.
Create a redis_exporter.conf file and it contains master & slave IP and PORT + PASSWORD
When running the below command there would be errors appear:
Running the exporter redis_exporter -config-command redis_exporter.conf
There is no redis service running on redis://localhost:6379 and when I pass the config file to redis_exporter it does not work probably.
What version of redis_exporter are you running? [ redis_version] 5.0.7 [redis_exporter ] v1.48.0.linux-amd64