Have you seen “monit”? It is my tool of choice …

Thursday, 18th April 2024

Comment on Check and Restart Apache if it is malfunctioning (not returning HTML content) shell script by Timdaman.

Have you seen “monit”? It is my tool of choice for these type of problems.

Timdaman Also Commented

Check and Restart Apache if it is malfunctioning (not returning HTML content) shell script
Not exactly but close. I have a webserver that proxy’s out to some backend servers which are crash prone. Monit can alert when a non sucessful return code(i.e. return code fo 500). This is how I have it configured

check host site1 with address 1.2.3.4
alert admin@example.com
stop program = “/usr/local/bin/sudo /usr/local/stop_site_JVMs.sh -site site1”
start program = “/usr/local/bin/sudo /usr/local/start_site_JVMs.sh -site site1”
if 10 restarts within 100 cycles then timeout
if failed port 80 protocol http and request “/site1” then restart
mode active
group RATES

In the monit documentation it states monit can also alert if a checksum or regular expression don’t match though I have not use these myself. See here for more info
http://mmonit.com/monit/documentation/monit.html#connection_testing
and serach for “checksum” or “exspect “

As to why I am not monitoring the backend processes, if I monitor apache I monitor more closely what the customer would see and thus catch apache problems as well.


Recent Comments by Timdaman

How to track server disk activity on Linux with iostat
You don’t need to use iostat with the “watch” command. iostat supports a refresh interval argument.For example to get output every 2 seconds

iostat -p -m 2

On the other hand “watch” does produce prettier output.


Share this on:

Comments are closed.