Monitor Apache logs

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
jkinning
Posts: 747
Joined: Wed Oct 09, 2013 2:54 pm

Monitor Apache logs

Post by jkinning »

I am trying to figure out how I can get or what I need to do in order to have Nagios monitor my Apache logs (access logs primarily). I just encountered an issue where it appears log rotate had hung up and prevented anything from writing to my websites access logs. The server, SUSE (SLES) 11sp3, was rebooted after having some patches and an updated kernel. Once the system was rebooted data was writing to the access logs again. I would like to use Nagios to monitor this log file so that if nothing is writing to it an alert is generated. It sounds easy enough but not sure how to go about setting up the monitoring. I would be using Nagios XI.

If there is some other means or better method to make sure that my Apache websites are writing logs that would work as well. We use these access logs to send to WebTrends for analysis. 3 weeks worth of data is a pretty big deal so I really need to prevent this from happening in the future. I am working on root cause but having a Nagios "safety net" in place would allow me to sleep better at night. :)
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Monitor Apache logs

Post by slansing »

The easiest thing may be checking the "date modified" with a simple plugin such as:

http://exchange.nagios.org/directory/Pl ... ck/details

That way you will know if anything has been written to it during the specified period of time. It is presumably a web server so this should be happening almost constantly I would think.
jkinning
Posts: 747
Joined: Wed Oct 09, 2013 2:54 pm

Re: Monitor Apache logs

Post by jkinning »

Most of my checks are done via ssh. So I would need to install the nrpe agent? I didn't see how I could use this plugin to monitor a remote system.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Monitor Apache logs

Post by tmcdonald »

jkinning wrote:Most of my checks are done via ssh.
In this case I would just use SSH to run the script as you would with any other.
Former Nagios employee
jkinning
Posts: 747
Joined: Wed Oct 09, 2013 2:54 pm

Re: Monitor Apache logs

Post by jkinning »

Not to sound stupid but how would I go about doing that?

I tried check_by_ssh -H <host> -C check_file_age -f <file location> -w 1440 -c 2880 and got invalid option -- w so I tried without the -w and -c and received wrong argument! (arg1=check_file_age)
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Monitor Apache logs

Post by tmcdonald »

Have you check out our Monitoring Hosts Using SSH doc?

You will need to put the python plugin on the remote system, as well as have python installed to run it.
Former Nagios employee
jkinning
Posts: 747
Joined: Wed Oct 09, 2013 2:54 pm

Re: Monitor Apache logs

Post by jkinning »

Thanks for the link. Working like a charm now.

Appreciate the assistance!
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Monitor Apache logs

Post by tmcdonald »

No problem at all. I'll be locking this thread now, but feel free to open another if you need anything else in the future!
Former Nagios employee
Locked