Version: 2.2.0p9, OS: windows, Update error: Failed to write state to 'C:\ProgramData\checkmk (...)

CMK version: 2.2.0p21 / Appliance - Enterprise Edition

Error message: Version: 2.2.0p21, OS: windows, Update error: Failed to write state to 'C:\ProgramData\checkmk\agent\config\cmk-update-agent.state’WARN , Last update: Feb 01 2024 12:45:12, Agent plugins: 1, Local checks: 0

Hi,
since updating to 2.2.0p21 we have a lot of Windows Servers with the above warnings. These warnings are either resolved throughout the day without doing anything and reappear some hours/days later or we just reinstall the client with the same result. We tried uninstalling and then manually deleting the C:\ProgramData\checkmk folder before reinstalling, but that’s not it either. There does not appear to be any rhyme or reason for these warnings to come and go like they do and when they do. Any help how to tackle this issue would be much appreciated.

We use these commands to register the servers:

C:\Program Files (x86)\checkmk\service\cmk-agent-ctl.exe’ -v register --hostname hostname --server server --site site --user automation --password password --trust-cert

C:\Program Files (x86)\checkmk\service\check_mk_agent.exe’ updater register -s site -i name -H hostname -p https -U automation -S password -v

A “check_mk_agent.exe updater -v” on a server that currently shows that warning shows:

Starting Update mode as plugin.
Getting target agent configuration for host ‘hostname>’ from deployment server
Target state (from deployment server):
Agent available: True
Signatures: 2
Target hash: 2ae3d5af1b0a2d31
Agent 2ae3d5af1b0a2d31 already installed.
<<<cmk_update_agent_status:sep(0)>>>
{“last_check”: 1710318609.0748808, “last_update”: 1706787912.0, “aghash”: “2ae3d5af1b0a2d31”, “pending_hash”: null, “update_url”: “url”, “trusted_certs”: {“0”: {“corrupt”: false, “not_after”: “20250927105549Z”, “signature_algorithm”: “sha512WithRSAEncryption”, “common_name”: “default”}}, “error”: null}

(The warning stays after this.)

Did you already restarted the Checkmk agent windows service ?

Yes, we already restarted the service as well. Same procedure: Error goes away for a while and reappears hours or days later.

Are you running any antivrus on this system and can disable this for a test and let us know if the error happens again ?

Hi, we are running an antivirus but after thorough checks that’s definitely not the cause either.

If you look at the agent_updater.log , it will have a similar message:

PermissionError: [WinError 5] Access is denied:

Can you try to disable temporary AV and any third party software which are accessing the Windows agent “C:\ProgramData\checkmk” folder Or disable monitoring in the folder?
We have a suspicion that Windows Agent Updater can’t access own and temporary file because the file is busy or locked.

If you are using an antivirus or 3rd party software which are scanning agent folders, then you can exclude them as well: https://checkmk.atlassian.net/wiki/spaces/KB/pages/9472048/Antivirus+exclusions+for+Checkmk+agents+and+servers