Wildcard for Windows path in check_files command

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

Wildcard for Windows path in check_files command

Postby aknotik » Mon Jan 14, 2019 6:20 am

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!
aknotik
 
Posts: 1
Joined: Thu Sep 22, 2016 9:55 am

Re: Wildcard for Windows path in check_files command

Postby mcapra » Mon Jan 14, 2019 12:39 pm

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:
viewtopic.php?f=6&t=39316&p=189522#p189522

More info:
https://docs.nsclient.org/reference/windows/CheckDisk/
Former Nagios employee
http://www.mcapra.com/
User avatar
mcapra
 
Posts: 3493
Joined: Thu May 05, 2016 3:54 pm

Re: Wildcard for Windows path in check_files command

Postby cdienger » Tue Jan 15, 2019 2:14 pm

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.
User avatar
cdienger
Support Tech
 
Posts: 2318
Joined: Tue Feb 07, 2017 11:26 am


Return to Nagios Core

Who is online

Users browsing this forum: No registered users and 8 guests