Hi,

the Apache usually uses the pre-forked model - the "cpu" test checks the CPU of 
the target process itself, not the process+children. The parent apache process 
CPU usage is usually very low, as the real work is handled by children.

The "totalcpu" instead of "cpu" test should solve the problem:

        if totalcpu > 30% for 2 cycles then restart


Regards,
Martin




On Jul 10, 2013, at 10:33 AM, Morgan Thunder <[email protected]> wrote:

> Humm this config is in my monitrc not another file in /conf.d
> 
> my monitrc:
>  set daemon 60
> set logfile /var/log/monit.log
> set idfile /var/lib/monit/id
> set statefile /var/lib/monit/state
> set mailserver smtp.gmail.com port 587
> username "[email protected]" password "xxxx"
> using tlsv1
>  set eventqueue
>       basedir /var/lib/monit/events 
>       slots 100
> set mmonit https://admin:[email protected]:8443/collector
> set alert [email protected]
> set httpd port 2812 and
> ssl enable
> pemfile /var/certs/monit.pem
> allow root:pass
> #
> #SERVICES
> check system debian7test
>     if loadavg (5min) > 15 then restart
>     if memory usage > 80% then alert
>     if swap usage > 25% then alert
>     if cpu usage (user) > 60% for 3 cycles then alert
>     if cpu usage (system) > 60% for 3 cycles then alert
>     if cpu usage (wait) > 20% then alert
> #
> ##Apache2
> 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 port 80 protocol http then restart
> if cpu is greater than 30% for 1 cycles then alert
> if cpu > 30% for 2 cycles then restart
> if totalmem > 250 MB for 3 cycles then restart
> if children > 200 then restart
> if loadavg(5min) greater than 10 for 4 cycles then restart
> if 3 restarts within 5 cycles then timeout
> #
> ##Disk Space
> check filesystem with path /dev/sda1
>       if space usage > 80% then alert
>       if inode usage > 80% then alert
> #
> ##SSHD
> check process sshd with pidfile /var/run/sshd.pid
> group ssh
> start program  "/etc/init.d/ssh start"
> stop program  "/etc/init.d/ssh stop"
> #if failed port 22 protocol ssh then restart
> #if 5 restarts within 5 cycles then timeout
> #
> ##MySQL
> check process mysqld with pidfile /var/run/mysqld/mysqld.pid
> group database
> start program = "/etc/init.d/mysql start"
> stop program = "/etc/init.d/mysql stop"
> if failed port 3306 protocol mysql then restart
> if 5 restarts within 5 cycles then timeout
> #
> ##Exim4
> check process exim4 with pidfile /var/run/exim4/exim.pid
>    start program = "/etc/init.d/exim4 start"
>    stop program = "/etc/init.d/exim4 stop"
> 
> 
> 
> 
> 
> 
> 2013/7/9 Josh Sharpe <[email protected]>
> 
> if cpu > 30% for 2 cycles then restart
> 
>  
> depends on what 'set daemon' is in your /etc/monit/monitrc
> 
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general
> 
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general

--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general

Reply via email to