In Windows, the existing plugins are all stored in C:\Program Files (x86)\checkmk\service\plugins in which I added the ps1 in this folder.
If you put a plugin in this path: C:\ProgramData\checkmk\agent\plugins the plugin service crashes so I deduce that the folder which should contain the plugin is in the path C:\Program Files (x86)\checkmk\ and not C:\ProgramData\checkmk.
Where should the .py file be stored? after su - mysite , i found the py file in ./local/lib/python3/cmk/base/plugins/agent_based/dfs_backlog.py
How do I find the DFSR options in ChecMK? Discovery rules? Agent rules? The plugin options are nowhere to be found.
I don’t understand the logic and process of this plugin
OMD[monitoring]:~$ mkp list
Name Version Title Author Req. Version Until Version Files State
----------- ------- ------------------ ----------------- ------------ ------------- ----- -----------------------------
dfs_backlog 2.0 DFSR backlog check Roger Ellenberger 2.0.0 None 2 Enabled (active on this site)
yum 2.4.3 YUM Update Check Henri Wahl 2.0.0 None 7 Enabled (active on this site)
The only important source of information for agent plugin issues is the agent log inside c:/programdata/checkmk/agent/log/
Here you see if your plugin finishes without an error code.
I think your problem is that the local system user (as this runs the cmk agent) cannot get any information about the DFS backlog.
Your test run was executed with your user and this user had access to the information.
2024-02-05 09:27:34.032 [srv 20844] [Trace] Sync Plugin Entry 'C:\ProgramData\checkmk\agent\plugins\dfs_backlog.ps1' forced to be async, due to cache_age [300]
2024-02-05 09:27:34.033 [srv 20844] Send at port 'mail:\\.\mailslot\Global\WinAgent_0' 'success' by 'winperf' [4392]
2024-02-05 09:27:34.034 [srv 20844] perf: Section 'fileinfo' took [3] milliseconds
2024-02-05 09:27:34.035 [srv 20844] [Trace] Sync Plugin Entry 'C:\ProgramData\checkmk\agent\plugins\dfs_backlog.ps1' forced to be async, due to cache_age [300]
2024-02-05 09:27:34.035 [srv 20844] Plugin 'C:\ProgramData\checkmk\agent\plugins\dfs_backlog.ps1' is async with age:300 timeout:120 retry:2
2024-02-05 09:27:34.036 [srv 20844] [Trace] Left [1] files to execute in 'plugins'
2024-02-05 09:27:34.037 [srv 20844] [Trace] To start [1] sync plugins
2024-02-05 09:27:34.038 [srv 20844] Allowed Extensions: [checkmk.py,py,exe,bat,vbs,cmd,ps1]
2024-02-05 09:27:34.038 [srv 20844] [Trace] Left [0] files to execute
2024-02-05 09:27:34.039 [srv 20844] [Warn ] Data 'C:\ProgramData\checkmk\agent\plugins\dfs_backlog.ps1' is too old, age is '453' seconds
2024-02-05 09:27:34.039 [srv 20844] [Trace] Left [0] files to execute in 'local'
2024-02-05 09:27:34.040 [srv 20844] Received [368] bytes from 'wmi_cpuload'
2024-02-05 09:27:34.041 [srv 20844] restarting async plugin 'C:\ProgramData\checkmk\agent\plugins\dfs_backlog.ps1'
2024-02-05 09:28:33.930 [srv 20844] [Trace] Sync Plugin Entry 'C:\ProgramData\checkmk\agent\plugins\dfs_backlog.ps1' forced to be async, due to cache_age [300]
2024-02-05 09:28:33.931 [srv 20844] Plugin 'C:\ProgramData\checkmk\agent\plugins\dfs_backlog.ps1' is async with age:300 timeout:120 retry:2
2024-02-05 09:28:33.932 [srv 20844] [Trace] Left [1] files to execute in 'plugins'
2024-02-05 09:28:33.933 [srv 20844] [Trace] To start [1] sync plugins
2024-02-05 09:28:33.934 [srv 20844] Allowed Extensions: [checkmk.py,py,exe,bat,vbs,cmd,ps1]
2024-02-05 09:28:33.934 [srv 20844] [Warn ] Data 'C:\ProgramData\checkmk\agent\plugins\dfs_backlog.ps1' is too old, age is '513' seconds
2024-02-05 09:28:33.935 [srv 20844] restarting async plugin 'C:\ProgramData\checkmk\agent\plugins\dfs_backlog.ps1'
2024-02-05 09:28:33.936 [srv 20844] [Trace] Left [0] files to execute
2024-02-05 09:28:33.936 [srv 20844] Thread for plugin 'C:\ProgramData\checkmk\agent\plugins\dfs_backlog.ps1' is still running, restart is not required
2024-02-05 09:28:33.937 [srv 20844] [Trace] Left [0] files to execute in 'local'
2024-02-05 09:29:00.681 [srv 20844] [Warn ] perf: In [146688] milliseconds process 'powershell.exe -NoLogo -NoProfile -ExecutionPolicy Bypass -File "C:\ProgramData\checkmk\agent\plugins\dfs_backlog.ps1"' pid:[6772] FAILED - generated [93] bytes of data in [3] blocks
2024-02-05 09:29:00.683 [srv 20844] [Warn ] Async Plugin 'C:\ProgramData\checkmk\agent\plugins\dfs_backlog.ps1' is failed
2024-02-05 09:29:00.683 [srv 20844] [Warn ] Async Plugin 'C:\ProgramData\checkmk\agent\plugins\dfs_backlog.ps1' has too many failures 3
2024-02-05 09:29:00.684 [srv 20844] Process 'C:\ProgramData\checkmk\agent\plugins\dfs_backlog.ps1' resets data after 146 seconds
2024-02-05 09:29:00.684 [srv 20844] [Trace] Thread OFF: 'C:\ProgramData\checkmk\agent\plugins\dfs_backlog.ps1'
In the log we see that your script does not finish correctly.
As i said before the problem is the user that executes the script (local system).
You have two options. Configure the agent to run as a user that has rights to fetch the wanted information or configure the plugin to run with another user account (run as function for plugins and local checks).
You see it fails after the time you configured → timeout 120 → failed after 147 seconds.
How long does your script run if executed on command line with your user?
The execution with the agent should not take longer time.
/local/lib/python3/cmk/base/plugins/agent_based$ python3 dfs_backlog.py
Traceback (most recent call last):
File "/opt/omd/sites/monitoring/local/lib/python3/cmk/base/plugins/agent_based/dfs_backlog.py", line 28, in <module>
from .agent_based_api.v1.type_defs import (
ImportError: attempted relative import with no known parent package