I apologize up front if this has already been answered, but I tried searching the forums and I’m not what keywords to use to find the results. I have a custom check that I built but I need a bakery rule to control what directory it is using when performing the local check. I have the bakery rule configured to make an entry on the hosts “check_mk.bakery.yml” file, so I feel I have everything configured on the checkmk side, but I’m unsure how to pull that information into my check when it runs in Windows. I see in a Linux check you can do a conf.get(“varname”), is there something similar to pull in the variable using PowerShell?
Here are some snippets from my configuration
WATO Bakery Config File
def _valuespec_tmp_directory():
return Dictionary(
title=_("Temp File Count (Windows)"),
help=_("This will deploy my example plugin."),
elements=[
("tmpdirectory", TextAscii(
title=_("Directory to monitor the count of temp files"),
allow_empty=False,
)),
Bakery File
class TmpDirectoryConfig(TypedDict, total=False):
interval: int
tmpdirectory: str
def get_tmp_directory_windows_config(conf: TmpDirectoryConfig) -> WindowsConfigGenerator:
yield WindowsConfigEntry(path=["tmp_directory", "tmpdirectory"], content=conf["tmpdirectory"])
Host check_mk.bakery.yml File
global:
enabled: true
install: true
port: 6556
tmp_directory:
enabled: true
tmpdirectory: C:\Windows\Temp
I could just use PowerShell to scrape the information out of the “check_mk.bakery.yml”, but this didn’t feel like the right path. Thanks for any advice!