Wildcard for Windows path in check_files command

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
aknotik
Posts: 1
Joined: Thu Sep 22, 2016 9:55 am

Wildcard for Windows path in check_files command

Post by aknotik »

Hello,

Does anyone know how to specify a path wildcard for check_files command? I'm trying to create a check command in such manner:
"check_nrpe -a check_files path=c:/foo/*/test/ pattern=*.exe" in such case there is no valid response.
"check_nrpe -a check_files path=c:/foo/foo2/test/ pattern=*.exe" status is OK, files are found.

Thanks in advice!
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Wildcard for Windows path in check_files command

Post by mcapra »

What version of NSClient++ is installed on this Windows machine? A lot of NSClient++ command interactions are heavily dependent on the NSClient++ version involved.

The general answer to this question is to leverage the max-depth argument for the CheckDisk/CheckFiles module within NSClient++:
max-depth Maximum depth to recurse
Assuming you had a file tree like this:

Code: Select all

{
  "C:": {
    "foo": [
      "file1.exe",
      "file2.exe"
    ]
    "bar": {
      "baz": [
        "file3.exe"
      ]
    }
  }
}
And a max-depth of 2, file1.exe and file2.exe would match. file3.exe would not match. If you set your max-depth to 3 (or greater), all files would match. +/- 1 maybe, because I don't remember *exactly* how that parameter works and the documentation is vague, but you get the idea? Here's an older post I made on this topic with some sample commands:
https://support.nagios.com/forum/viewto ... 22#p189522

More info:
https://docs.nsclient.org/reference/windows/CheckDisk/
Former Nagios employee
https://www.mcapra.com/
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Wildcard for Windows path in check_files command

Post by cdienger »

Thanks for the input @mcapra. Has his response helped resolve the issue @aknotik ?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked