0

I have got monit installed on a lot of our VMs. It all works fine except for this one VM.

Monit is set to monitor apache and check if it is down. For some reason, monit is saying that apache is down (it is not) and that it needs to be restarted. After it tries to run the start script, it still says 'failed to start. The monit log is as follows:

[CEST Oct  4 20:16:21] error    : 'apache2' process is not running
[CEST Oct  4 20:16:21] info     : 'apache2' trying to restart
[CEST Oct  4 20:16:21] info     : 'apache2' start: /etc/init.d/apache2
[CEST Oct  4 20:16:52] error    : 'apache2' failed to start

The apache server still works after this and monit still says it is not started and will unmonitor.

My config for apache is as follows:

 check process apache2 with pidfile /var/run/apache/apache2.pid
   alert email@domain.com but not on { pid }
   start program = "/etc/init.d/apache2 start"
   stop  program = "/etc/init.d/apache2 stop"
   if failed host vm01.domain.com port 80
        protocol HTTP request "/monit_check.html" then restart
   if cpu > 60% for 2 cycles then alert
   if 5 restarts within 5 cycles then timeout

The server is an ubuntu 14.01.1 LTS linux server. Any help would be kindly appreciated!

mamorunl
  • 11
  • 5

2 Answers2

1

Thanks to Paul Haldane (comment on my first post) I found the answer. I could not get monit to run into the foreground and to verbose. I forgot the capital I.

After I did that I discovered that it could not find the pid - turns out I made a typo in the path to the PID file and set it to apache instead of apache2.

Thanks to both of you!

mamorunl
  • 11
  • 5
0

It sounds like it's unable to access the 'monit_check.html' page. Does it work when you try to access it yourself locally?

curl http://vm01.d-cloud.nl/monit_check.html

This might not be the correct right syntax (I could be wrong):

if failed host vm01.d-cloud.nl port 80
    protocol HTTP request "/monit_check.html" then restart

Try putting 'and' before 'request':

if failed host vm01.d-cloud.nl port 80 protocol HTTP
    and request "/monit_check.html"
then restart
Gene
  • 3,633
  • 19
  • 39