Admins often forget to set downtimes, when they “just reboot” a server, so I created a simple systemd service that makes a host set itself into a short downtime on reboots.
Maybe this is also useful for others…
Edit this file with your CMK enviroment settings for URL, instance, user and secret. Add a downtime comment and set the desired length of the downtime.
Then save it to /etc/systemd/system/set_cmk_downtime.service.
Reload systemd “systemctl daemon-reload” and enable/start the service “systemctl enable --now set_cmk_downtime.service”
The service assumes the system’s short hostname (without domain) is the same as the hostname in CMK. If not you have to manually configure the hostname.
Good idea - I suppose in CEE environments using the bakery, one could also pull the name that the host has in checkmk from the cmk-update-agent.state
something like:
grep -Po “(?<=host_name’: ‘)([^’]*)” /etc/cmk-update-agent.state
suggestions for easier regexes are welcome
did you build a limited role for the automation_user?
May I offer another suggestion here: Our brand new Ansible Collection features a downtime module, which enables you to easily schedule downtimes during update runs.
I see your use case and situation, just want to offer another angle here.