0

I would like to monitor empty replies from my apache2 process as I am running into a problem similar to "Apache gives empty reply" .

I am using monit to monitor my processes, so I am going to stick with that!

I have the file 'apache2' in my '/etc/monit/conf.d' directory on debian:

check process apache2 with pidfile /var/run/apache2/apache2.pid
    start program = "/etc/init.d/apache2 start"
    stop program  = "/etc/init.d/apache2 stop"
    if cpu > 60% for 2 cycles then alert
    if cpu > 80% for 5 cycles then alert
    if children > 25 then restart
    if failed host example.com port 80 protocol http # example.com replaces the actual site in this example.
#       and request "/"    # ??? Needed
#       and size <10      # ??? such an option does not exist?
#       with size <10      # ??? such an option does not exist?
       with timeout 20 seconds
       then restart
    group server

If tried to add a size constraint, but I did not succeed. Is it possible to check for the size of the reply, if so, how to amend the above configuration?

Note: this monit is checking port 80 - SSL is ensured by a proxy, port 80 is not publicly accessible. The hosts file of the server has "example.com" point to the local IP.

le_top
  • 135
  • 6

1 Answers1

1

I see two possible solutions:

  1. Check for empty CHECKSUM with:
if failed
    ...
    checksum d41d8cd98f00b204e9800998ecf8427e
then alert
  1. Regex should also work
if failed
    ...
    content = ".+"
then alert
boppy
  • 521
  • 2
  • 6
  • I tested the "content" implementation which in full becomes `if failed host example.com port 80 protocol http with content = "" with timeout 20 seconds then restart` – le_top Sep 09 '20 at 06:54
  • The http server returned empty replies again and the service was restarted by monit so it worked for me. – le_top Sep 14 '20 at 22:24