Local-check can't find window with specified name

CMK version:
Checkmk Raw Edition 2.4.0p14
OS version:
Windows Server 2016
Error message:
Problem with running local checks which finds windows with specified name. If it’s opened i should get 0 OK and 2 CRIT when it is closed. Script runs perfectly if it is runned from command line or powershell, but from checkmk it always returns CRIT.
I already tried to change Log On account of checkk service to Administrator with no luck.
I created two seperate script, one is powershell, one is batch. Both scripts are workin fine from console.

batch:

@echo off
set CMK_VERSION="2.3.0p26"
setlocal enabledelayedexpansion

set "windowTitle=YourWindowTitle"
set /a count=0

for /f "tokens=*" %%A in ('tasklist /v /fo csv ^| find /i "%windowTitle%"') do (
    set /a count+=1
)

if %count% lss 1 (
    echo 2 WindowTest - CRIT - No opened windows with title: "%windowTitle%"!
) else (
    echo 0 WindowTest - OK - Windows with "%windowTitle%": %count%
)

endlocal

Powershell:

if ((Get-Process cmd | Where-Object { $_.MainWindowHandle -ne 0 -and $_.MainWindowTitle -match 'YourWindowTitle' }).Count -ne 1) {Write-Output "2 WindowTest - CRIT - Processes match count not 1"} else {Write-Output "0 WindowTest - OK - Process count 1"}

Output of “cmk --debug -vvn hostname”: (If it is a problem with checks or plugins)

value store: loading from disk
Checkmk version 2.4.0p14
+ FETCHING DATA
  Source: SourceInfo(hostname='xxxxxx', ipaddress='192.168.0.xxx', ident='agent', fetcher_type=<FetcherType.TCP: 8>, source_type=<SourceType.HOST: 1>)
[cpu_tracking] Start [7fc97a75cec0]
Read from cache: AgentFileCache(path_template=/omd/sites/cmk/tmp/check_mk/cache/xxxxxx, max_age=MaxAge(checking=0, discovery=90.0, inventory=90.0), simulation=False, use_only_cache=False, file_cache_mode=6)
Not using cache (Too old. Age is 8 sec, allowed is 0 sec)
Connecting via TCP to 192.168.0.xxx:6556 (5.0s timeout)
Detected transport protocol: TransportProtocol.TLS
Reading data from agent via TLS socket
Reading data from agent
Detected transport protocol: TransportProtocol.PLAIN
Closing TCP connection to 192.168.0.xxx:6556
Write data to cache file /omd/sites/cmk/tmp/check_mk/cache/xxxxx
Trying to acquire lock on /omd/sites/cmk/tmp/check_mk/cache/xxxxx
Got lock on /omd/sites/cmk/tmp/check_mk/cache/xxxxx
Releasing lock on /omd/sites/cmk/tmp/check_mk/cache/xxxxx
Released lock on /omd/sites/cmk/tmp/check_mk/cache/dxxxxx
[cpu_tracking] Stop [7fc97a75cec0 - Snapshot(process=posix.times_result(user=0.029999999999999805, system=0.0, children_user=0.0, children_system=0.0, elapsed=1.3200000002980232))]
  Source: SourceInfo(hostname='xxxxx', ipaddress='192.168.0.xxx', ident='piggyback', fetcher_type=<FetcherType.PIGGYBACK: 4>, source_type=<SourceType.HOST: 1>)
[cpu_tracking] Start [7fc97a75faa0]
Read from cache: NoCache(path_template=/dev/null, max_age=MaxAge(checking=0.0, discovery=0.0, inventory=0.0), simulation=False, use_only_cache=False, file_cache_mode=1)
0 piggyback files for 'xxxxx'.
0 piggyback files for '192.168.0.xxx'.
Get piggybacked data
[cpu_tracking] Stop [7fc97a75faa0 - Snapshot(process=posix.times_result(user=0.0, system=0.0, children_user=0.0, children_system=0.0, elapsed=0.0))]
[cpu_tracking] Start [7fc97a67f9b0]
+ PARSE FETCHER RESULTS
<<<check_mk>>> / Transition NOOPParser -> HostSectionParser
<<<cmk_agent_ctl_status:sep(0)>>> / Transition HostSectionParser -> HostSectionParser
<<<wmi_cpuload:sep(124)>>> / Transition HostSectionParser -> HostSectionParser
<<<uptime>>> / Transition HostSectionParser -> HostSectionParser
<<<mem>>> / Transition HostSectionParser -> HostSectionParser
<<<fileinfo:sep(124)>>> / Transition HostSectionParser -> HostSectionParser
<<<winperf_phydisk>>> / Transition HostSectionParser -> HostSectionParser
<<<winperf_if>>> / Transition HostSectionParser -> HostSectionParser
<<<winperf_processor>>> / Transition HostSectionParser -> HostSectionParser
<<<df:sep(9)>>> / Transition HostSectionParser -> HostSectionParser
<<<checkmk_agent_plugins_win:sep(0)>>> / Transition HostSectionParser -> HostSectionParser
<<<logwatch>>> / Transition HostSectionParser -> HostSectionParser
<<<dotnet_clrmemory:sep(124)>>> / Transition HostSectionParser -> HostSectionParser
<<<services>>> / Transition HostSectionParser -> HostSectionParser
<<<ps:sep(9)>>> / Transition HostSectionParser -> HostSectionParser
Transition HostSectionParser -> NOOPParser
Transition NOOPParser -> NOOPParser
<<<local:sep(0)>>> / Transition NOOPParser -> HostSectionParser
<<<systemtime>>> / Transition HostSectionParser -> HostSectionParser
  HostKey(hostname='xxxxx', source_type=<SourceType.HOST: 1>)  -> Add sections: ['check_mk', 'checkmk_agent_plugins_win', 'cmk_agent_ctl_status', 'df', 'dotnet_clrmemory', 'fileinfo', 'local', 'logwatch', 'mem', 'ps', 'services', 'systemtime', 'uptime', 'winperf_if', 'winperf_phydisk', 'winperf_processor', 'wmi_cpuload']
  HostKey(hostname='xxxx', source_type=<SourceType.HOST: 1>)  -> Add sections: []
Received no piggyback data
CPU utilization      Total CPU: 31.88%
Check_MK Agent       Version: 2.3.0p26, OS: windows, Agent plug-ins: 0, Local checks: 1
Filesystem C:/       [C:\], Used: 80.32% - 72.0 GiB of 89.7 GiB (warn/crit at 98.19%/98.91% used), trend per 7 days 0 hours: +56.7 MiB, trend per 7 days 0 hours: +0.06%, Time left until disk full: 6 years 39 days
Interface 1          [Intel[R] 82574L Gigabit Network Connection], (up), MAC: 00:0C:29:AA:8B:5E:00:00, Speed: 1 GBit/s, In: 278 kB/s (0.22%), Out: 127 kB/s (0.10%)
Log AgentRejestracjaLOG No error messages
Log AgentTemaLog     No error messages
Log HardwareEvents   No error messages
Log TemaAgentLog     No error messages
Log Veeam Endpoint Backup No error messages
Memory               RAM: 38.28% - 9.19 GiB of 24.0 GiB, Virtual memory: 43.89% - 12.1 GiB of 27.5 GiB
Processor Queue      15 min load: 0.49, 15 min load per core: 0.06 (8 logical cores)
Service Summary      Autostart services: 58, Stopped services: 2
Service VeeamEndpointBackupSvc Veeam Endpoint Backup: running (start type is auto)
System Time          Offset: -2 seconds
Uptime               Up since 2025-01-09 15:03:09, Uptime: 285 days 15 hours
0 piggyback files for 'xxxxx'.
[cpu_tracking] Stop [7fc97a67f9b0 - Snapshot(process=posix.times_result(user=0.03000000000000025, system=0.010000000000000009, children_user=0.0, children_system=0.0, elapsed=0.030000001192092896))]
[agent] Success, [piggyback] Success (but no data found for this host), execution time 1.4 sec | execution_time=1.350 user_time=0.060 system_time=0.010 children_user_time=0.000 children_system_time=0.000 cmk_time_agent=1.290

It’s about cmd windows titled with:

title YouWindowName

The windows agent usually runs as SYSTEM account. Maybe it is not able to get this information?

1 Like

I already tried to change Log On user to Administrator for this service.