Page 1 of 1

Monitor Log file of unix server using Nagios core

Posted: Tue Jul 02, 2019 12:05 am
by Srinija544
Hi All,

We have a new requirement to monitor a log file named: server.log and previous file: server.log.2019.07.01 in unix server.

Here we have two complications:

Monitor a running file: server.log(present day - 2019.0.02)
Monitor the previous day's file: server.log.2019.07.01

We have to monitor for a pattern like "ERRORS" in both the present and previous log files.
=================================================================
Please find the attached plugin script which we are using for this log file monitoring.
==================================================================
Please check the below command which we have in our commands.cfg:

define command{
command_name check_log_dc1uat163_oldone
command_line $USER2$/check_log $ARG1$ $ARG2$ $ARG3$
}
==================================================================
we have configured this by using this check command:

check_command check_log_dc1uat163_oldone!-F /apps/wildfly-11.0.0/standalone/log/server.log -O /apps/wildfly-11.0.0/standalone/log/server.log.2019-05-20 -q "ERROR"
======================================================================

But we got an error like this:

Log check error: Log file /apps/wildfly-11.0.0/standalone/log/server.log does not exist!

=======================================================================

Please help me how this error can be resolved.

Thanks & Regards,
Srinija.

Re: Monitor Log file of unix server using Nagios core

Posted: Tue Jul 02, 2019 3:22 pm
by scottwilkerson
Does the nagios user have permissions to read this file?

Code: Select all

su nagios -c "tail /apps/wildfly-11.0.0/standalone/log/server.log"