Hi Team,
We trying to monitor file counts for windows server drive folders in NagiosXI with help of check_nrpe for NSClient 0.5
But here issue is, it is taking folder count as file count . Please help me on this.
Syntax:
./check_nrpe -H xx.xx.xx.xx -c check_files -a path='d:\\\\gis\\\\import\\\\photo' pattern=*.* 'filter= written < -10m' 'crit= count > 5' 'empty-state=ok' 'empty-syntax=${status}: No files found' 'top-syntax=${status}: ${count} files found'
Output :
CRITICAL: 1666 files found|'count'=1666;0;5
Here : 1666 files are folders . in each folder 0 files are there.
File count monitor for directories not sub-folders& it files
Re: File count monitor for directories not sub-folders& it f
Which version of NSClient++ are you running these checks against? That's going to potentially affect some answers.
Here's an older post that discusses the max-depth parameter of NSClient++'s CheckDisk module:
https://support.nagios.com/forum/viewto ... 22#p189522
max-depth is the key if you want to limit recursion into sub-directories.
Here's an older post that discusses the max-depth parameter of NSClient++'s CheckDisk module:
https://support.nagios.com/forum/viewto ... 22#p189522
max-depth is the key if you want to limit recursion into sub-directories.
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
Re: File count monitor for directories not sub-folders& it f
It seems like that NSClient++ counts folders as files. I was hoping to find an option to change this but the NSClient ++ documentation was not very useful. 
There is another plugin that you could use with NSClient++ that may get the job done for you - check_winfile. You can download it (and see some examples) from here:
https://itefix.net/check_winfile
Place the "check_winfile.exe" in the NSClient++ scripts directory, and add the following entry to the nsclient.ini file under the [/settings/external scripts/scripts] section:
Call the plugin from your Nagios XI server as such:
For testing purposes, I added 4 sub-directories under c:\TEMP on my workstation, and added only one text file under the last sub-directory. Then I tested the plugin by running:
Next, I added two more files to one of the sub-directories, waited for a few minutes, and ran:
As you can see, the filter (age) and thresholds worked as expected, and the plugin counted only files, not folders.
Hope this helps.
There is another plugin that you could use with NSClient++ that may get the job done for you - check_winfile. You can download it (and see some examples) from here:
https://itefix.net/check_winfile
Place the "check_winfile.exe" in the NSClient++ scripts directory, and add the following entry to the nsclient.ini file under the [/settings/external scripts/scripts] section:
Code: Select all
check_winfile = scripts\check_winfile.exe //T:30 //NoLogo $ARG1$Code: Select all
/usr/local/nagios/libexec/check_nrpe -H <client ip> -c check_winfile -a '<your arguments>'Code: Select all
[root@main-nagios-xi libexec]# ./check_nrpe -H x.x.x.x -c check_winfile -a '--target c:\TEMP --filter "age lt -10 minutes" --warn 5 --critical 10'
FILE OK - 0 files out of 1 to consider |'selected files'=0;5;10 'all files'=1 'deleted files'=0
[root@main-nagios-xi libexec]# ./check_nrpe -H x.x.x.x -c check_winfile -a '--target c:\TEMP --filter "age lt -1 minutes" --warn 5 --critical 10'
FILE OK - 1 files to consider |'selected files'=1;5;10 'all files'=1 'deleted files'=0Code: Select all
[root@main-nagios-xi libexec]# ./check_nrpe -H x.x.x.x -c check_winfile -a '--target c:\TEMP --filter "age lt -1 minutes" --warn 1 --critical 5'
FILE WARNING - 3 files to consider |'selected files'=3;1;5 'all files'=3 'deleted files'=0
[root@main-nagios-xi libexec]# ./check_nrpe -H x.x.x.x -c check_winfile -a '--target c:\TEMP --filter "age lt -1 minutes" --warn 1 --critical 2'
FILE CRITICAL - 3 files to consider |'selected files'=3;1;2 'all files'=3 'deleted files'=0Hope this helps.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: File count monitor for directories not sub-folders& it f
Hi ,
Thanks for update,
Suppose if i use[/b] , what will happen?
Folder structure:
C:.
├───Contacts
├───Desktop
├───Downloads
│ └───Evernote Import
├───Dropbox
│ ├───Apps
│ │ └───iftttcom
│ │ └───getpocketpdf
│ ├───Backup
│ ├───Camera Uploads
│ ├───Development
├───file1.txt
├───file2.txt
Thanks for update,
Suppose if i use
Code: Select all
max-depth=0Folder structure:
C:.
├───Contacts
├───Desktop
├───Downloads
│ └───Evernote Import
├───Dropbox
│ ├───Apps
│ │ └───iftttcom
│ │ └───getpocketpdf
│ ├───Backup
│ ├───Camera Uploads
│ ├───Development
├───file1.txt
├───file2.txt
Re: File count monitor for directories not sub-folders& it f
The "max-depth" option is not available for the "check_winfile" plugin I showed you examples for. The "check_winfile" plugin has a "--rootonly" option, which limits file search to the top level directory (no recursive traversal of directories). If you don't use this flag, all files (top directory + sub-directories) will be counted.
The "max-depth" option can be used with NSClient++, and it should look through all files/directories down the tree, however (I far as I know) it will count directories as files. Again, I couldn't find a way of changing this. Most probably this option is not available in NSClient++.
The "max-depth" option can be used with NSClient++, and it should look through all files/directories down the tree, however (I far as I know) it will count directories as files. Again, I couldn't find a way of changing this. Most probably this option is not available in NSClient++.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: File count monitor for directories not sub-folders& it f
Hi ,
My doubt in check_nrpe plugin.
./check_nrpe -H xx.xx.xx.xx -c check_files -a path='d:\\\\gis\\\\import\\\\photo' pattern=*.* max-depth=0 'filter= written < -10m' 'crit= count > 5' 'empty-state=ok' 'empty-syntax=${status}: No files found' 'top-syntax=${status}: ${count} files found'
what will happen? if i use max-depth=0
My doubt in check_nrpe plugin.
./check_nrpe -H xx.xx.xx.xx -c check_files -a path='d:\\\\gis\\\\import\\\\photo' pattern=*.* max-depth=0 'filter= written < -10m' 'crit= count > 5' 'empty-state=ok' 'empty-syntax=${status}: No files found' 'top-syntax=${status}: ${count} files found'
what will happen? if i use max-depth=0
-
kyang
Re: File count monitor for directories not sub-folders& it f
max-depth limits the recursion for the folders.
So having that set to 0 would not limit it, and it may just check all files.
You can see the examples from here.
https://docs.nsclient.org/0.5.0/samples/index.html
So having that set to 0 would not limit it, and it may just check all files.
You can see the examples from here.
https://docs.nsclient.org/0.5.0/samples/index.html