Trying to check for file age on Windows Client by Agent

Hi! I’m getting trouble to resolve a service check: I’m trying to check that there is at least one file wich creation time is newer than 900 seconds in a directory.

  1. I write the service check on the Icinga2 host:
    /etc/icinga2/zones/global-templates/windows-services.conf

    apply Service “check_name” {
    check_command = “nscp-local”
    command_endpoint = host.vars.client_endpoint
    vars.nscp_query = “checkfiles”
    vars.nscp_arguments = [“path=c:/pathexcample”,“max-depth=1”,“filter=age>900”]
    }

  2. Get the service check running by reloading the icinga2 config, but an error occurred:

No handler for command: checkfiles

I have started troubleshooting with no luck, I guess I’m missing some command definition but got confused and don’t even knows where to start.

I do not know nscp that well, but looking at the documentation, shouldn’t the command be called check_files ? atleast that is what I found in this documentation https://docs.nsclient.org/0.5.0/reference/windows/CheckDisk.html#CheckDisk.check_files

Hi Kevin, thanks for answering, I have tried with the command (script) name: check_files and for last with de nscp query name: checkfiles (query name gotten from from the command that lists queries published in the sticky, on this forum)

Running the command, from the host seems to work: nscp client -q checkfiles path="C:\pathexcample"

So there is a problem in how the agent calling NSClient ?