Windows Update Check for CheckMK

Hi CheckMK Community,

as part of our Community work, we are publishing our PowerShell written Windows Update Check now as Open Source Plugin for everyone.
It is completely new written and you can set all kind of warn and crit levels for your Windows Updates.
We have this Check Running since 2023 on all kind of Windows Systems, now feel free to use it too.
We tried to remove our OEM Branding for the end Users as good as possible.

Have fun!

Github Repo:

#Powered by K&P Computer - www.kpc.de


Available .mkp Package Releases:

CheckMK Exchange:


Windows Update Checks for CheckMK

Features:

  • Check for available Windows Updates (Important and Optional, intelligence updates will be shown under optional updates)
  • Checking for available Windows Updates sorted by Severity
  • Individual WARN/CRIT Level settings for each type of Updates (Mandatory, Critical, Important, Moderate, Low, Unspecified Severity)
  • Pending Reboot Check after Update Installation with WARN/CRIT Level Settings
  • CRIT Error if Update Search does not work for a while (Windows update not activated, WSUS Problem etc..)
  • Showing all available Updates in Detailed Summary
  • Check for Windows Update History. Shows the last time when this System installed an Windows Update and also the List of up to the last 80 installed updates in the summary details. (Intelligence Updates are excepted)
  • Warn/Crit level Settings if the System did not install any update during the last X days.
  • Included in Agent Rules for Agent bakery
  • No VBS Scripts anymore, only Powershell will be used
  • Tested with Windows 2012R2/2016/2019/2022

Added default Agent execution Settings for the Windows Agent Plugin (Agent Bakery):

  • Default cache interval of 3 Hours
  • Default asynchronous execution
  • Default execution timeout of 1 hour (long time needet for some older systems sometimes)

If you are not using the CheckMK agent bakery or if you are working with CheckMK Raw Edition, apply the following Settings to your check_cmk.user.yml

%ProgramData%\checkmk\agent\check_mk.user.yml

plugins:
    enabled: yes
    execution:
    - pattern     : '$CUSTOM_PLUGINS_PATH$\windows_updates_kpc.ps1'
      async       : yes
      run         : yes
      cache_age   : 3600
      timeout     : 3600

Screenshots:

image

image

4 Likes

The file header currently states:

# Unauthorized copying of this file, via any medium is strictly prohibited
# Proprietary and confidential

do you want to change that to make this a proper release :slight_smile: ?

Yes, i changed it everywhere to GPL i guess… :smiley:

2 Likes

Buenas,
¿Cómo puedo descargar el archivo powershell? Imagino que sin ese powershell, aunque instale y habite el mkp, no funcionará.
Gracias.

@Aurex, pardon, Sólo hablo un poco de español:

Muchas gracias. Se agradece tu esfuerzo.

Ya lo tengo funcionando.

1 Like

Exciting News: CheckMK 2.4 is Here! :tada:

Hi everyone,

The latest version of CheckMK—2.4—has officially arrived! :rocket:

To keep up with this fresh update, I’ve migrated and uploaded the newest Windows Update check to GitHub. Before I push it to the CheckMK Exchange, I’d love for some extra testing to ensure everything runs smoothly.

If you’re already using the previous version, be sure to remove all existing rules and .mkp files before installing the updated plug-in. For newcomers, there’s no extra setup required—just install and go!

Best of all, everything now runs seamlessly with the new CheckMK API. :dart:

Check it out and give it a spin: Windows Update Plugin v1.0.4

Looking forward to your feedback! :blush:

3 Likes

Hi Matthias

everything seems fine except for this error in the agent configurations page:

Failed to render value:
True
Traceback (most recent call last):
File “/omd/sites/sitexxx/lib/python3/cmk/gui/cee/agent_bakery/_misc.py”, line 291, in _describe_agent_configuration
totext = rulespec.valuespec.value_to_html(value)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/omd/sites/sitexxx/lib/python3/cmk/gui/valuespec.py”, line 6725, in value_to_html
return self._valuespec.value_to_html(self.to_valuespec(value))
^^^^^^^^^^^^^^^^^^^^^^^^
File “/omd/sites/sitexxx/lib/python3/cmk/gui/utils/rule_specs/legacy_converter.py”, line 373, in _remove_agent_config_match_type_key
raise TypeError(value)
TypeError: True

Can you please check that?

Hi @hansjoerg6790 ,

did you remove the rules and mkps from the old plugin before installing and configuring the new one?
I did not develop the “Rule Migration” from old api to new wato api, thats why it doesnt work out of the box, with just updating the Package.

Hi Matthias I did see that and removed the old rules and created the new ones.
Let me check for the agent rule and then I’ll let you know!

thanks for your work really appreciate it

still not working. should I try to bake the agents anyway and see what happens?

Which CheckMK Version do you use and on which Step exactly does this issue occur? We already tested with some of our customers but for now i cannot replicate this issue on my system.

Hi Matthias
we use Checkmk Enterprise Edition 2.3.0p26

I get th error when going to
https://monitoring.xxx.xx/sitexxx/check_mk/wato.py?mode=agents

there I see above mentioned error.

Hi @hansjoerg6790
this still looks like, that the agent rule was not deleted before changing the mkp and checkmk tries to migrate the rules.

I guess there is no way with the gui to fix that. Only solution would be to go back to the old version and check if you missed any rule to delete with the old plugin. With 2.3.0p26 both versions of the Windows Update check should work, so you can delete the new rules and packages and go back to the old one to check if you missed some rule to delete.

Hi Matthias!
I baked the agents no and the display error is gone!
thanks for your support!

1 Like

Hello,
i use checkmk 2.4.0P8 and installed 1.0.5 of this extension. There is no way to drop the windows_updates_kpc.ps1 to the client via bakery.
The rules are created.
or is it not compatible with the bakery?

Hi @Christian1
The Ruleset for the Bakery is “Windows Updates (Agent Plugin)”

after update from an old version to the new ones, you need to create each rule new (deleting and creating again, no cloning)
After that you should be able to bake the agent again.

I guess the rule migration is just some code, but could not implement this correctly until now.
The issue is here:

But if you create each rule again and bake the agents, everything should be working fine. After creating rules, you should not notice anything about it for any future update. The problem is just the migration of the rulesets from old to new checkmk api.

This morning i did it again.
i delete windows update history rule, windows update service rule and agent rule.
apply changes
bake agents
disable and remove plugin
apply changes

now the fresh installation:
upload and enable the plugin
apply changes
create service rule for windows update, update history and agent plugin
apply changes
bake agents
the server got the agent update but there is no powershell script in plugin folder.

what am I forgetting?

@Christian1 i noticed some problem with the mkp package itself. I didnt find the bug for a while and now i just created the .mkp again with the lastest checkmk version and now the Powershell Script will be applied again to the agent with the bakery.

New Package 1.0.6 is uploaded now on github and checkmk exchange and will be available after approval.

Sorry for the long delay, I’ve had very limited resources lately to take care of my open source projects.
It looks like there was indeed an issue with version 1.0.5 where the agent was missing in the Bakery. During troubleshooting I found that the code itself seemed fine.
:backhand_index_pointing_right: Release Release 1.0.6 · matthias1232/kpc_windows_updates · GitHub
I’ve now created a new .mkp package with the exact same code but built against a newer CheckMK version.
I just tested the package with 2.4.0p16, and both the PowerShell script and the user config YAML are correctly included again.
After the agent update, the following files should be present:

- C:\ProgramData\checkmk\agent\plugins\windows_updates_kpc.ps1
- C:\ProgramData\checkmk\agent\bakery\check_mk.bakery.yml

The YAML file should contain:

plugins:
  enabled: true
  execution:
  - async: true
    cache_age: 10800
    pattern: $CUSTOM_PLUGINS_PATH$\windows_updates_kpc.ps1
    timeout: 3600

Best regards,