Failed to establish a new connection: [Errno 111] Connection refused
yagza opened this issue · comments
yagza commented
Hello,
I have an error "Failed to establish a new connection: [Errno 111] Connection refused" either for read-only user (port 80) or /rci API connection (port 79):
2022-03-22 13:23:02,382 - keentic_influxdb_exporter.py - INFO -
_ __ _ _ _____ _ _ _
| |/ / | | (_) / ____| | | | | |
| ' / ___ ___ _ __ ___| |_ _ ___ | | ___ | | | ___ ___| |_ ___ _ __
| < / _ \/ _ \ '_ \ / _ \ __| |/ __| | | / _ \| | |/ _ \/ __| __/ _ \| '__|
| . \ __/ __/ | | | __/ |_| | (__ | |___| (_) | | | __/ (__| || (_) | |
|_|\_\___|\___|_| |_|\___|\__|_|\___| \_____\___/|_|_|\___|\___|\__\___/|_|
2022-03-22 13:23:02,384 - influxdb_writter.py - INFO - Connecting to InfluxDB: http://localhost:8086
2022-03-22 13:23:02,384 - keentic_influxdb_exporter.py - INFO - Connecting to router: http://192.168.1.1:79
2022-03-22 13:23:02,384 - keentic_influxdb_exporter.py - INFO - Configuring metric: processes
2022-03-22 13:23:02,428 - keentic_influxdb_exporter.py - INFO - Configuring metric: ip hotspot
2022-03-22 13:23:02,536 - keentic_influxdb_exporter.py - INFO - Configuring metric: interface
2022-03-22 13:23:02,619 - keentic_influxdb_exporter.py - INFO - Configuring metric: system
2022-03-22 13:23:02,694 - keentic_influxdb_exporter.py - INFO - Configuring metric: internet status
2022-03-22 13:23:02,739 - keentic_influxdb_exporter.py - INFO - Configuring metric: media
2022-03-22 13:23:02,788 - keentic_influxdb_exporter.py - INFO - Configuring metric: interface stat
2022-03-22 13:23:02,825 - keentic_influxdb_exporter.py - INFO - Configuring metric: interface stat
2022-03-22 13:23:02,864 - keentic_influxdb_exporter.py - INFO - Configuring metric: interface stat
2022-03-22 13:23:02,903 - keentic_influxdb_exporter.py - INFO - Configuring metric: interface stat
2022-03-22 13:23:02,940 - keentic_influxdb_exporter.py - INFO - Configuring metric: interface stat
2022-03-22 13:23:02,979 - keentic_influxdb_exporter.py - INFO - Configuration done. Start collecting with interval: 60 sec
Traceback (most recent call last):
File "/root/.local/lib/python3.8/site-packages/urllib3/connection.py", line 174, in _new_conn
conn = connection.create_connection(
File "/root/.local/lib/python3.8/site-packages/urllib3/util/connection.py", line 95, in create_connection
raise err
File "/root/.local/lib/python3.8/site-packages/urllib3/util/connection.py", line 85, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/keentic_influxdb_exporter.py", line 127, in <module>
infuxdb_writer.write_metrics(metrics)
File "/home/influxdb_writter.py", line 18, in write_metrics
self._write_api.write(bucket=self._configuration['bucket'], org=self._configuration['org'], record=metrics)
File "/root/.local/lib/python3.8/site-packages/influxdb_client/client/write_api.py", line 371, in write
results = list(map(write_payload, payloads.items()))
File "/root/.local/lib/python3.8/site-packages/influxdb_client/client/write_api.py", line 369, in write_payload
return self._post_write(_async_req, bucket, org, final_string, payload[0])
File "/root/.local/lib/python3.8/site-packages/influxdb_client/client/write_api.py", line 517, in _post_write
return self._write_service.post_write(org=org, bucket=bucket, body=body, precision=precision,
File "/root/.local/lib/python3.8/site-packages/influxdb_client/service/write_service.py", line 62, in post_write
(data) = self.post_write_with_http_info(org, bucket, body, **kwargs) # noqa: E501
File "/root/.local/lib/python3.8/site-packages/influxdb_client/service/write_service.py", line 166, in post_write_with_http_info
return self.api_client.call_api(
File "/root/.local/lib/python3.8/site-packages/influxdb_client/api_client.py", line 341, in call_api
return self.__call_api(resource_path, method,
File "/root/.local/lib/python3.8/site-packages/influxdb_client/api_client.py", line 171, in __call_api
response_data = self.request(
File "/root/.local/lib/python3.8/site-packages/influxdb_client/api_client.py", line 386, in request
return self.rest_client.POST(url,
File "/root/.local/lib/python3.8/site-packages/influxdb_client/rest.py", line 304, in POST
return self.request("POST", url,
File "/root/.local/lib/python3.8/site-packages/influxdb_client/rest.py", line 217, in request
r = self.pool_manager.request(
File "/root/.local/lib/python3.8/site-packages/urllib3/request.py", line 78, in request
return self.request_encode_body(
File "/root/.local/lib/python3.8/site-packages/urllib3/request.py", line 170, in request_encode_body
return self.urlopen(method, url, **extra_kw)
File "/root/.local/lib/python3.8/site-packages/urllib3/poolmanager.py", line 376, in urlopen
response = conn.urlopen(method, u.request_uri, **kw)
File "/root/.local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 785, in urlopen
retries = retries.increment(
File "/root/.local/lib/python3.8/site-packages/urllib3/util/retry.py", line 525, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/root/.local/lib/python3.8/site-packages/urllib3/packages/six.py", line 770, in reraise
raise value
File "/root/.local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "/root/.local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 398, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/root/.local/lib/python3.8/site-packages/urllib3/connection.py", line 239, in request
super(HTTPConnection, self).request(method, url, body=body, headers=headers)
File "/usr/local/lib/python3.8/http/client.py", line 1256, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/local/lib/python3.8/http/client.py", line 1302, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/local/lib/python3.8/http/client.py", line 1251, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/local/lib/python3.8/http/client.py", line 1011, in _send_output
self.send(msg)
File "/usr/local/lib/python3.8/http/client.py", line 951, in send
self.connect()
File "/root/.local/lib/python3.8/site-packages/urllib3/connection.py", line 205, in connect
conn = self._new_conn()
File "/root/.local/lib/python3.8/site-packages/urllib3/connection.py", line 186, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f81aa995e80>: Failed to establish a new connection: [Errno 111] Connection refused
Current config.ini is:
[influx2]
url=http://localhost:8086
# For influx v1.x please use "-" as a value
org=keenetic
# For influx v1.x please use "username:password" as a token
token=blah123
timeout=6000
# For influx v1.x DB name
bucket=keenetic
[keenetic]
skip_auth=true
admin_endpoint=http://192.168.1.1:79
login=user
password=password
[collector]
interval_sec=60
I also tried with:
admin_endpoint=http://192.168.1.1
or
admin_endpoint=curl http://192.168.1.1:79/rci
result was the same.
From the host whom contains the docker machine I can access the :79 and 80 port:
$ curl http://192.168.1.1:79/rci | jq .system.hostname
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 33970 100 33970 0 0 54311 0 --:--:-- --:--:-- --:--:-- 54265
"Keenetic"
I have tried 2.0.0 version and the latest both.
My Keenetic OS is the following version:
Current KeeneticOS version: [3.5.10]
Could you please give me a clue?
yagza commented
Vitaliy Skrypnyk commented
@yagza you have a connection issue to influxdb, not router