One of the things I’ve noticed VestaCP is sorely missing is automatic restarting of stopped services. Moreover, if you install VestaCP on a VPS with 1 GB RAM or less, MySQL will fail. A lot. So I setup monit to monitor and restart services. And, since I made each service its own configuration file, I thought I’d share to get anyone else up and running.

Install monit:

apt-get install monit

Super basic configuration:

nano /etc/monit/monitrc

Make sure you have a valid email on this line and make sure not commented out:

set alert your@email.com # receive all alerts

CTRL+O
CTRL+X

Put the appropriate files in /etc/monit/conf.d/ or just do the following:

cd /etc/monit/conf.d/
wget -c https://stevenbrady.com/wp-content/uploads/monit/14.04/apache2.conf
wget -c https://stevenbrady.com/wp-content/uploads/monit/14.04/cron.conf
wget -c https://stevenbrady.com/wp-content/uploads/monit/14.04/dovecot.conf
wget -c https://stevenbrady.com/wp-content/uploads/monit/14.04/exim4.conf
wget -c https://stevenbrady.com/wp-content/uploads/monit/14.04/fail2ban.conf
wget -c https://stevenbrady.com/wp-content/uploads/monit/14.04/mysqld.conf
wget -c https://stevenbrady.com/wp-content/uploads/monit/14.04/nginx.conf
wget -c https://stevenbrady.com/wp-content/uploads/monit/14.04/sshd.conf
wget -c https://stevenbrady.com/wp-content/uploads/monit/14.04/vesta-nginx.conf
wget -c https://stevenbrady.com/wp-content/uploads/monit/14.04/vesta-php.conf

Of course, once you’ve copied these in you’ll want to reload monit:

monit reload

Hopefully that went without too much trouble.