This is my first local check using Windows PowerShell but don’t know how to find this new information in checkmk.
I created a Dashboard table using View to display various information about multiple Windows hosts. I would like to add new information provided from this PowerShell script to the dashboard.
The PowerShell script is saved in C:\ProgramData\checkmk\agent\plugins\os-info.ps1 and
C:\ProgramData\checkmk\agent\check_mk.user.yml has been modified to execute the script.
Here is the official documentation of local check: Local checks
As per this, the syntax of the output is different. What you wrote is a custom agent plugin which has a particular section like <<<acme_os_info>>> in this case.
Now you need a corresponding check plugin on the monitoring server that can understand this section and output and create service checks for you. Here is the doku for that.
your current script won’t work because it does not follow the local check syntax.
There are multiple things that you need to change in order to make this work.
This is not the right path for a local check. You put Checkmk plugins in this path, but not local checks. Please use the local folder instead.
You create an agent section, but your Checkmk server does not know what to do with it. Either you create a local check or a check plugin. But for that, you need to create the check logic on the Checkmk server side. Local checks do not have custom agent sections. Just remove the line instead. The Checkmk agent will add the local section automatically.
This also will not work because a local check needs to be a one-liner! Otherwise, it won’t work properly. You also have to use the syntax for a local check. It’s possible to do multiple lines, but in the check output it needs to be one line.
I took your script and modified it to work as a local check:
Doing the whole thing with a local check is not the best solution in my opinion. I’m pretty sure you’ll be able to achieve the same thing with the HW/SW Inventory.
Thanks for the useful information. My intention is to write some PowerShell scripts that perform Active Directory health checks then report the information into Checkmk. This was a simple test to see how the process works. I used your modified script and now see this information listed as a service for my host. I also took your advice by enabling HW/SW inventory, providing missing information into a dashboard. Thank you for your advice, it was most helpful.
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.