Monitor Apache using monit

Monit is a small Open Source utility for managing and monitoring Unix systems. Monit conducts automatic maintenance and repair and can execute meaningful causal actions in error situations.

Installing monit on CentOS 7

yum install epel-release -y
yum install monit -y

Once installed, save the following in /etc/monit.d/apache

check process httpd with pidfile /var/run/httpd/
group apache
start program = "systemctl start apache"
stop program = "systemctl stop apache"
if failed host port 80 protocol http
with timeout 15 seconds
then restart
if 5 restarts within 5 cycles then timeout


  1. Adjust if your apache’s pid is in a different location. On a default installation it might be at /var/run/

Start monit

# Checks for syntax errors
monit -t  

There are advanced settings which can be adjusted by modifying the file /etc/monitrc such as email notification etc.

Leave a Reply

Your email address will not be published. Required fields are marked *