DataDog / datadog-agent

Main repository for Datadog Agent
https://docs.datadoghq.com/
Apache License 2.0
2.84k stars 1.19k forks source link

[BUG] {"message": "HTTPConnectionPool(host='localhost', port=81): Max retries exceeded with url: /nginx_status/ #27174

Open Faisal0sal opened 3 months ago

Faisal0sal commented 3 months ago

Agent Environment

Describe what happened: After configuring the datadog apm mostly things are working fine. however, I see that it still reports this issue: Datadog has detected 1 integration with issues: Datadog’s nginx integration is reporting:

Instance #nginx:249b6771639575ce[ERROR]: [{"message": "HTTPConnectionPool(host='localhost', port=81): Max retries exceeded with url: /nginx_status/ (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f18d15f1b50>: Failed to establish a new connection: [Errno 111] Connection refused'))", "traceback": "Traceback (most recent call last):\n File \"/opt/datadog-agent/embedded/lib/python3.11/site-packages/urllib3/connection.py\", line 174, in _new_conn\n conn = connection.create_connection(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/opt/datadog-agent/embedded/lib/python3.11/site-packages/urllib3/util/connection.py\", line 95, in create_connection\n raise err\n File \"/opt/datadog-agent/embedded/lib/python3.11/site-packages/urllib3/util/connection.py\", line 85, in create_connection\n sock.connect(sa)\nConnectionRefusedError: [Errno 111] Connection refused\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"/opt/datadog-agent/embedded/lib/python3.11/site-packages/urllib3/connectionpool.py\", line 715, in urlopen\n httplib_response = self._make_request(\n ^^^^^^^^^^^^^^^^^^^\n File \"/opt/datadog-agent/embedded/lib/python3.11/site-packages/urllib3/connectionpool.py\", line 416, in _make_request\n conn.request(method, url, **httplib_request_kw)\n File \"/opt/datadog-agent/embedded/lib/python3.11/site-packages/urllib3/connection.py\", line 244, in request\n super(HTTPConnection, self).request(method, url, body=body, headers=headers)\n File \"/opt/datadog-agent/embedded/lib/python3.11/http/client.py\", line 1298, in request\n self._send_request(method, url, body, headers, encode_chunked)\n File \"/opt/datadog-agent/embedded/lib/python3.11/http/client.py\", line 1344, in _send_request\n self.endheaders(body, encode_chunked=encode_chunked)\n File \"/opt/datadog-agent/embedded/lib/python3.11/http/client.py\", line 1293, in endheaders\n self._send_output(message_body, encode_chunked=encode_chunked)\n File \"/opt/datadog-agent/embedded/lib/python3.11/http/client.py\", line 1052, in _send_output\n self.send(msg)\n File \"/opt/datadog-agent/embedded/lib/python3.11/http/client.py\", line 990, in send\n self.connect()\n File \"/opt/datadog-agent/embedded/lib/python3.11/site-packages/urllib3/connection.py\", line 205, in connect\n conn = self._new_conn()\n ^^^^^^^^^^^^^^^^\n File \"/opt/datadog-agent/embedded/lib/python3.11/site-packages/urllib3/connection.py\", line 186, in _new_conn\n raise NewConnectionError(\nurllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f18d15f1b50>: Failed to establish a new connection: [Errno 111] Connection refused\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"/opt/datadog-agent/embedded/lib/python3.11/site-packages/requests/adapters.py\", line 486, in send\n resp = conn.urlopen(\n ^^^^^^^^^^^^^\n File \"/opt/datadog-agent/embedded/lib/python3.11/site-packages/urllib3/connectionpool.py\", line 799, in urlopen\n retries = retries.increment(\n ^^^^^^^^^^^^^^^^^^\n File \"/opt/datadog-agent/embedded/lib/python3.11/site-packages/urllib3/util/retry.py\", line 592, in increment\n raise MaxRetryError(_pool, url, error or ResponseError(cause))\nurllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=81): Max retries exceeded with url: /nginx_status/ (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f18d15f1b50>: Failed to establish a new connection: [Errno 111] Connection refused'))\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"/opt/datadog-agent/embedded/lib/python3.11/site-packages/datadog_checks/base/checks/base.py\", line 1224, in run\n self.check(instance)\n File \"/opt/datadog-agent/embedded/lib/python3.11/site-packages/datadog_checks/nginx/nginx.py\", line 65, in check\n metrics = self.collect_unit_metrics()\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/opt/datadog-agent/embedded/lib/python3.11/site-packages/datadog_checks/nginx/nginx.py\", line 184, in collect_unit_metrics\n response, content_type, version = self._get_data()\n ^^^^^^^^^^^^^^^^\n File \"/opt/datadog-agent/embedded/lib/python3.11/site-packages/datadog_checks/nginx/nginx.py\", line 215, in _get_data\n r = self._perform_service_check(self.url)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/opt/datadog-agent/embedded/lib/python3.11/site-packages/datadog_checks/nginx/nginx.py\", line 231, in _perform_service_check\n r = self._perform_request(url)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/opt/datadog-agent/embedded/lib/python3.11/site-packages/datadog_checks/nginx/nginx.py\", line 221, in _perform_request\n r = self.http.get(url)\n ^^^^^^^^^^^^^^^^^^\n File \"/opt/datadog-agent/embedded/lib/python3.11/site-packages/datadog_checks/base/utils/http.py\", line 355, in get\n return self._request('get', url, options)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/opt/datadog-agent/embedded/lib/python3.11/site-packages/datadog_checks/base/utils/http.py\", line 419, in _request\n response = self.make_request_aia_chasing(request_method, method, url, new_options, persist)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/opt/datadog-agent/embedded/lib/python3.11/site-packages/datadog_checks/base/utils/http.py\", line 425, in make_request_aia_chasing\n response = request_method(url, **new_options)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/opt/datadog-agent/embedded/lib/python3.11/site-packages/requests/api.py\", line 73, in get\n return request(\"get\", url, params=params, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/opt/datadog-agent/embedded/lib/python3.11/site-packages/requests/api.py\", line 59, in request\n return session.request(method=method, url=url, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/opt/datadog-agent/embedded/lib/python3.11/site-packages/requests/sessions.py\", line 589, in request\n resp = self.send(prep, **send_kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/opt/datadog-agent/embedded/lib/python3.11/site-packages/requests/sessions.py\", line 703, in send\n r = adapter.send(request, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/opt/datadog-agent/embedded/lib/python3.11/site-packages/requests/adapters.py\", line 519, in send\n raise ConnectionError(e, request=request)\nrequests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=81): Max retries exceeded with url: /nginx_status/ (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f18d15f1b50>: Failed to establish a new connection: [Errno 111] Connection refused'))\n"}]

Describe what you expected:

It should be able to read from nginx_status

Steps to reproduce the issue:

Additional environment details (Operating System, Cloud provider, etc): Distributor ID: Ubuntu Description: Ubuntu 18.04.6 LTS Release: 18.04 Codename: bionic root@ns31106921:~# nginx -v nginx version: nginx/1.21.5 (nginx-plus-r26) root@ns31106921:~# sudo datadog-agent status Getting the status from the agent.

=============== Agent (v7.54.1)

Status date: 2024-06-30 00:48:40.724 +03 / 2024-06-29 21:48:40.724 UTC (1719697720724) Agent start: 2024-06-30 00:48:39.329 +03 / 2024-06-29 21:48:39.329 UTC (1719697719329) Pid: 23372 Go Version: go1.21.9 Python Version: 3.11.8 Build arch: amd64 Agent flavor: agent Log Level: info