Issue running cmk-agent-ctl.exe" register with error Request failed with code 401 Unauthorized:

CMK version: Checkmk Raw Edition 2.1.0-2022.05.27
OS version: docker CE

Error message:

After I click Y to register tls I get the below error. I am using the automation account and my password is correct!

Do you want to establish this connection? [Y/n]
> Y
[2022-06-01 16:52:46.689883 +10:00] ERROR [cmk_agent_ctl] src\main.rs:29: Error pairing with checkmk:443/cmk

Caused by:
    Request failed with code 401 Unauthorized: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
    <html><head>
    <title>401 Unauthorized</title>
    </head><body>
    <h1>Unauthorized</h1>
    <p>This server could not verify that you
    are authorized to access the document
    requested.  Either you supplied the wrong
    credentials (e.g., bad password), or your
    browser doesn't understand how to supply
    the credentials required.</p>
    </body></html>

Do not explicitely specify the port of the web interface/REST API (in your case 443). Use the port of the Agent Receiver which is 8000 or 8001 instead or leave the port blank for auto detection.

(There have been lots of misunderstandings on this ports thing, I am in progress of updating the articles for the Linux and Windows agent)

1 Like

I get this with no port, or port 800 and 8001

Attempting to register at checkmk.redacted.com:8000/cmk. Server certificate details:

[2022-06-01 18:07:25.153483 +10:00] ERROR [cmk_agent_ctl] src\main.rs:29: the handshake failed: error:1408F10B:SSL routines:ssl3_get_record:wrong version number:ssl\record\ssl3_record.c:332:

Caused by:
0: error:1408F10B:SSL routines:ssl3_get_record:wrong version number:ssl\record\ssl3_record.c:332:
1: error:1408F10B:SSL routines:ssl3_get_record:wrong version number:ssl\record\ssl3_record.c:332:

Is the Agent Receiver running? Is port 8000 available from the host where you run cmk-agent-ctl register? To check for Agent Receiver, run (as site user):

omd config show | grep AGENT_RECEIVER

To check whether the host can reach the Agent Receiver, run on the host:

openssl s_client -connect cmkserver:8000

DOH I forgot I had set a custom port for agent receiver as i had a conflict for 8000 on my docker host. I was using 8101 so after i set this it worked perfectly. It would be good if after you run the cmk-agent-ctl register you get a positive validation in the command output like OK or Registered!

thanks for your support.

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.