Monitor Log file of unix server using Nagios core

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
Srinija544
Posts: 58
Joined: Mon Oct 15, 2018 9:30 pm

Monitor Log file of unix server using Nagios core

Post 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.
Attachments
check_log.txt
(6.09 KiB) Downloaded 140 times
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Monitor Log file of unix server using Nagios core

Post 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"
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked