Problem using check_file_age

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Dj_Fusion
Posts: 6
Joined: Thu Mar 06, 2014 3:37 pm

Problem using check_file_age

Post 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
}
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Problem using check_file_age

Post by abrist »

Can you post the command definition for check_file_age? Are you checking this with nrpe or nsclient?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Dj_Fusion
Posts: 6
Joined: Thu Mar 06, 2014 3:37 pm

Re: Problem using check_file_age

Post 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$
}
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Problem using check_file_age

Post 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.
Dj_Fusion
Posts: 6
Joined: Thu Mar 06, 2014 3:37 pm

Re: Problem using check_file_age

Post 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.
Last edited by Dj_Fusion on Fri Mar 07, 2014 10:49 am, edited 2 times in total.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Problem using check_file_age

Post 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?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Dj_Fusion
Posts: 6
Joined: Thu Mar 06, 2014 3:37 pm

Re: Problem using check_file_age

Post 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
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Problem using check_file_age

Post 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.
Dj_Fusion
Posts: 6
Joined: Thu Mar 06, 2014 3:37 pm

Re: Problem using check_file_age

Post 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 ?
Dj_Fusion
Posts: 6
Joined: Thu Mar 06, 2014 3:37 pm

Re: Problem using check_file_age

Post by Dj_Fusion »

Found it ! I had to reverse the critical and warning value !

Thank you all for your help !
Locked