Monitor Log file of unix server using Nagios core

This forum is intended for the discussion of Nagios plugin development. Feature requests, patches, bug fixes, and all types of development-related discussions are welcome!

NOTE: The SourceForge.net nagiosplug-devel mailing list has been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

Monitor Log file of unix server using Nagios core

Postby Srinija544 » Tue Jul 02, 2019 12:05 am

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

Re: Monitor Log file of unix server using Nagios core

Postby scottwilkerson » Tue Jul 02, 2019 3:22 pm

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"
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 17032
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises


Return to Nagios Plugin Development

Who is online

Users browsing this forum: No registered users and 2 guests