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. Monit has built-in a lightweight HTTP(S) interface you can use to browse the Monit server and check the status of all monitored services. From the web interface, you can start, stop and restart processes and disable or enable monitoring of services.
In this guide, we will install Monit and configure it for us to monitor host resources via the Monit web interface on an Ubuntu 16.04/18.04 server.
Deploying your cloud server
If you have not already registered with Cloudwafer, you should begin by getting signed up. Take a moment to create an account after which you can easily deploy your own cloud servers.
Updating System Packages
It is always recommended that you update the system to the latest packages before beginning any major installations. This is done with the command below:
sudo apt-get update && sudo apt-get upgrade
Step 1: Install Monit using the APT command
Issue the command below to download and install Monit using the APT command from the Ubuntu repository:
sudo apt install monit
Step 2: Start Monit Daemon
After installing Monit, issue the command below to start the Monit daemon.
Step 3: Check Monit Status
Now that we have successfully started the Monit daemon without any issues, you can view the status of the daemon by issuing the command below:
sudo systemctl status monit
From the screenshot above, we can see that it shows us the Status, Monitoring Status, Monitoring Mode, Load Average, CPU, Memory Usage, Swap Usage, Uptime, On-Reboot, Boot Time, and Data Collected right there on the terminal.
Step 4: Configuring Monit
The main configuration file for Monit is the
/etc/monit/monitrc file. You can make a few changes to this configuration file for your requirement.
sudo nano /etc/monit/monitrc
By default, the Monit daemon is set to check the services at an interval of 30 seconds as shown in the screenshot below. This setting can be modified by changing the value on the line below:
set daemon 120
Monit Web Interface
Monit provides a web interface for monitoring and managing the configured services. Monit listens on port 2812 by default but we need to configure this by editing the
/etc/monitrc configuration file using the command below:
sudo nano /etc/monit/monitrc
Enter the following in the placeholder:
set httpd port 2812 use address 126.96.36.199 #replace 188.8.131.52 with your server's IP allow localhost allow admin:monit
Ensure to save the file before closing.
Note, the username is
admin and the password is
monit. You can change this as you wish. You can also change the port number to a number of your choice.
Next, proceed to reload monit by issuing the command below:
sudo systemctl restart monit
Next, enable Monit to start-up automatically on boot with the command below:
sudo systemctl enable monit
Note: If you use CSF firewall, ensure that you add the port
2812 to the incoming and outgoing TCP connections.
Next, visit your domain or server IP on port
2812. In this guide, we are visiting
cloudwaferlabs.com.ng:2812 as shown below. You will be prompted to enter the username and password mentioned earlier.
You can read more on the Monit Documentation here
You can also check out the guide on Installing Monit on CentOS here