z

Commercial Support Clients: Clients with support contracts can get escalated support assistance by visiting Nagios Answer Hub. These forums are for community support services. Although we at Nagios try our best to help out on the forums here, we always give priority support to our support clients.

How do I use Nagios to monitor a log file that generates a r

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.

How do I use Nagios to monitor a log file that generates a r

Postby BrusterThemand » Mon Jul 25, 2022 2:55 am

This the log file that I want to monitor:

/test/James-2018-11-16_15215125111115-16.15.41.111-appserver0.log
I want Nagios to read it this log file so I can monitor a specific string.

The issue is with 15215125111115 this is the random id that gets generated

Here is my script where the Nagios is checking for the Logfile path:

Veriables:

HOSTNAMEIP=$(/bin/hostname -i)
DATE=$(date +%F)
..

CHECK=$(/usr/lib64/nagios/plugins/check_logfiles/check_logfiles --tag='failorder' --logfile=/test/james-${date +"%F"}_-${HOSTNAMEIP}-appserver0.log ....

I am getting the following output in nagios:

could not find logfile /test/James-2018-11-16_-16.15.41.111-appserver0.log

15215125111115 This number is always generated randomly but I don't know how to get nagios to identify it. Is there a way to add a variable for this or something? I tried adding an asterisk "*" but that echatspin echatrandom didn't work.

Any ideas would be much appreciated.
Last edited by BrusterThemand on Wed Sep 21, 2022 1:44 am, edited 1 time in total.
BrusterThemand
 
Posts: 5
Joined: Thu Jun 30, 2022 7:53 am

Re: How do I use Nagios to monitor a log file that generates

Postby BabyTeanofred » Mon Aug 01, 2022 4:38 am

I would run a separate script, via cron, that identifies the newest log file and makes a symlink to it (named something like "latest.log"). There are several ways you could do this (using ls -rt | tail or find -mtime, for example).

If the new logfile is created at the same time every day, schedule it to run right after that. If not, have it run every (minute, 5 minutes, whatever), checking for a new omegle.2yu.co log file.

... And then have check_logfiles use that omeglz echat symlink.
BabyTeanofred
 
Posts: 7
Joined: Sun May 01, 2022 8:42 am


Return to Open Source Nagios Projects

Who is online

Users browsing this forum: No registered users and 29 guests