Meanwhile I had a look to the file /var/lib/check_mk_agent/cmk-update-agent.log on one of the monitored hosts. There we found an error entry exactly in that case where a new agent hash has been detected.
The system calls cmk_update_agent.py, update the cmk_update_agent.state etc. with the new received hash and raises the following exception and do nothing more! Means that my custom files are not transferred.
2020-05-29 18:37:38,270 DEBUG: Starting Check_MK Agent Updater v1.5.0p11
2020-05-29 18:37:38,271 DEBUG: Successfully read /etc/cmk-update-agent.state.
2020-05-29 18:37:38,272 DEBUG: Successfully read /etc/check_mk/cmk-update-agent.cfg.
2020-05-29 18:37:38,273 DEBUG: Starting manual update mode.
2020-05-29 18:37:38,273 INFO: Getting target agent configuration for host 'PROD-FE1' from deployment server
2020-05-29 18:37:38,283 DEBUG: Fetching content (using requests): http://xxxxxxxxxxx/vine/check_mk/deploy_agent.py
2020-05-29 18:37:38,306 DEBUG: Response from deployment server:
AgentAvailable: True
TargetHash: df49102dcdfa8e2b
Signature: 2d2d2d2d2d.....
2020-05-29 18:37:38,307 DEBUG: Successfully read /etc/cmk-update-agent.state.
2020-05-29 18:37:38,311 DEBUG: Saved deployment status to /etc/cmk-update-agent.state.
2020-05-29 18:37:38,311 INFO: Target state (from deployment server):
2020-05-29 18:37:38,311 INFO: Agent Available: True
2020-05-29 18:37:38,311 INFO: Signatures: 1
2020-05-29 18:37:38,311 INFO: Target Hash: df49102dcdfa8e2b
2020-05-29 18:37:38,319 DEBUG: Fetching content (using requests): http://xxxxxxxxxxxx/vine/check_mk/deploy_agent.py
2020-05-29 18:37:38,480 INFO: Downloaded agent has size 9631839 bytes.
2020-05-29 18:37:38,480 INFO: Skipping signature check (as you requested).
2020-05-29 18:37:38,480 DEBUG: Successfully read /etc/cmk-update-agent.state.
2020-05-29 18:37:38,483 DEBUG: Saved deployment status to /etc/cmk-update-agent.state.
2020-05-29 18:37:38,547 DEBUG: Caught Exception:
Traceback (most recent call last):
File "/bauwelt-1.5.0p11/enterprise/agents/plugins/cmk_update_agent.py", line 1215, in _install_agent
File "/bauwelt-1.5.0p11/enterprise/agents/plugins/cmk_update_agent.py", line 1233, in _invoke_installer
File "/bauwelt-1.5.0p11/enterprise/agents/plugins/cmk_update_agent.py", line 1252, in _install_agent_linux_rpm
File "/bauwelt-1.5.0p11/enterprise/agents/plugins/cmk_update_agent.py", line 1320, in _invoke_unix_pkg_manager
AttributeError: 'NoneType' object has no attribute 'read'
2020-05-29 18:37:38,548 ERROR: Failed installing Check_MK agent: 'NoneType' object has no attribute 'read'.
Keeping /tmp/check-mk-agent-jnFbih for error diagnosis.
2020-05-29 18:37:38,548 DEBUG: Caught Exception:
Traceback (most recent call last):
File "/bauwelt-1.5.0p11/enterprise/agents/plugins/cmk_update_agent.py", line 1782, in main
File "/bauwelt-1.5.0p11/enterprise/agents/plugins/cmk_update_agent.py", line 670, in run
File "/bauwelt-1.5.0p11/enterprise/agents/plugins/cmk_update_agent.py", line 1029, in _run_mode
File "/bauwelt-1.5.0p11/enterprise/agents/plugins/cmk_update_agent.py", line 1077, in _do_update_as_command
File "/bauwelt-1.5.0p11/enterprise/agents/plugins/cmk_update_agent.py", line 1175, in _do_update_agent
File "/bauwelt-1.5.0p11/enterprise/agents/plugins/cmk_update_agent.py", line 1215, in _install_agent
File "/bauwelt-1.5.0p11/enterprise/agents/plugins/cmk_update_agent.py", line 1233, in _invoke_installer
File "/bauwelt-1.5.0p11/enterprise/agents/plugins/cmk_update_agent.py", line 1252, in _install_agent_linux_rpm
File "/bauwelt-1.5.0p11/enterprise/agents/plugins/cmk_update_agent.py", line 1320, in _invoke_unix_pkg_manager
AttributeError: 'NoneType' object has no attribute 'read'
2020-05-29 18:37:38,548 ERROR: 'NoneType' object has no attribute 'read'
The function in cmk_update_agent, around line 1320 is:
def _invoke_unix_pkg_manager(self, command):
if self._config.verbose_level:
stdout = sys.stdout
else:
stdout = open(os.devnull, "w")
proc = subprocess.Popen(
command,
stdin=open(os.devnull),
stdout=stdout,
stderr=subprocess.STDOUT,
close_fds=True,
env=self._env.sub_env)
status = proc.wait()
if status:
**1320: raise Exception("Error during installation of package:\n%s" % proc.stdout.read())**
Additionally I think if proc.wait() return without a status code, it indicates that the subprocess has not terminated. But in the other case a status indicated not automatically an error.
Do I have found some bugs in the Check_MK file cmk-update-agent.py ?