How to change default port for checkmk linux agent 2.1 version

On systemd systems the dataflow is as follows:

  1. The systemd service cmk-agent-ctl-daemon.service listens on TCP port 6556 (by default).
  2. If that daemon decides to call the checkmk agent, it talks into the local unix domain socket /run/check-mk-agent.socket.
  3. That socket is controlled by the systemd socket unit check-mk-agent.socket.
  4. If something “happens” on that socket, systemd starts the service unit check-mk-agent@.service which then in turn runs the agent.

To change the listening port from 6556 to 16556 you must create (or edit) the file /var/lib/cmk-agent/cmk-agent-ctl.toml on the monitored host and add this line:

pull_port = 16556

After that, do a systemctl restart cmk-agent-ctl-daemon.service.

Unfortuntely, this is not documented very well.

Usually the file /var/lib/cmk-agent/cmk-agent-ctl.toml is maintained by the agent bakery.

3 Likes