My local powershell script is not being picked up as a local check on the checkmk server:
However it is being picked up in the rule ‘Deploy…’
I’ve made the custom folder downwards with full access also.
I tested the script manually by placing into a windows checkmk local folder and this produced the service successfully.
However I cannot use the local check to push via the agent bakery.
You can look into the cached agent output on the CheckMK server in order to determine if the expected output is there at all. It can be found in ~siteuser/tmp/check_mk/cache/<name_of_monitored_host>
I’ve found that host in this location but how do you check this? It says it’s not a directory.
See my original screenshot, shouldn’t it show up as a service though from that command?
When debugging you should start from the part that can be the most easily verified and work your way from there to the part that requires that everything else works. In this case the “most easily verified” is running the script on the monitored host & verify that it outputs something. The next step is to verify that the same output is actually transported via the agent to the server & present there — that’s why I said to look at the agent’s cache file on the server. If the output isn’t present there, the command shown in your screenshot has no chance of working as there’s no output to work with.
See original post I have already manually tested and ran it on the server by placing it into the local folder there.
Do you mean the agents cache file on the checkmk server or the hosts server? Because on the checkmk linux server it says the host is not a directory.
Also verify that the output is actually following the format that a local script must produce: a single line; the first column being the status code (0, 1, 2 or 3 for OK, warning, critical, unknown respectively); the second column being the name (if it contains spaces: quoted with single quotes) ; the third column being the metrics or a simple dash - if there are no metrics; the rest being the status output.
Here’s an example of what you might find in that cache file:
<<<local:sep(0)>>>
0 'Unconfigured packages' - all packages configured
That would be valid content. The <<<local:sep(0)>>> is a section header emitted by the agent itself, the other line is produced by a local plugin I have written myself. It follows the format outlined above.
My format is correct as I’ve tested it successfully from the local folder on the server.
However I don’t see the output in that cached file. Also I don’t have the <<local:sep(0)>> because it doesn’t say this is needed in the documentation (unless I’ve missed this?) if the correct directory has been created:
/omd/sites/[mysite]/local/share/check_mk/agents/custom/AzureBackupCheck/lib/local
It isn’t being passed to the agent on the host basically. How can we troubleshoot why this is? I’ve already checked executable permissions etc…
Blue mark here is my site user account.
I think you two are talking about different problems here.
I assuem that the problem is, that the powershell file is not being present in the local directory of the monitored server ?
Did you bake the agents after you created the rule ?
Do you use the agent updater plugin to distribute the agent packages or did you download and reinstalled the agent with the new package ?
Yes I baked the agent with the ‘Deploy…’ rule and I also manually installed the newly baked agent file.
So running this command as per the documentation screenshot the server doesn’t recognise the script as a new service, which I presume is the initial reason why it won’t be pushed out to the server via the agent.
Is that what the bakery is actually doing just pushing the script to this folder like Group Policy would I didn’t realise that.
But yes it’s not there. Is there a way of clearing the cache of having it re-try this maybe?
But still I point back to why the service wasn’t found when running the command on the checkmk server?
The Bakery creates Agent Installation packages based on the Bakery ruleset. With the rules you can bake Plugins and Configuration into the Installation packages.
If you bake a local Plugin into the package and Install it on the monitored server, it should appear in the local directory.
These scripts are then executed every time the checkmk agent is contacted by the checkmk server.
So If you want to test and troubleshoot your Script first, put it into the local folder and we can See, if we get it to work.
If it does, we can then distribute it from the Bakery.