smilebasti / npmGrafStats

This project exports NginxProxyManager Logs to InfluxDB for displaying them in a Grafana Dashboard.
GNU General Public License v3.0
149 stars 10 forks source link

Connection Refused in npmgraf #25

Closed CoolCoderSJ closed 1 year ago

CoolCoderSJ commented 1 year ago

It seems like the npmgraf container is failing to export logs to InfluxDB. The container's logs show-

nginx-ui-npmgraf-1      | **************** start *********************
nginx-ui-npmgraf-1      | Measurement-name: ReverseProxyConnections
nginx-ui-npmgraf-1      | United States
nginx-ui-npmgraf-1      | Virginia
nginx-ui-npmgraf-1      | Ashburn
nginx-ui-npmgraf-1      | (redacted)
nginx-ui-npmgraf-1      | (redacted)
nginx-ui-npmgraf-1      | (redacted)
nginx-ui-npmgraf-1      | US
nginx-ui-npmgraf-1      | Outside IP:  (redacted)
nginx-ui-npmgraf-1      | Target IP:  (redacted)
nginx-ui-npmgraf-1      | Domain:  (redacted)
nginx-ui-npmgraf-1      | Measurement Time:  2023-07-28T16:25:51+00:00
nginx-ui-npmgraf-1      | Traceback (most recent call last):
nginx-ui-npmgraf-1      |   File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 203, in _new_conn
nginx-ui-npmgraf-1      |     sock = connection.create_connection(
nginx-ui-npmgraf-1      |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
nginx-ui-npmgraf-1      |   File "/usr/local/lib/python3.11/site-packages/urllib3/util/connection.py", line 85, in create_connection
nginx-ui-npmgraf-1      |     raise err
nginx-ui-npmgraf-1      |   File "/usr/local/lib/python3.11/site-packages/urllib3/util/connection.py", line 73, in create_connection
nginx-ui-npmgraf-1      |     sock.connect(sa)
nginx-ui-npmgraf-1      | ConnectionRefusedError: [Errno 111] Connection refused
nginx-ui-npmgraf-1      | 
nginx-ui-npmgraf-1      | The above exception was the direct cause of the following exception:
nginx-ui-npmgraf-1      | 
nginx-ui-npmgraf-1      | Traceback (most recent call last):
nginx-ui-npmgraf-1      |   File "/root/.config/NPMGRAF/Getipinfo.py", line 122, in <module>
nginx-ui-npmgraf-1      |     write_api.write(bucket=ifbucket, org=iforg, record=point)
nginx-ui-npmgraf-1      |   File "/usr/local/lib/python3.11/site-packages/influxdb_client/client/write_api.py", line 378, in write
nginx-ui-npmgraf-1      |     results = list(map(write_payload, payloads.items()))
nginx-ui-npmgraf-1      |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
nginx-ui-npmgraf-1      |   File "/usr/local/lib/python3.11/site-packages/influxdb_client/client/write_api.py", line 376, in write_payload
nginx-ui-npmgraf-1      |     return self._post_write(_async_req, bucket, org, final_string, payload[0])
nginx-ui-npmgraf-1      |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
nginx-ui-npmgraf-1      |   File "/usr/local/lib/python3.11/site-packages/influxdb_client/client/write_api.py", line 509, in _post_write
nginx-ui-npmgraf-1      |     return self._write_service.post_write(org=org, bucket=bucket, body=body, precision=precision,
nginx-ui-npmgraf-1      |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
nginx-ui-npmgraf-1      |   File "/usr/local/lib/python3.11/site-packages/influxdb_client/service/write_service.py", line 60, in post_write
nginx-ui-npmgraf-1      |     (data) = self.post_write_with_http_info(org, bucket, body, **kwargs)  # noqa: E501
nginx-ui-npmgraf-1      |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
nginx-ui-npmgraf-1      |   File "/usr/local/lib/python3.11/site-packages/influxdb_client/service/write_service.py", line 90, in post_write_with_http_info
nginx-ui-npmgraf-1      |     return self.api_client.call_api(
nginx-ui-npmgraf-1      |            ^^^^^^^^^^^^^^^^^^^^^^^^^
nginx-ui-npmgraf-1      |   File "/usr/local/lib/python3.11/site-packages/influxdb_client/_sync/api_client.py", line 343, in call_api
nginx-ui-npmgraf-1      |     return self.__call_api(resource_path, method,
nginx-ui-npmgraf-1      |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
nginx-ui-npmgraf-1      |   File "/usr/local/lib/python3.11/site-packages/influxdb_client/_sync/api_client.py", line 173, in __call_api
nginx-ui-npmgraf-1      |     response_data = self.request(
nginx-ui-npmgraf-1      |                     ^^^^^^^^^^^^^
nginx-ui-npmgraf-1      |   File "/usr/local/lib/python3.11/site-packages/influxdb_client/_sync/api_client.py", line 388, in request
nginx-ui-npmgraf-1      |     return self.rest_client.POST(url,
nginx-ui-npmgraf-1      |            ^^^^^^^^^^^^^^^^^^^^^^^^^^
nginx-ui-npmgraf-1      |   File "/usr/local/lib/python3.11/site-packages/influxdb_client/_sync/rest.py", line 311, in POST
nginx-ui-npmgraf-1      |     return self.request("POST", url,
nginx-ui-npmgraf-1      |            ^^^^^^^^^^^^^^^^^^^^^^^^^
nginx-ui-npmgraf-1      |   File "/usr/local/lib/python3.11/site-packages/influxdb_client/_sync/rest.py", line 220, in request
nginx-ui-npmgraf-1      |     r = self.pool_manager.request(
nginx-ui-npmgraf-1      |         ^^^^^^^^^^^^^^^^^^^^^^^^^^
nginx-ui-npmgraf-1      |   File "/usr/local/lib/python3.11/site-packages/urllib3/_request_methods.py", line 118, in request
nginx-ui-npmgraf-1      |     return self.request_encode_body(
nginx-ui-npmgraf-1      |            ^^^^^^^^^^^^^^^^^^^^^^^^^
nginx-ui-npmgraf-1      |   File "/usr/local/lib/python3.11/site-packages/urllib3/_request_methods.py", line 217, in request_encode_body
nginx-ui-npmgraf-1      |     return self.urlopen(method, url, **extra_kw)
nginx-ui-npmgraf-1      |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
nginx-ui-npmgraf-1      |   File "/usr/local/lib/python3.11/site-packages/urllib3/poolmanager.py", line 443, in urlopen
nginx-ui-npmgraf-1      |     response = conn.urlopen(method, u.request_uri, **kw)
nginx-ui-npmgraf-1      |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
nginx-ui-npmgraf-1      |   File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 844, in urlopen
nginx-ui-npmgraf-1      |     retries = retries.increment(
nginx-ui-npmgraf-1      |               ^^^^^^^^^^^^^^^^^^
nginx-ui-npmgraf-1      |   File "/usr/local/lib/python3.11/site-packages/urllib3/util/retry.py", line 445, in increment
nginx-ui-npmgraf-1      |     raise reraise(type(error), error, _stacktrace)
nginx-ui-npmgraf-1      |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
nginx-ui-npmgraf-1      |   File "/usr/local/lib/python3.11/site-packages/urllib3/util/util.py", line 39, in reraise
nginx-ui-npmgraf-1      |     raise value
nginx-ui-npmgraf-1      |   File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 790, in urlopen
nginx-ui-npmgraf-1      |     response = self._make_request(
nginx-ui-npmgraf-1      |                ^^^^^^^^^^^^^^^^^^^
nginx-ui-npmgraf-1      |   File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 496, in _make_request
nginx-ui-npmgraf-1      |     conn.request(
nginx-ui-npmgraf-1      |   File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 395, in request
nginx-ui-npmgraf-1      |     self.endheaders()
nginx-ui-npmgraf-1      |   File "/usr/local/lib/python3.11/http/client.py", line 1281, in endheaders
nginx-ui-npmgraf-1      |     self._send_output(message_body, encode_chunked=encode_chunked)
nginx-ui-npmgraf-1      |   File "/usr/local/lib/python3.11/http/client.py", line 1041, in _send_output
nginx-ui-npmgraf-1      |     self.send(msg)
nginx-ui-npmgraf-1      |   File "/usr/local/lib/python3.11/http/client.py", line 979, in send
nginx-ui-npmgraf-1      |     self.connect()
nginx-ui-npmgraf-1      |   File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 243, in connect
nginx-ui-npmgraf-1      |     self.sock = self._new_conn()
nginx-ui-npmgraf-1      |                 ^^^^^^^^^^^^^^^^
nginx-ui-npmgraf-1      |   File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 218, in _new_conn
nginx-ui-npmgraf-1      |     raise NewConnectionError(
nginx-ui-npmgraf-1      | urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0xffffa97ca750>: Failed to establish a new connection: [Errno 111] Connection refused

The token i inserted into the docker-compose file is an all access token. The host I put in for the influxdb host is HOST_IP:8086 and it is publicly accessible- I can open HOST_IP:8086 in my browser and it works. I tried http://HOST_IP:8086 as well, but that didn't work either. What should I do?

CoolCoderSJ commented 1 year ago

I'm not even sure what happened- after killing everything, setting the host to HOST_IP:8086, then restarting, it worked.