mdawar / rq-exporter

Prometheus metrics exporter for Python RQ (Redis Queue).
MIT License
65 stars 28 forks source link

Error - Help #14

Closed solimanr closed 3 years ago

solimanr commented 3 years ago

[2021-06-10 19:38:47] [rq_exporter] [ERROR]: There was an error starting the RQ exporter Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/redis/connection.py", line 559, in connect sock = self._connect() File "/usr/local/lib/python3.6/site-packages/redis/connection.py", line 615, in _connect raise err File "/usr/local/lib/python3.6/site-packages/redis/connection.py", line 589, in _connect sock = socket.socket(family, socktype, proto) File "/usr/lib64/python3.6/socket.py", line 144, in init _socket.socket.init(self, family, type, proto, fileno) OSError: [Errno 97] Address family not supported by protocol

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/rq_exporter/main.py", line 208, in main REGISTRY.register(RQCollector(connection, worker_class, queue_class)) File "/usr/local/lib/python3.6/site-packages/prometheus_client/registry.py", line 26, in register names = self._get_names(collector) File "/usr/local/lib/python3.6/site-packages/prometheus_client/registry.py", line 66, in _get_names for metric in desc_func(): File "/usr/local/lib/python3.6/site-packages/rq_exporter/collector.py", line 55, in collect for worker in get_workers_stats(self.worker_class): File "/usr/local/lib/python3.6/site-packages/rq_exporter/utils.py", line 60, in get_workers_stats workers = worker_class.all() File "/usr/local/lib/python3.6/site-packages/rq/worker.py", line 123, in all worker_keys = get_keys(queue=queue, connection=connection) File "/usr/local/lib/python3.6/site-packages/rq/worker_registration.py", line 47, in get_keys return {as_text(key) for key in redis.smembers(redis_key)} File "/usr/local/lib/python3.6/site-packages/redis/client.py", line 2281, in smembers return self.execute_command('SMEMBERS', name) File "/usr/local/lib/python3.6/site-packages/redis/client.py", line 898, in execute_command conn = self.connection or pool.get_connection(command_name, **options) File "/usr/local/lib/python3.6/site-packages/redis/connection.py", line 1192, in get_connection connection.connect() File "/usr/local/lib/python3.6/site-packages/redis/connection.py", line 563, in connect raise ConnectionError(self._error_message(e)) redis.exceptions.ConnectionError: Error 97 connecting to localhost:6379. Address family not supported by protocol.

mdawar commented 3 years ago

Hi,

Can you please tell us how you're running the exporter?

solimanr commented 3 years ago

I installed in python pip on my machine (windows), the same error broke out. I climbed on the rancher, like kubernetes, also gave the same mistake. And finally, I climbed into a ubuntu machine and the same error popped.

mdawar commented 3 years ago

Are you running rq-exporter without any flags? Did you try to specify the Redis URL?

For example:

$ # By default the exporter will connect to Redis on `localhost` port `6379`
$ # You can specify a Redis URL
$ rq-exporter --redis-url redis://:123456@redis_host:6379/0
$ # Or specific Redis options (host, port, db, password)
$ rq-exporter --redis-host 192.168.1.10 --redis-port 6380 --redis-pass 123456 --redis-db 1
solimanr commented 3 years ago

I think I found the problem. I don't use authentication in redis, is there a way to upload the container with authentication disabled?

solimanr commented 3 years ago

I uploaded the container with this command: docker run -it -p 9727:9727 mdawar/rq-exporter:v1.8.0 --redis-host ip --redis-port port [2021-06-11 14:53:58] [rq_exporter] [INFO]: Serving the application on 0.0.0.0:9726 But only these metrics are going up image

mdawar commented 3 years ago

I think I found the problem. I don't use authentication in redis, is there a way to upload the container with authentication disabled?

What do you mean by upload the container? Are you building a custom image? If you're not changing anything you can use the public image mdawar/rq-exporter.

You can specify the host and port without the password and make sure the Redis server is accessible from the container:

rq-exporter --redis-host localhost --redis-port 6379

Please check the usage section for more info.

mdawar commented 3 years ago

I uploaded the container with this command: docker run -it -p 9727:9727 mdawar/rq-exporter:v1.8.0 --redis-host ip --redis-port port [2021-06-11 14:53:58] [rq_exporter] [INFO]: Serving the application on 0.0.0.0:9726 But only these metrics are going up image

Do you have workers running?

solimanr commented 3 years ago

I'll explain better I need to pull this metrics from the print below image There is a cluster of kubernetes, I came up with the following cod image image

However, it is not rising with the metrics I need to put: image

mdawar commented 3 years ago

It seems that you don't have any workers running.

Check the Development section to start a local development environment with all the services using docker-compose and test things out so you can find the issue.

mdawar commented 3 years ago

Feel free to re-open this issue if you still need help.