CMK version: 2.5p12
OS version: Ubuntu 26.04 LTS
Recently migrated all of our Windows hosts across to our upgraded CheckMK instance - we went from 2.3 to 2.5.
The host agents have all been upgraded successfully, and they are monitoring ok. However I have noticed a number of issues related to agent bakery rules that I cannot understand.
Firstly it seems that some of the agent rules dont seem to be targeting hosts, which are explicitly defined in the conditions. E.g. we have an agent rule to deploy windows performance counters for Exchange messaging queues, which are explicitly applied to our 2x Exchange servers. However only one of them appears after baking and signing the agents:
The other issue is that we have another agent rule which deploys the Windows Patchday plugin (which is an extension we deployed from the Exchange and used extensively in previous version of CheckMK), however this doesnt seem to be deploying to all the servers that are targeted (which is all Windows servers), and we are seeing some agent alerts for this saying the patchday check could not be parsed.
Very confused here so any help and troubleshooting steps appreciated!
For the Patchday plugin: before assuming an API problem, check whether the MKP is still active. The Exchange package was built against 2.4.0p8 and has no 2.5 release, so 01_mkp-disable-outdated may have disabled it during the update. The bakery rule stays visible either way — but without the MKP the bakery script is gone, the PowerShell plugin never reaches the hosts, and the check then has nothing to parse.
The plugin should not be disabled as it has no until version set 
If i have a agent baking problem, i would check first on command line with “cmk --debug --force -vvA hostname” to bake an agent for the problem host.
Here i see what plugins are baked into the agent package. If there is something missing then it is more a rule problem.
The bakery rule is not visible if the mkp is not active anymore. The rule is only shown in the section “Unknown rulesets” no where else.
Ok I think the issue with the patchday plugin randomly not working on some of the hosts I ported over is due to the old script file still being present in the plugins folder under C:\ProgramData\checkmk\plugins
I’ve removed this and the alert has gone, just seeing if the new one now deploys correctly - the check is not currently there.
I have resolved the issue of the patchday checks not being parsed, however the plugins do not seem to be deploying to the hosts as configured.
Agents seem to be baking fine, rules are clearly defined and should be deploying plugins, but they are not.
I really struggle with troubleshooting this part of CheckMK so any help is appreciated on where I should be looking for logs etc.
There are two things you can check.
On the CMK server the bake command what i had shown
→ cmk --debug --force -vvA HOSTNAME
Here you should see that the patchday Powershell script is baked into the agent.
Also the agent hash of the baked agent is shown Agent Hash: e1c1dd8232797f03
On the target Windows machine you can start the agent update with.
C:\Program Files (x86)\checkmk\service\check_mk_agent.exe updater -v
Here you should see the same agent hash as already installed or that it will be installed.
If there is a problem or a different hash shown we have some other problems.
Thanks. We have found the issue to be related to the agent updater registration not registering, but we cannot see why.
Now we’ve found the root cause, once we’ve resolved the registration issues, I expect the plugins to fully deploy.
They changed a lot in v2.5 with the way this works.
We deployed the agent using a script, the steps all worked when manually run but for some reason agent updater registration is broken across the board, except on 2 hosts in the entire estate. Very weird.
I have had to open a support ticket about it, will post resolution here.
Ok so what I thought was a complicated issue was once again down to a lack of understanding (and lack of easily available documentation on this particular subject)…
We deployed the updated agent to all our windows servers using a POSH script. At the time, we opted to get the hosts to download the agent from the CMK server directly via the API. We were not aware at the time however, that this would pull down the wrong agent version, as it doesnt include the python modules required for update registration, and its not a bakery version.
We did this with some fairly sound reasons, which was if we upgraded CMK or re-baked the agents, our MSI on the repository wouldnt suddenly be out of date. Seems we didnt do enough reading on the API docs (its a lot for a non-developer!).
So we have had to download the MSI from the bakery, rewrite the script and redo the install logic to use the MSI instead of the API. Having to redeploy this now to all servers.
I do nearly all of my installs via API download. The used code looks like this in Powershell.
$API_URL = "https://$($ServerName)/$($Site)/check_mk/api/1.0"
$headers_stream = @{
'Authorization' = "Bearer $($User) $($Secret)"
'Accept' = 'application/octet-stream'
}
$parameters = @{
"agent_type" = "host_name"
"host_name" = "$($ComputerName)"
"os_type" = "windows_msi"
}
$targetDir = 'C:\tmp' # target location for download
$Install = Join-Path -Path $targetDir -ChildPath 'check_mk_agent.msi'
Invoke-WebRequest -Uri "$API_URL/domain-types/agent/actions/download_by_host/invoke?" -Body $parameters -Method GET -Headers $headers_stream -Outfile $Install
This fetches exactly the build agent for every host. If there is a build agent available 
Does this work if the host doesnt exist already?
For this, my script checks before, if the host exists inside CheckMK. If not it is created inside a specific folder.
# check if host exists and create if not
$newhost = "no"
try {
$response = Invoke-WebRequest -Uri "$API_URL/objects/host_config/$($ComputerName)" -WebSession $WebSession -UseBasicParsing -Headers $headers_json
}
catch [System.Net.WebException] {
$errorResponse = $_.Exception.Response
$statusCode = $errorResponse.StatusCode.value__
if ($statusCode -eq 404) {
Write-Output('Host not existing inside CheckMK - it will be created')
$Body = @{
folder = '~import'
host_name = "$($ComputerName)"
attributes = @{
ipaddress = "$($ipAddressString)"
}
}
$response = Invoke-RestMethod -Method Post -Uri "$API_URL/domain-types/host_config/collections/all" -WebSession $WebSession -UseBasicParsing -Headers $headers_json -Body ($Body | ConvertTo-Json)
Write-Output($response)
$newhost = "yes"
}
}
Then you need to check if $newhost is yes or no and if it is yes you need to have a second fetch statement that pulls the generic agent instead of the baked one.
Yeah thats the issue though, if it pulls down a generic agent, the auto update registration fails, since its missing the python module. The host needs the bakery version to work, since this is a migration from old CMK to new CMK server, so the host does not exist in the CMK server at the time the script pulls the agent to install it.
Going to have to just use the repository version using an SMB share.
With genetic agent I mean a agent build for the root folder with agent update included. You can define to build an agent for a folder and not for a specific host.