Closed hb9hnt closed 1 year ago
Hi @hb9hnt and thanks for reporting. I actually realized, that this is a regression and the fix is already in #382. It will most likely be released with the next release.
If you want to do a hotfix, you can look at this commit: ef861c2bdb5c46dab4e2970e1579781ff6452a62
Hey @robin-checkmk
Sorry for my late reaction, I was on holiday. I will test the new release this week. Thanks for the fix :)
No worries @hb9hnt most of the people around here do this in their free time, so there is no rush at all. :) Could you verify the fix?
Hey @robin-checkmk - we still ran into those problems. The main issue was that the variable checkmk-agent-server
is used for the server that runs the instance where the server should be registered and for API calls to the central instance (if the config is managed centrally). IMHO there should be two distinct variable for this.
I discussed the details with @lgetwan
There was a regression I fixed in #416. With that fix, registration on remote sites works again. It is available with the current release 3.2.0
.
Describe the bug In a distributed monitoring setup the registration tasks fails on the second run of the agent role (while it successfully registers the hosts on the first run). Setup: The hosts are put in a folder that has its monitoring set to a remote instance.
What works: When the role is run for the first time the hosts are successfully registered and turn up on WATO. What does not work: The role fails when it is run a second time without any force option set to true. What I would expect to happen: The role should succeed with no changes since the host is already registered from the first run.
Component Name
Component Name: agent role, this task fails: https://github.com/Checkmk/ansible-collection-checkmk.general/blob/73f2475a39a511220b86a5aa1dd6ea0d709d8786/roles/agent/tasks/Linux.yml#L97
Ansible Version
Checkmk Version and Edition
Collection Version
To Reproduce Setup:
checkmk_agent_folder
is set to a folder which has the option "Monitored on site" to the remote site.checkmk_agent_site
andcheckmk_agent_server
are set to the host and name of the main site.Expected behavior
The role should also successfully run the second time but with no change for registration because the host is already registered.
Actual behavior The task fails the second time with the following output (with some names redacted):
Minimum reproduction example
It's not possible to provide a minimal reproduction example because you need a distributed setup with a folder set up as described above. However, if you have this the following example should reproduce the problem: