Plugin Monitor Windows SchduledTasks not work

Hi everyone, I need to monitor the scheduled tasks of a server.
-I have installed the following plugin Checkmk Exchange
-Enabled in CMK server
-Copied win_scheduled_task.ps1 to the plugin folder of the server to monitor
-Restarted the CMK service on the windows server
-Made the rule via WATO

But the service always remains in a stale state, if I manually launch the powershell script on the server to be monitored it brings up all the scheduled tasks with their relative status.
Where am I doing wrong?
I attach some photos



Hi.
Why did you use the windows task monitor from checkmk exchange? There is a solution within checkmk. You will find the needed plugin at ~/share/check_mk/agents/windows/plugins called windows_tasks.ps1.

RG, Christian

The included plugin is not working on many systems correctly as it uses the ancient tool “schtasks”.
The plugin from @Jiuka does the same as my version of the Windows task monitoring and this way better. → Language save and correct state returned

@xmatrix83 you don’t need to create a “Enforced services” rule.
If the plugin script is executed correctly on the target machine you should see automatically some scheduled task checks. Then you can use the rule button to define the state.

Unfortunately, neither the integrated plugin nor the additional one works for me. Could it be my check_mk.user.yml file’s fault? This is the first time I’ve had to enable plugins and I might have made a mistake.
I attach the file
check_mk.user.yml.txt (17.2 KB)

If you copy the plugin scripts to the correct location inside “C:\ProgramData\checkmk\agent\plugins”, you don’t need to change anything inside the check_mk.user.yml.

I would recommend to use a check_mk.user.yml only with the settings you really use/need.

Something like this.

global:
  async_script_execution: parallel
  disabled_sections:
  - mrpe
  - msexch
  - openhardwaremonitor
  - skype
  enabled: true
local:
  enabled: true
  execution:
  - async: true
    pattern: '*'
    run: true
plugins:
  enabled: true
  execution:
  - async: true
    cache_age: 80000
    pattern: $CUSTOM_PLUGINS_PATH$\windows_updates.vbs
    timeout: 3600
  - async: true
    pattern: $CUSTOM_PLUGINS_PATH$\*
    run: true

This is a minimal config i use.

You can inspect the agent output on the CMK side with “cmk -d hostname” or from the “Check_MK” Service → Download agent output.

I don’t understand why I have this problem.
I reloaded the default yml file.
the plugins are in the correct position, if I query the host (cmk -d hostname) in the output there are the scheduled tasks but by doing the discovery it doesn’t add the service and by forcing it with the rule it doesn’t receive data.

That is strange. The original Windows tasks plugin gives no output on your system → only the header line is visible.
I would say the output from the new script looks like it is expected.
You can check on the monitoring server with “cmk --debug --detect-sections win_scheduled_task -vvI hostname” if you get some error messages or not.

Now only the plugin win_scheduled_task is enabled to avoid confusion

OMD[sii]:~/temp$ cmk --debug --detect-sections win_scheduled_task -vvI SIISERVER6-231
Discovering services and host labels on: SIISERVER6-231
SIISERVER6-231:
+ FETCHING DATA
  Source: SourceInfo(hostname='SIISERVER6-231', ipaddress='192.168.0.247', ident='agent', fetcher_type=<FetcherType.TCP: 8>, source_type=<SourceType.HOST: 1>)
[cpu_tracking] Start [7f9c54ca9310]
Read from cache: AgentFileCache(SIISERVER6-231, path_template=/omd/sites/sii/tmp/check_mk/cache/{hostname}, max_age=MaxAge(checking=0, discovery=120, inventory=120), simulation=False, use_only_cache=False, file_cache_mode=1)
[TCPFetcher] Execute data source
Connecting via TCP to 192.168.0.247:6556 (5.0s timeout)
Detected transport protocol: TransportProtocol.TLS (b'16')
Reading data from agent via TLS socket
Reading data from agent
Detected transport protocol: TransportProtocol.PLAIN (b'<<')
Closing TCP connection to 192.168.0.247:6556
[cpu_tracking] Stop [7f9c54ca9310 - Snapshot(process=posix.times_result(user=0.010000000000000231, system=0.0, children_user=0.0, children_system=0.0, elapsed=7.660000000149012))]
  Source: SourceInfo(hostname='SIISERVER6-231', ipaddress='192.168.0.247', ident='piggyback', fetcher_type=<FetcherType.PIGGYBACK: 4>, source_type=<SourceType.HOST: 1>)
[cpu_tracking] Start [7f9c54e2d7d0]
Read from cache: NoCache(SIISERVER6-231, 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)
[PiggybackFetcher] Execute data source
No piggyback files for 'SIISERVER6-231'. Skip processing.
No piggyback files for '192.168.0.247'. Skip processing.
[cpu_tracking] Stop [7f9c54e2d7d0 - Snapshot(process=posix.times_result(user=0.0, system=0.0, children_user=0.0, children_system=0.0, elapsed=0.0))]
+ 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
<<<winperf_phydisk>>> / Transition HostSectionParser -> HostSectionParser
<<<winperf_if>>> / Transition HostSectionParser -> HostSectionParser
<<<winperf_processor>>> / Transition HostSectionParser -> HostSectionParser
<<<fileinfo:sep(124)>>> / Transition HostSectionParser -> HostSectionParser
<<<mem>>> / Transition HostSectionParser -> HostSectionParser
<<<logwatch>>> / Transition HostSectionParser -> HostSectionParser
<<<df:sep(9)>>> / Transition HostSectionParser -> HostSectionParser
<<<checkmk_agent_plugins_win:sep(0)>>> / Transition HostSectionParser -> HostSectionParser
<<<dotnet_clrmemory:sep(124)>>> / Transition HostSectionParser -> HostSectionParser
<<<wmi_webservices:sep(124)>>> / Transition HostSectionParser -> HostSectionParser
<<<services>>> / Transition HostSectionParser -> HostSectionParser
<<<ps:sep(9)>>> / Transition HostSectionParser -> HostSectionParser
Transition HostSectionParser -> NOOPParser
<<<win_scheduled_task:encoding(cp437):sep(9)>>> / Transition NOOPParser -> HostSectionParser
Transition HostSectionParser -> NOOPParser
<<<systemtime>>> / Transition NOOPParser -> HostSectionParser
No persisted sections
No persisted sections
  HostKey(hostname='SIISERVER6-231', source_type=<SourceType.HOST: 1>)  -> Add sections: ['win_scheduled_task']
  HostKey(hostname='SIISERVER6-231', source_type=<SourceType.HOST: 1>)  -> Add sections: []
Received no piggyback data
+ ANALYSE DISCOVERED HOST LABELS
Trying host label discovery with: win_scheduled_task
Trying host label discovery with:
SUCCESS - Found no new host labels
+ ANALYSE DISCOVERED SERVICES
+ EXECUTING DISCOVERY PLUGINS (1)
  Trying discovery with: win_scheduled_task
SUCCESS - Found no new services

It finds the section and gave no error, all looks fine.
Is there something in the output if you check with “cmk --debug --detect-sections win_scheduled_task -vvn hostname”. All other checks should show “PEND Check plugin received no monitoring data”.
Is it the same output if you do a “-vvII” instead of “-vvI” ?

Yes, same output.
I tried deleting the host from wato and re-entering it, but nothing.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.