1752800 Members
5769 Online
108789 Solutions
New Discussion юеВ

Re: Monit and httpd.pid

 
SOLVED
Go to solution
Piotr Kirklewski
Super Advisor

Monit and httpd.pid

Hi there

I've got monit instaalled and configured only to monitor httpd and localhost.

set daemon 60
set logfile syslog facility log_daemon
set alert peterk@xxx.com
#set alert colin@xxx.com
set httpd port 2812
allow localhost
allow admin:xxx
allow xxx.xx.xxx.xxx
allow xxx.xxx.xxx.xxx

# localhost

check system localhost
if loadavg (1min) > 4 then alert
if loadavg (5min) > 3 then alert
if memory usage > 70% then alert
if cpu usage (user) > 70% then alert
if cpu usage (system) > 70% then alert
if cpu usage (wait) > 30% then alert


#apache

check process httpd with pidfile /var/run/httpd.pid
group apache
start program = "/usr/local/apache2/bin/apachectl start"
stop program = "/usr/local/apache2/bin/apachectl stop"
if failed port 80 protocol http then alert
if cpu > 60% for 2 cycles then alert
if cpu > 90% for 5 cycles then alert
if children > 255 then alert
if loadavg(5 min) greater than 10 for 8 cycles then alert
if totalmem > 200.0 MB for 5 cycles then alert
if 3 restarts within 5 cycles then timeout


There is only one httpd.pid in this system - but two paches installed - the apache2 is not working.

Where am I doing a mistake

Cheers
Jesus is the King
4 REPLIES 4
Steven E. Protter
Exalted Contributor

Re: Monit and httpd.pid

Shalom,

I don't know monit specifically.

pidfile /var/run/httpd.pid

Is not a good way to check if apache/httpd is running.

do a kill -9 on all your httpd processes on a test box. Then check the pid. You will see it sits there merrily telling your current monitor that the server is up and running.

Ways to check:
ps -ef | grep httpd | wc -l
# Shows the number of open processes.
wget for a website index.html served by the server. This will actually let you know if there is content being served up.

How to integrate it with monit? Can't help with that.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Stuart Browne
Honored Contributor

Re: Monit and httpd.pid

Each apache configuration can be configured to put the pid file in a specific location.

The configuration directive is simly:

PidFile /location/to/httpd.pid

This can be over-ridden, so it's no big deal.

So simply put, you need to tell the other apache to use a different pid location, and set up a 2nd 'apache' monit looking at that, with it's own start/stop programs.
One long-haired git at your service...
Piotr Kirklewski
Super Advisor

Re: Monit and httpd.pid

I was trying wget 127.0.0.1 80 and I've got this message:

# wget 127.0.0.1 80
--11:38:05-- http://127.0.0.1/
=> `index.html'
Connecting to 127.0.0.1:80... connected.
HTTP request sent, awaiting response... 403 Forbidden
11:38:05 ERROR 403: Forbidden.


Why is this site forbiden at localhost I think this is a source of my problem.

Cheers

Jesus is the King
Steven E. Protter
Exalted Contributor
Solution

Re: Monit and httpd.pid

Shalom,

This appears to be a misconfiguration in httpd.conf

Check that the DocumentRoot location is correct and permissions are appropriate so the apache server can at least read the content.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com