Monit fails to stop apache processes

Issue #347 closed
Tony created an issue

We have setup monit to restart apache when logging is over 60%. It tries to restart but fails.

[MST Apr 14 10:51:33] info     : 'apache' trying to restart
[MST Apr 14 10:51:33] info     : 'apache' stop: /etc/init.d/httpd
[MST Apr 14 10:52:33] debug    : M/Monit: status message sent to http://[10x.xx.xx.x94]:8080/collector
[MST Apr 14 10:54:33] error    : 'apache' failed to stop (exit status -1) -- no output

We thought it was probably because it takes more time to stop the process and we increased the timeout to 180 seconds like this:

   check process apache with pidfile /usr/local/apache/logs/httpd.pid
     start program = "/etc/init.d/httpd start" with timeout 60 seconds
     stop program = "/etc/init.d/httpd stop" with timeout 180 seconds
     if failed
     host phoenix.example.com
     port 80
     protocol apache-status loglimit > 60%
     then restart

Now looks like it waits for that amount of time and still fails. The main purpose to use Monit is to restart when logging is heavy and it is never able to restart.

[MST Apr 14 10:51:33] error    : 'apache' failed protocol test [APACHESTATUS] at [phoenix.example.com]:80 [TCP/IP] -- APACHE-STATUS: error -- 89 percent of processes are logging
[MST Apr 14 10:51:33] debug    : M/Monit: event message sent to http://[10x.xx.xx.x94]:8080/collector
[MST Apr 14 10:51:33] info     : 'apache' trying to restart
[MST Apr 14 10:51:33] info     : 'apache' stop: /etc/init.d/httpd
[MST Apr 14 10:52:33] debug    : M/Monit: status message sent to http://[10x.xx.xx.x94]:8080/collector
[MST Apr 14 10:53:33] debug    : M/Monit: status message sent to http://[10x.xx.xx.x94]:8080/collector
[MST Apr 14 10:54:33] debug    : M/Monit: status message sent to http://[10x.xx.xx.x94]:8080/collector
[MST Apr 14 10:54:33] error    : 'apache' failed to stop (exit status -1) -- no output
[MST Apr 14 10:54:33] debug    : M/Monit: event message sent to http://[10x.xx.xx.x94]:8080/collector
[MST Apr 14 10:55:33] debug    : M/Monit: status message sent to http://[10x.xx.xx.x94]:8080/collector
[MST Apr 14 10:55:33] debug    : 'apache' process is running with pid 26376
[MST Apr 14 10:55:33] info     : 'apache' process is running after previous exec error (slow starting or manually recovered?)
[MST Apr 14 10:55:33] debug    : M/Monit: event message sent to http://[10x.xx.xx.x94]:8080/collector
[MST Apr 14 10:55:33] debug    : 'apache' zombie check succeeded
[MST Apr 14 10:55:33] debug    : Socket test failed for [198.xx.xx.xx8]:80 -- APACHE-STATUS: error -- 78 percent of processes are logging
[MST Apr 14 10:55:33] error    : 'apache' failed protocol test [APACHESTATUS] at [phoenix.example.com]:80 [TCP/IP] -- APACHE-STATUS: error -- 78 percent of processes are logging
[MST Apr 14 10:55:33] info     : 'apache' trying to restart
[MST Apr 14 10:55:33] info     : 'apache' stop: /etc/init.d/httpd
[MST Apr 14 10:56:33] debug    : M/Monit: status message sent to http://[10x.xx.xx.x94]:8080/collector
[MST Apr 14 10:57:33] debug    : M/Monit: status message sent to http://[10x.xx.xx.x94]:8080/collector
[MST Apr 14 10:58:33] debug    : M/Monit: status message sent to http://[10x.xx.xx.x94]:8080/collector
[MST Apr 14 10:58:33] error    : 'apache' failed to stop (exit status -1) -- no output

The apache process is at /etc/init.d/httpd. Any help greatly appreciated.

Comments (5)

  1. Tildeslash repo owner

    Please can you try to add the restart program to apache service configuration?:

    restart program = "/etc/init.d/httpd restart"
    

    (note: please do 'monit reload' after each configuration change)

  2. Log in to comment