Page 1 of 1
Problem using check_file_age
Posted: Thu Mar 06, 2014 3:50 pm
by Dj_Fusion
Hi,
I'm trying to monitor some log files on a windows server and to test it I simply created a service entry with the path c:\test.txt to monitor the age of the text file but regardless of how I try to write the path it doesn't register the \ and I get this error : FILE_AGE CRITICAL: File not found - c:test.txt
I tried every way I could think of. I tried c:\\test.txt "c:\test.txt" etc.
I'm running nagios core 3.5
This the Service entry I created :
define service{
use generic-service
host_name (matchinename)
service_description File Age
check_command check_file_age! -w 1 -f c:\test.txt
servicegroups file_age
}
Re: Problem using check_file_age
Posted: Thu Mar 06, 2014 5:47 pm
by abrist
Can you post the command definition for check_file_age? Are you checking this with nrpe or nsclient?
Re: Problem using check_file_age
Posted: Thu Mar 06, 2014 5:55 pm
by Dj_Fusion
Thank you for replying
I use nsclient
define command{
command_name check_file_age
command_line $USER1$/check_file_age -W $ARG1$ -C $ARG2$ -w $ARG3$ -c $ARG4$ -f $ARG5$
}
Re: Problem using check_file_age
Posted: Thu Mar 06, 2014 6:01 pm
by slansing
It sounds like you are trying to check a windows system, but you forgot to add a (-H $HOSTADDRESS$) definition, make the following change:
Code: Select all
command_line $USER1$/check_file_age -H $HOSTADDRESS$ -W $ARG1$ -C $ARG2$ -w $ARG3$ -c $ARG4$ -f $ARG5$
As for the doubled up warning and critical definitions and one being capital the other being lowercase, is this intentional? I'm not sure if the plugin will take that.
Re: Problem using check_file_age
Posted: Fri Mar 07, 2014 9:29 am
by Dj_Fusion
I added the -H $HOSTADDRESS$ in the command definition and I still get the file not found the problem seems to be that nagios don't register the backslashes even if I but 2 to the path is c:test.txt instead of c:\test.txt
The lower and upper case w and c is intentional, the lower and upper case make the difference between sending an alert for a file older than X or a file younger than X.
Re: Problem using check_file_age
Posted: Fri Mar 07, 2014 10:28 am
by abrist
If you use nsclient, you will need to use a check_nt command, or more likely you will have to configure nsclient for nrpe connections and check through nrpe. check_file_age will have to be configured in your nsclient config as an external script.
Is check_file_age a windows binary?
Re: Problem using check_file_age
Posted: Fri Mar 07, 2014 11:58 am
by Dj_Fusion
It worked by use check_nt! FILEAGE but the problem is that I receive a notification when the file is older then the parameter. Do someone know how to make it so it send a notification when the file younger than the parameter ??
Thanks
Re: Problem using check_file_age
Posted: Fri Mar 07, 2014 12:23 pm
by slansing
How did you define your warning and critical thresholds? Are they in line with what the plugin's help output has as an example? Also, did you set up your alert settings on the service properly? It would probably help to see that service definition again.
Re: Problem using check_file_age
Posted: Fri Mar 07, 2014 12:32 pm
by Dj_Fusion
define service{
use generic-service
host_name servername
service_description test.txt
check_command check_nt! FILEAGE -l "c:\\test.txt"! -w 300 -c 600
servicegroups file_age
}
It work fine but instead of sending alerts when the file is younger it send alerts is older. Do someone familiar with check_nt know how to reverse it ?
Re: Problem using check_file_age
Posted: Fri Mar 07, 2014 12:57 pm
by Dj_Fusion
Found it ! I had to reverse the critical and warning value !
Thank you all for your help !