In this tutorial we’ll learn how to install Monit on Ubuntu 16.04. We will also install and configure its prerequisites. Monit is an opensource monitoring tool for Linux operating system which helps you to monitor services like as HTTPD, MySQL etc. Monit can start a process if it does not run, restart a process if it does not respond and stop a process if it uses too much resources. The monit also has user friendly web interface where you can directly view the system status and setup up processes using native HTTP(S) web server or via the command line interface.
I recommend to use a minimal Ubuntu server setup as a basis for the tutorial, that can be a virtual or a root server image with an Ubuntu 16.04 minimal install from a web hosting company or you use our minimal server tutorial to install a server from scratch.
Install Monit on Ubuntu 16.04
Step 1. First, ensure your system and apt package lists are fully up-to-date by running the following:
apt-get update -y apt-get upgrade -y
Step 2. Installing Monit.
Install Monit using the following command:
apt-get install monit
Start and Enable Monit at system boot by using the following command:
systemctl start monit systemctl enable monit
Step 3. Configure Monit.
Now we are going to enable monit web interface by configuring the monit conf file:
Edit your config like these lines below:
set httpd port 2812 and # set the listening port to your desire. use address localhost # only accept connection from localhost allow localhost # allow localhost to connect to the server and allow admin:monit # require user 'admin' with password 'monit' allow @monit # allow users of group 'monit' to connect (rw) allow @users readonly # allow users of group 'users' to connect readonly
Once you finish the configuration, restart the monit using the following command:
systemctl restart monit
Step 4. Access the Web Interface Monit.
To access the Monit web interface, open the browser, go to the ip of the server http://ip.address:2812 and enter your credentials that you configured before.
Congratulation’s! You have successfully install and configured Monit monitoring tool on your Ubuntu 16.04 server. Thanks for using this tutorial for installing monit on Ubuntu 16.04 LTS (Xenial Xerus) system.