check_log returning "log does not exist"


#1

Hi,

I have been asked to setup a new check to look at a log file on an application server and parse it for a key phrase. If the phrase is found, send an alert/notification. I am using the check_log plugin on Nagios 3.0.6 and it appears to be setup correctly, but it does not work when using check_nrpe to connect to the remote host.

I can run the check_log command successfully on the client from the command line and I can run it successfully on the Nagios server. The problem is when I run it from the Nagios server to the client (either through services.cfg or command line), I get an error from Nagios saying the log does not exist. I have logged into the client and can see the log plain as day. My setup is as follows:

FROM NAGIOS SERVER:

/usr/local/nagios/libexec/check_nrpe -H hostname -c check_log -a /apps/u01/oracle/product/bif/reports/logs/rep_prodorapp6_BIF_MT/rwserver.trc /var/tmp/rwserver.old Cached
Log check error: Log file /apps/u01/oracle/product/bif/reports/logs/rep_prodorapp6_BIF_MT/rwserver.trc does not exist!

RUN LOCALLY ON CLIENT:

/usr/local/nagios/libexec/check_log -F /apps/u01/oracle/product/bif/reports/logs/rep_prodorapp6_BIF_MT/rwserver.trc -O /var/tmp/rwserver.old -q Cached
Log check ok - 0 pattern matches found

Any help would be greatly appreciated.


#2

I found the solution. Since the “nagios” user is running the script via NRPE, I had to allow it access to drill down the directory structure to read the log. Looking at the client, only the owner of some of the directories in the path had r+x. I change permissions on the directories to make sure that “other” had r+x (755) and everything works.