Cmk-agent-ctl register multiple hosts registration

CMK version:
OMD - Open Monitoring Distribution Version 2.2.0p22.cre

OS version:
Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster

Error message:

I have checkmk server running on a Vm and am monitoring a remote VM. The way checkmk server setup is it’s got multiple hosts added with same IP (i.e remote server). Only the hostname different but all pointing to same remote server IP. Now when I trying to register the remote server with checkmk server via

sudo cmk-agent-ctl register --server :8000 --site monitoring --user cmkadmin --hostname hostname1
sudo cmk-agent-ctl register --server :8000 --site monitoring --user cmkadmin --hostname hostname2
sudo cmk-agent-ctl register --server :8000 --site monitoring --user cmkadmin --hostname hostname3
sudo cmk-agent-ctl register --server :8000 --site monitoring --user cmkadmin --hostname hostname4

and when checking

:~$ sudo cmk-agent-ctl status
Version: 2.2.0p22
Agent socket: operational
IP allowlist: any

Connection: /monitoring
UUID: e3b23413-1e82-452a-90d6-9c0c0eac1498
Local:
Connection mode: pull-agent
Connecting to receiver port: 8000
Certificate issuer: Site ‘monitoring’ agent signing CA
Certificate validity: Thu, 29 Feb 2024 04:31:47 +0000 - Wed, 28 Feb 2029 04:31:47 +0000
Remote:
Connection mode: pull-agent
Hostname: hostname4

it lost configs for hostname1 ,hostname2 and hostname3

how can I achieve multiple hosts registration with same IP. Reason for why it was setup like this is due to customer scripts depending on each microservice in /usr/lib/check_mk_agent/local/

It may be a stupid setup but am looking to improve this by registering a single time and grouping services to folders … is it possible at all ?

Regards
Matt
Output of “cmk --debug -vvn hostname”: (If it is a problem with checks or plugins)

That is completely normal, you can only register your host to a second site with a different name. On one site you can only have one registration at the same time.

1 Like

I believe that the intention is not to register to a second site but to add additional hosts at the same Checkmk site that are targeting the same IP address (= same agent). Actually I’m having exactly this issue since I upgraded the agent to 2.1.

The registration allows one hostname only, no alias. After registration of one hostname Checkmk’s request to the other hostnames receive a TLS error. If you register another hostname the first hostname gets the same TLS error instead.

Regards,
Tobias Crefeld.

As i said that is as it should be.
It is only possible to register one host one time to the same site.
If you want to query the same agent under different names you need a second or third instance of CMK that fetches the results for the different hostnames.

Do you know a way to deregister a host?

sudo cmk-agent-ctl delete CONNECTION

with the CONNECTION as shown by cmk-agent-ctl status (something like hostname:8006/mysite). I think the UUID shown in the status command also works.

Thanks - I used delete-all instead.

But it seems that this wasn’t enough. Meanwhile I found a “Remove TLS registration” at the respective host configurations.

Regards,
Tobias Crefeld.

I believe that the intention is not to register to a second site but to add additional hosts at the same Checkmk site that are targeting the same IP address (= same agent). Actually I’m having exactly this issue since I upgraded the agent to 2.1

Yes correct. Was this after upgrading to 2.1 ?

@andreas-doehler / @MarsellusWallace Is there a way to group services for a host and put each service group under certain names ?

  1. When deregistering a host, multiple steps are needed:
  • (At host) cmk-agent-ctl --delete-all --enable-insecure-connections (second param may differ, I’m currently not at any system, but it’s needed because as long as it’s not used, you cannot pull without tls
  • if just one connection should get deleted, use param “–delete CONNECTION_UUID” - but beware that just this connection gets removed and as long as at least one other connection exists, pull without tls is not possible
  • (At site) from host properties, open host menu and select to remove tls registration
  1. Services from same host can only be shown at another host by configuring cluster hosts (just with one node each) and defining “clustered services for overlapping clusters” accordingly - search for clustered services in our official documentation.

I hope this helps.

BR,
Marsellus W.

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.