I was looking for a monitoring solution which will automatically restart services on a Linux server when they go down.

After some research, I found Monit. It is an open-source utility which does just that. It can run as a daemon and check all your services on your server such as MySQL, Apache, SSH, FTP, etc. and start, stop or restart them as needed. You can configure Monit as you want it to work.

Install and Configure Monit

To install Monit on CentOS or similar distro, simply run:

yum install monit

When it’s done installing, you can edit the configuration file according to your needs:

vi /etc/monit.conf

On CentOS 7 this file will be /etc/monitrc

I won’t go into depth with the configuration since Monit has full documentation on this on their website.

Look at Monit

Here is a quick look at Monit as I configured it.

monit web interface