Page 2 of 2
Re: File Age is not working as expected for Windows machine.
Posted: Fri Oct 04, 2019 11:30 am
by tgriep
I suggest upgrading the NSClient++ agent to the latest 0.5.2 version in case there is a bug in it.
Also, you did not run my last example command. I did some slight changes to it that I wanted to see if they help.
Re: File Age is not working as expected for Windows machine.
Posted: Mon Oct 07, 2019 4:10 am
by amane
Please find the output below from your last example command :
[nagios@Nagiosserver ~]$ /usr/local/nagios/libexec/check_nrpe -H 10.128.160.116 -t 60 -c check_files -a path='F:\\RedPrairie\\LABOR\\LES\\files\\hostout\\import\\slms' pattern=slms.* 'filter=written < -5m' 'crit= count > 0' 'empty-state=ok' 'top-syntax=${status}: ${count} files found' 'empty-syntax=${status}: No files found'
OK: No files found|'count'=0;0;0
Now using this above i can see the output status is in OK state.
Can you please tell me exactly what slight changes you made? And we are good to made those changes In our nagios conf. file.
Thanks.
Re: File Age is not working as expected for Windows machine.
Posted: Mon Oct 07, 2019 8:24 am
by tgriep
The changes that I did was to add the slms folder to the path and I swapped the order for the empty-syntax and top-syntax filter because I found that the order of the filter may cause the output to change.
Re: File Age is not working as expected for Windows machine.
Posted: Wed Oct 09, 2019 10:34 am
by amane
Hello,
Is there any way to check only for the files starting with slms.* becuase I found on this path 'F:\\RedPrairie\\LABOR\\LES\\files\\hostout\\import'
there are sub-folders and the slms files are residing inside these sub-folders.
So here i want to check only for the files that are in /import folder and not the sub-folders 'F:\\RedPrairie\\LABOR\\LES\\files\\hostout\\import' which contains the slms.* file. And script which we are using checking for both the files and sub-folders and due to this count is showing 3 on Nagios with status CRITICAL.
Below is the command and i want to search for the files not the folders on this path 'F:\\RedPrairie\\LABOR\\LES\\files\\hostout\\import'
[nagios@Nagiosserver~]$ /usr/local/nagios/libexec/check_nrpe -H 10.128.160.116 -t 60 -c check_files -a path='F:\\RedPrairie\\LABOR\\LES\\files\\hostout\\import' pattern=slms.* 'filter=written < -5m' 'crit= count > 0' 'empty-state=ok' 'top-syntax=${status}: ${count} files found' 'empty-syntax=${status}: No files found'
CRITICAL: 3 files found|'count'=3;0;0
I am attaching the snip with this. I want to check only for the Files not the sub-folders.
Thanks...
Re: File Age is not working as expected for Windows machine.
Posted: Wed Oct 09, 2019 1:14 pm
by tgriep
By default, if you do not specify, the check_files command will check the folder and all subfolders for the pattern specified.
If you do not want that recurse in to subfolders, add this to the command.
max-depth Maximum depth to recurse
https://docs.nsclient.org/reference/win ... heck_files