Hosts can’t register

Checkmk version: 2.1.0 raw
OS version: openSUSE Leap 15.3

Hello!
When I try to register any of my hosts I get following error:

Request failed with code 500 Internal Server Error: Internal Server Error

cmk-agent-ctl register -vv --hostname ko-lx-server100 --server 192.168.213.200:8000 --site zuhause --user automation --password XXX

INFO [cmk_agent_ctl] starting 
Attempting to register at 192.168.213.200:8000/zuhause. Server certificate details: 

PEM-encoded certificate: 
-----BEGIN CERTIFICATE----- 
MIIC+jCCAeKgAwIBAgIUHbRj/UJtOy9Iu2mnYNy/RrPOjrgwDQYJKoZIhvcNAQEL
…
387UYnhP0071kSrjhr+EzdX2J155vM0vyVoKy43SSs4IgfOd9DWjA/70qR/+ZQ==
-----END CERTIFICATE----- 

Issued by: 
	Site 'zuhause' local CA 
Issued to: 
	zuhause 
Validity: 
	From Thu, 26 May 2022 08:01:18 +0000 
	To 	Tue, 26 Sep 3020 08:01:18 +0000 

Do you want to establish this connection? [Y/n] 
> Y 
DEBUG [reqwest::connect] starting new connection: https://192.168.213.200:8000/ 
DEBUG [reqwest::async_impl::client] response '500 Internal Server Error' for https://192.168.213.200:8000/zuhause/agent-receiver/pairing 
ERROR [cmk_agent_ctl] Error pairing with 192.168.213.200:8000/zuhause 

Caused by: 
	Request failed with code 500 Internal Server Error: Internal Server Error


var/log/agent-receiver/error.log:
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=5000): Max retries exceeded with url: /zuhause/check_mk/api/1.0/root_cert (Caused by NewConnection
Error('<urllib3.connection.HTTPConnection object at 0x7f326f256250>: Failed to establish a new connection: [Errno 111] Connection refused')) 
[2022-05-31 14:02:15 +0200] [2607] [ERROR] Exception in ASGI application 
Traceback (most recent call last): 
  File "/omd/sites/zuhause/lib/python3.9/site-packages/uvicorn/protocols/http/h11_impl.py", line 373, in run_asgi 
  result = await app(self.scope, self.receive, self.send)
….
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=5000): Max retries exceeded with url: /zuhause/check_mk/api/1.0/root_cert (Caused by NewConnection
Error('<urllib3.connection.HTTPConnection object at 0x7f326f10b7c0>: Failed to establish a new connection: [Errno 111] Connection refused'))

Thanks
Oliver

Is the port opened ? You can try a simple telnet.

Yes, I can telnet to the checkmk-Server to port 8000.

The receiver.log on the server reports every try:


[2022-06-01 17:22:33 +0200] [1904] [ERROR] Exception in ASGI application
Traceback (most recent call last):
  File "/omd/sites/zuhause/lib/python3.9/site-packages/uvicorn/protocols/http/h11_impl.py", line 373, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "/omd/sites/zuhause/lib/python3.9/site-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__
    return await self.app(scope, receive, send)
  File "/omd/sites/zuhause/lib/python3.9/site-packages/fastapi/applications.py", line 208, in __call__
    await super().__call__(scope, receive, send)
  File "/omd/sites/zuhause/lib/python3.9/site-packages/starlette/applications.py", line 112, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/omd/sites/zuhause/lib/python3.9/site-packages/starlette/middleware/errors.py", line 181, in __call__
    raise exc from None
  File "/omd/sites/zuhause/lib/python3.9/site-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "/omd/sites/zuhause/lib/python3.9/site-packages/starlette/exceptions.py", line 82, in __call__
    raise exc from None
  File "/omd/sites/zuhause/lib/python3.9/site-packages/starlette/exceptions.py", line 71, in __call__
    await self.app(scope, receive, sender)
  File "/omd/sites/zuhause/lib/python3.9/site-packages/starlette/routing.py", line 580, in __call__
    await route.handle(scope, receive, send)
  File "/omd/sites/zuhause/lib/python3.9/site-packages/starlette/routing.py", line 390, in handle
    await self.app(scope, receive, send)
  File "/omd/sites/zuhause/lib/python3.9/site-packages/fastapi/applications.py", line 208, in __call__
    await super().__call__(scope, receive, send)
  File "/omd/sites/zuhause/lib/python3.9/site-packages/starlette/applications.py", line 112, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/omd/sites/zuhause/lib/python3.9/site-packages/starlette/middleware/errors.py", line 181, in __call__
    raise exc from None
  File "/omd/sites/zuhause/lib/python3.9/site-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "/omd/sites/zuhause/lib/python3.9/site-packages/starlette/exceptions.py", line 82, in __call__
    raise exc from None
  File "/omd/sites/zuhause/lib/python3.9/site-packages/starlette/exceptions.py", line 71, in __call__
    await self.app(scope, receive, sender)
  File "/omd/sites/zuhause/lib/python3.9/site-packages/starlette/routing.py", line 580, in __call__
    await route.handle(scope, receive, send)
  File "/omd/sites/zuhause/lib/python3.9/site-packages/starlette/routing.py", line 241, in handle
    await self.app(scope, receive, send)
  File "/omd/sites/zuhause/lib/python3.9/site-packages/starlette/routing.py", line 52, in app
    response = await func(request)
  File "/omd/sites/zuhause/lib/python3.9/site-packages/fastapi/routing.py", line 219, in app
    raw_response = await run_endpoint_function(
  File "/omd/sites/zuhause/lib/python3.9/site-packages/fastapi/routing.py", line 152, in run_endpoint_function
    return await dependant.call(**values)
  File "/omd/sites/zuhause/lib/python3.9/site-packages/agent_receiver/endpoints.py", line 52, in pairing
    if not (rest_api_root_cert_resp := get_root_cert(credentials)).ok:
  File "/omd/sites/zuhause/lib/python3.9/site-packages/agent_receiver/checkmk_rest_api.py", line 100, in get_root_cert
    return _forward_get(
  File "/omd/sites/zuhause/lib/python3.9/site-packages/agent_receiver/checkmk_rest_api.py", line 76, in _forward_get
    return requests.get(
  File "/omd/sites/zuhause/lib/python3.9/site-packages/requests/api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "/omd/sites/zuhause/lib/python3.9/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/omd/sites/zuhause/lib/python3.9/site-packages/requests/sessions.py", line 529, in request
    resp = self.send(prep, **send_kwargs)
  File "/omd/sites/zuhause/lib/python3.9/site-packages/requests/sessions.py", line 645, in send
    r = adapter.send(request, **kwargs)
  File "/omd/sites/zuhause/lib/python3.9/site-packages/requests/adapters.py", line 519, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=5000): Max retries exceeded with url: /zuhause/check_mk/api/1.0/root_cert (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f709ceb5760>: Failed to establish a new connection: [Errno 111] Connection refused'))

Can you use the option trust-cert ?
Also, what is the systemd version on your system ?

Hello David,
unfortunately --trust-cert changes nothing.
The systemd is version 246.16-150300.7.45.1

Hi @Kyman and welcome at the checkmk community.

Can you please check if the port 5000 on the monitoring server is bind to a specific IP instead of localhost?

1 Like

Hello Tosh,
thanks for your warm welcome!
And your hint does the trick.
The Port was bound to the external IP of the Server.
Thanks!

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.