The registration is done using the Agent Controller cmk-agent-ctl
, which provides a command interface for configuring the connections. You can display command help with cmk-agent-ctl help
, also for specific available subcommands, for example with cmk-agent-ctl help register
.
Whether the host is configured for the pull mode or the push mode makes no difference for the command examples. The Agent Receiver tells the Agent Controller in which mode it should operate during registration.
Now go to the host that is to be registered. Here you have to make a request to the Checkmk site with administrator rights:
cd "C:\Program Files (x86)\checkmk\service"
cmk-agent-ctl.exe register --hostname mynewhost --server cmkserver --site mysite --user username
The host name following the --hostname
option must be exactly the same as it was when it was created in the Setup. The --server
and --site
options specify the name of the Checkmk server and the site. The server name may also be the IP address, the site name (here mysite
) corresponds to the one you see in the URL path for the web interface. The options are completed by the name and password used by the automation user. If you omit the --password
option, the password will be requested interactively.
Caution, trap for the unwary: If you primarily administer Unix machines, you are used to enclosing paths or parameters with spaces or special characters in single quotes (apostrophes, 0x27
). Windows interprets this character as part of the call — in this case the password — and the registration will fail. Use double quotes (quotation marks, 0x22
) instead.
If the specified values were correct, you will be asked to confirm the identity of the Checkmk site to which you want to connect. For clarity here, we have abbreviated the server certificate to be confirmed:
Attempting to register at cmkserver:8000/mysite. Server certificate details:
PEM-encoded certificate:
---BEGIN CERTIFICATE---
MIIC6zCCAdOgAwIBAgIUXbSE8FXQfmFqoRNhG9NpHhlRJ40wDQYJKoZIhvcNAQEL
[...]
nS+9hN5ILfRI+wkdrQLC0vkHVYY8hGIEq+xTpG/Pxw==
---END CERTIFICATE---
Issued by:
Site 'mysite' local CA
Issued to:
localhost
Validity:
From Thu, 10 Feb 2022 15:13:22 +0000
To Tue, 13 Jun 3020 15:13:22 +0000
Do you want to establish this connection? [Y/n]
> Y
Confirm with Y
to complete the process.
If no error message is displayed, the encrypted connection will have been established. All data will now be transmitted in compressed form via this connection.
If you want to disable the interactive check of the certificate—for example to fully automate the registration—you might use the additional parameter --trust-cert
. The transferred certificate will be automatically trusted in this case. Keep in mind that you should take other measures to verify the integrity of the certificate. This can be performed (manually or scripted) by inspecting the file /var/lib/cmk-agent/registered_connections.json
.