Page 1 of 1

Check file age

Posted: Tue Nov 03, 2015 8:27 am
by jkinning
I am running Nagios Xi 2014R2.7 and NRPE v2.15 on a SUSE Linux server 11sp4. I am attempting to monitor a few websites access_log files under the Apache directory. I can login to the webserver that I want to do the check with and su to the nagios user and run the check and it works.

Code: Select all

/usr/local/nagios/libexec/check_file_age -f /var/log/apache2/apache-access_log -w 240 -c 300
FILE_AGE OK: /var/log/apache2/apache-access_log is 1 seconds old and 5105057 bytes
If I login to the Nagios server and then su to the nagios user to run the command remotely I get this.

Code: Select all

 ./check_nrpe -H <webserver> -c check_apache_access_log
FILE_AGE CRITICAL: File not found - /var/log/apache2/apache-access_log
I have this entry in the nrpe.cfg file locally on the client server as well.

Code: Select all

command[check_apache_access_log]=/usr/local/nagios/libexec/check_file_age -f /var/log/apache2/apache-access_log -w 240 -c 300
Not sure what else I need to change or do to get this check working.

Re: Check file age

Posted: Tue Nov 03, 2015 11:06 am
by jdalrymple
Is the SUSE box doing some magic sandboxing?
Anything in /var/log/audit/audit.log?
What do you see if you create a command:

Code: Select all

command[check_ls]=ls /
Then from the XI server:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H <webserver> -c check_ls

Re: Check file age

Posted: Tue Nov 03, 2015 11:36 am
by jkinning
That does print out the directory structure remotely on the Nagios server.

Code: Select all

./check_nrpe -H <webserver> -c check_ls
bin
boot
core
dev
etc
home
lib
lost+found
media
mnt
opt
proc
root
sbin
selinux
srv
sys
tmp
usr
var

Re: Check file age

Posted: Tue Nov 03, 2015 4:52 pm
by jdalrymple
Let's go a step further, adjust the check command:

Code: Select all

command[check_ls]=ls -l /var/log/apache2

Re: Check file age

Posted: Wed Nov 04, 2015 11:37 am
by jkinning
You can close this one. I changed permissions to the /var/log/apache2 directory to be 755 and now the Nagios server is able to report on the age of the log files.

Thanks!