after finally having Icinga2 running and being able to monitor a Windows client with the default tools, I need to count files in a folder on that Windows client. How?
I only have a basic idea how that might be done: Maybe the Icinga2 server should execute a .cmd script which returns the number of files in a folder? With "set count=0 & for %x in (*) do @(set /a count+=1 >nul)" and "echo %count%" I already can see the number of files in a folder. But how to execute that script from the Icinga2 server and read-in the result? And is this even the right way or should the client send the data so the server, instead of the server asking the client? A threshold when a certain number of files is reached in the folder should send an alarm.