Cmk-agent-ctl register, Docker and remapped port

TL;DR - Cannot get cmk-agent-ctl register to connect to a site running in a Docker container and using a different port ( -p 8010:8000 )

Edit: Smashed it! The command that works for my instance is

cmk-agent-ctl register --hostname oak --server oak:8010 --site cmk --user cmkadmin

The hint in the docs was at https://docs.checkmk.com/latest/en/managing_docker.html " 2.3. Setting your own site ID"

… the ID of the site created in the container will be cmk.

That’s the site name to use when registering, not the container name.

============ original query ============

Thank you for help resolving this.

CMK version:

check-mk-raw:2.1.0p19

OS version:

Debian Bullseye X86_64,

root@oak:~# uname -a
Linux oak 5.10.0-19-amd64 #1 SMP Debian 5.10.149-2 (2022-10-21) x86_64 GNU/Linux
root@oak:~# docker version
Client: Docker Engine - Community
 Version:           20.10.22
 API version:       1.41
 Go version:        go1.18.9
 Git commit:        3a2c30b
 Built:             Thu Dec 15 22:28:22 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.22
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.18.9
  Git commit:       42c8b31
  Built:            Thu Dec 15 22:26:14 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.13
  GitCommit:        78f51771157abb6c9ed224c22013cdf09962315d
 runc:
  Version:          1.1.4
  GitCommit:        v1.1.4-0-g5fd4c4d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
root@oak:~#

Docker command to start - note that port 8000 is already in use so I have mapped that to 8010. The site is running and I can connect/login using http://oak


docker container run \
  -dit -p 80:5000 -p 8010:8000 \
  --tmpfs /opt/omd/sites/cmk/tmp:uid=1000,gid=1000 \
  -v checkmkmon:/omd/sites --name checkmkmon \
  -v /etc/localtime:/etc/localtime:ro \
  --restart always checkmk/check-mk-raw:2.1.0p19

Error message:

root@oak:~# cmk-agent-ctl register --hostname oak --server oak:8010 --site checkmk --user cmkadmin
Attempting to register at oak:8010/checkmk. Server certificate details:

PEM-encoded certificate:
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----

Issued by:
        Site 'cmk' local CA
Issued to:
        cmk
Validity:
        From Mon, 16 Jan 2023 21:15:32 +0000
        To   Sat, 19 May 3021 21:15:32 +0000

Do you want to establish this connection? [Y/n]
> y

Please enter password for 'cmkadmin'
> 
ERROR [cmk_agent_ctl] Error pairing with oak:8010/checkmk

Caused by:
    Request failed with code 404 Not Found: Not Found
root@oak:~# 

Port seems to be active:

root@oak:~# telnet oak 8010
Trying 192.168.1.80...
Connected to oak.localdomain.
Escape character is '^]'.
^]
telnet> close
Connection closed.
root@oak:~# ss -tulpn | grep 8010
tcp   LISTEN 0      4096         0.0.0.0:8010       0.0.0.0:*    users:(("docker-proxy",pid=4097273,fd=4))                
tcp   LISTEN 0      4096         0.0.0.0:8000       0.0.0.0:*    users:(("docker-proxy",pid=1880101,fd=4))                
tcp   LISTEN 0      4096            [::]:8010          [::]:*    users:(("docker-proxy",pid=4097280,fd=4))                
root@oak:~# 

root@oak:~# docker ps --last 1
CONTAINER ID   IMAGE                           COMMAND                  CREATED             STATUS                       PORTS                                                                                        NAMES
06f2c63e7d85   checkmk/check-mk-raw:2.1.0p19   "/docker-entrypoint.…"   About an hour ago   Up About an hour (healthy)   6557/tcp, 0.0.0.0:80->5000/tcp, :::80->5000/tcp, 0.0.0.0:8010->8000/tcp, :::8010->8000/tcp   checkmkmon
root@oak:~# 

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.