File Age is not working as expected for Windows machine.

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
amane
Posts: 77
Joined: Thu Jan 18, 2018 9:53 am

File Age is not working as expected for Windows machine.

Post 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
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

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

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
amane
Posts: 77
Joined: Thu Jan 18, 2018 9:53 am

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

Post 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.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

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

Post 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
You do not have the required permissions to view the files attached to this post.
Be sure to check out our Knowledgebase for helpful articles and solutions!
amane
Posts: 77
Joined: Thu Jan 18, 2018 9:53 am

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

Post 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.
You do not have the required permissions to view the files attached to this post.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

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

Post 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?
Be sure to check out our Knowledgebase for helpful articles and solutions!
amane
Posts: 77
Joined: Thu Jan 18, 2018 9:53 am

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

Post 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..
You do not have the required permissions to view the files attached to this post.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

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

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
amane
Posts: 77
Joined: Thu Jan 18, 2018 9:53 am

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

Post 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.
You do not have the required permissions to view the files attached to this post.
amane
Posts: 77
Joined: Thu Jan 18, 2018 9:53 am

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

Post by amane »

Attaching the nsclient.ini file. Please find attachment
You do not have the required permissions to view the files attached to this post.
Locked