Page 1 of 2

File Age is not working as expected for Windows machine.

Posted: Mon Sep 23, 2019 9:40 am
by amane
Hi,

We instrumented monitoring f file slms.* stuck in the folder more than 5 minutes then Nagios will triggered Alert.

It's capturing the files correctly however nagios is not changing the status even after files removed from the directory.

Command View : $USER1$/check_nrpe -H $HOSTADDRESS$ -t 60 -c $ARG1$ $ARG2$

check_files -a path='<FilePath>' pattern=slms.* 'filter=written < -5m' 'crit= count > 0' 'empty-state=ok' 'empty-syntax=${status}: No files found' 'top-syntax=${status}: ${count} files found'


Thanks & Regards,
Avinash

Re: File Age is not working as expected for Windows machine.

Posted: Mon Sep 23, 2019 11:09 am
by lmiltchev
It's capturing the files correctly however nagios is not changing the status even after files removed from the directory.
Can you elaborate on that? Do you mean the check correctly shows that the files were removed, but still exits with a "non-OK" status?

I haven't been able to recreate the issue. I started off with adding two zip files in the D:\TEMP directory on my workstation. The check returned CRITICAL:

Code: Select all

[root@main-nagios-xi libexec]# ./check_nrpe -H x.x.x.x -c check_files -a path='D:\TEMP' pattern=*.zip 'filter=written < -5m' 'crit= count > 0' 'empty-state=ok' 'empty-syntax=${status}: No files found' 'top-syntax=${status}: ${count} files found'
CRITICAL: 2 files found|'count'=2;0;0
[root@main-nagios-xi libexec]# echo $?
2
Then, I deleted the two zip files, and the checked returned OK (as expected):

Code: Select all

[root@main-nagios-xi libexec]# ./check_nrpe -H x.x.x.x -c check_files -a path='D:\TEMP' pattern=*.zip 'filter=written < -5m' 'crit= count > 0' 'empty-state=ok' 'empty-syntax=${status}: No files found' 'top-syntax=${status}: ${count} files found'
OK: No files found|'count'=0;0;0
[root@main-nagios-xi libexec]# echo $?
0

Re: File Age is not working as expected for Windows machine.

Posted: Wed Sep 25, 2019 9:36 am
by amane
Can you elaborate on that? Do you mean the check correctly shows that the files were removed, but still exits with a "non-OK" status?
yes, files which are start from 'slms' are not available in F:\\RedPrairie\\LABOR\\LES\\files\\hostout\\import directory on endpoint server but status is showing 3 files found.


Please find below output for same.
[nagios@<NagiosXIServer> ~]$ /usr/local/nagios/libexec/check_nrpe -H <Host IP Address> -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' 'empty-syntax=${status}: No files found' 'top-syntax=${status}: ${count} files found'
CRITICAL: 3 files found|'count'=3;0;0

Status should be in OK status with 0 file found.

Re: File Age is not working as expected for Windows machine.

Posted: Wed Sep 25, 2019 10:07 am
by lmiltchev
Can you show us a screenshot with the files that do exist in the "F:\RedPrairie\LABOR\LES\files\hostout\import" folder?

Again, I was not able to recreate the issue. I tried a "similar" setup.
example01.PNG

Code: Select all

[root@main-nagios-xi libexec]# /usr/local/nagios/libexec/check_nrpe -H x.x.x.x -t 60 -c check_files -a path='D:\\RedPrairie\\LABOR\\LES\\files\\hostout\\import' pattern=slms.* 'filter=written < -1m' 'crit= count > 0' 'empty-state=ok' 'empty-syntax=${status}: No files found' 'top-syntax=${status}: ${count} files found'
CRITICAL: 3 files found|'count'=3;0;0
After deleting the files, the check returned OK:

Code: Select all

[root@main-nagios-xi libexec]# /usr/local/nagios/libexec/check_nrpe -H 192.168.5.18 -t 60 -c check_files -a path='D:\\RedPrairie\\LABOR\\LES\\files\\hostout\\import' pattern=slms.* 'filter=written < -1m' 'crit= count > 0' 'empty-state=ok' 'empty-syntax=${status}: No files found' 'top-syntax=${status}: ${count} files found'
OK: No files found|'count'=0;0;0

Re: File Age is not working as expected for Windows machine.

Posted: Tue Oct 01, 2019 4:45 am
by amane
Hi,

I checked and found there is no file present on the path F:\RedPrairie\LABOR\LES\files\hostout\import starting with the name slms.*. But still on the Nagios console metric status is showing as in the CRITICAL state and it should be in the OK state becuase file is not there.

I am attaching the snapshot below.

Re: File Age is not working as expected for Windows machine.

Posted: Tue Oct 01, 2019 2:12 pm
by tgriep
The critical message in the Nagios GUI, how many files does it say is creating the Critical Alert?

Is there any subfolders that could be holding a file or files with the slms.* pattern?

What version of NSClient++ are you running on the Windows server?

Re: File Age is not working as expected for Windows machine.

Posted: Thu Oct 03, 2019 6:34 am
by amane
Yes , Critical message is showing on the Nagios GUI and 3 files showing on Nagios GUI with critical error message [ CRITICAL: 3 files found].
There is no any other folder on this path F/RedPrairie/LABOR/LES/files/hostout/import/slms which contains slms.* files.

We are using Nagios 5.5.10 version.

Thanks..

Re: File Age is not working as expected for Windows machine.

Posted: Thu Oct 03, 2019 8:31 am
by tgriep
To get the version of the NSCLient++ agent, run this command on the Nagios server and post the output so we can see it.

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H <Host IP Address>
One suggestion is to upgrade to the latest stable release of NSClient++ and the following link is where it can be downloaded from.
http://nsclient.org/download/0.5.2/


Can you run this example command as well and post the output to the ticket? I added the folder \\slms to the path as the earlier example it is missing.

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H <Host IP Address> -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' 
Also, go th the following folder on the Windows system and get the nsclient.ini and the nsclient.log file and post it here.

Code: Select all

C:\Program Files\NSClient++
Thanks.

Re: File Age is not working as expected for Windows machine.

Posted: Fri Oct 04, 2019 8:34 am
by amane
Nsclient Version :

[nagios@Nagiosserver~]$ /usr/local/nagios/libexec/check_nrpe -H 10.128.160.116
I (0.5.1.44 2017-08-30) seem to be doing fine...

Below is the output of the 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' 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

PFA nsclient.ini and the nsclient.log file from the windows server.

Re: File Age is not working as expected for Windows machine.

Posted: Fri Oct 04, 2019 8:35 am
by amane
Attaching the nsclient.ini file. Please find attachment