edge
23rd December 2007, 19:09
After some "big" tweaks of my apache2.conf file I can not get Monit to monitor Apache2 anymore.
I know that I need to set the Monit values (/etc/monit/monitrc) accordingly to what it's set in apache2.conf, but here is where I get lost!
This is the part that I've changed in apache2.conf
<IfModule prefork.c>
ServerLimit 512
StartServers 50
MinSpareServers 50
MaxSpareServers 10
MaxClients 200
MaxRequestsPerChild 100
</IfModule>
Now I need to set the correct values in "/etc/monit/monitrc"
The monitrc files looks like this at the moment.
check process apache with pidfile /var/run/apache2.pid
group www
start program = "/etc/init.d/apache2 start"
stop program = "/etc/init.d/apache2 stop"
if failed host www.domainname_removed port 80 protocol http
and request "/monit/token" then restart
if cpu is greater than 60% for 2 cycles then alert
if cpu > 80% for 5 cycles then restart
if totalmem > 700 MB for 5 cycles then restart
if children > 512 then restart
if loadavg(5min) greater than 10 for 8 cycles then stop
if 3 restarts within 5 cycles then timeout
Problem is that Monit is giving me a "Connection failed" on Apache with the new apache2.conf settings :/
I think the problem is the "if totalmem > 700 MB for 5 cycles then restart", as when I take this line out, it's working fine.
The monit document is saying this about totalmem:
The equivalent of mem, except totalmem is an aggregation of memory, not only used by a process but also by all its child processes.
The syntax is the same as above.
If I read the above correct I need to multiple ServerLimit by it's child processes (I guess that this is MaxRequestsPerChild)
So.. 512 x 100 = 51200 MB.
Wow.. 51200 MB... For sure this is wrong!.. Or.. Did I make a mistake in (1) the apache2.conf (setting MaxRequestsPerChild to 100) or (2) with my calculation for totalmem?
Anyone here who's got more info on this?
I know that I need to set the Monit values (/etc/monit/monitrc) accordingly to what it's set in apache2.conf, but here is where I get lost!
This is the part that I've changed in apache2.conf
<IfModule prefork.c>
ServerLimit 512
StartServers 50
MinSpareServers 50
MaxSpareServers 10
MaxClients 200
MaxRequestsPerChild 100
</IfModule>
Now I need to set the correct values in "/etc/monit/monitrc"
The monitrc files looks like this at the moment.
check process apache with pidfile /var/run/apache2.pid
group www
start program = "/etc/init.d/apache2 start"
stop program = "/etc/init.d/apache2 stop"
if failed host www.domainname_removed port 80 protocol http
and request "/monit/token" then restart
if cpu is greater than 60% for 2 cycles then alert
if cpu > 80% for 5 cycles then restart
if totalmem > 700 MB for 5 cycles then restart
if children > 512 then restart
if loadavg(5min) greater than 10 for 8 cycles then stop
if 3 restarts within 5 cycles then timeout
Problem is that Monit is giving me a "Connection failed" on Apache with the new apache2.conf settings :/
I think the problem is the "if totalmem > 700 MB for 5 cycles then restart", as when I take this line out, it's working fine.
The monit document is saying this about totalmem:
The equivalent of mem, except totalmem is an aggregation of memory, not only used by a process but also by all its child processes.
The syntax is the same as above.
If I read the above correct I need to multiple ServerLimit by it's child processes (I guess that this is MaxRequestsPerChild)
So.. 512 x 100 = 51200 MB.
Wow.. 51200 MB... For sure this is wrong!.. Or.. Did I make a mistake in (1) the apache2.conf (setting MaxRequestsPerChild to 100) or (2) with my calculation for totalmem?
Anyone here who's got more info on this?