Install and Configure Monit Monitoring Server on Ubuntu 20.04 LTS - Best Method ?

Monit is a lightweight and effective tool that is used for monitoring system services. Using the Monit web interface, you can easily monitor processes and system resources such as Memory, CPU usage, load average, server uptime, network connections, and different server applications. It is originally used as a single server. However, the commercial version of the Monit server can monitor multiple servers at the same time through just one web interface.

Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related Server Monitoring Software on Ubuntu Linux System.

In this context, we shall look into the installation of the Monit monitoring server on the Ubuntu 20.04 system through the command line.


How to Install and Configure Monit on Ubuntu ?

Before performing this Installation procedure, ensure that you are using a user with root or sudo privileges.

Now, follow the steps given below to complete Monit monitoring server Installation and configuration.


1. Install Monit Monitoring server

Open the 'Terminal' application on your system by pressing 'Ctrl+Alt+t'. The Monit application can be directly installed from Ubuntu's official repository. However, use the following command for the installation of the Monit server:

$ sudo apt install monit

After completing the installation of the Monit server, use the below-given command to check the monit services are running or not :

$ sudo systemctl status monit


2. Configure Monit Server

The default configuration file of Monit is available at the '/etc/monit/monitrc' location. Monit offers a web interface to monitor the services through the web browser. The monit web interface is not enabled by default. But, it can be enabled by changing few lines in the configuration file by using the below-mentioned command:

$ sudo nano /etc/monit/monitrc

Search the below-mentioned lines in the configuration file and uncomment these lines:

set httpd port 2812 and

allow admin:monit  

Here, the admin password is 'monit'. Save the edited configurations and press 'Ctrl+x' to exit from the configuration.


3. Check Syntax errors

Here, you will check that the configuration file is without any syntax errors by running the following command:

$ sudo monit -t


4. Enable Monit services

If Monit service is not enabled then, use the following command to enable it automatically on system boot:

$ sudo /lib/systemd/systemd-sysv-install enable monit

Now, restart or reload the services of Monit by using the below-given command:

$ sudo systemctl restart monit
$ sudo monit reload

To verify that port 2812 is listening or not, use the below-given command:

$ ss -plunt | grep 2812


5. Check Monit Status

To verify that everything is working good, use the following command:

$ sudo monit status


6. Allow Firewall access to the port

If you want to access the Monit web interface from the outside to your localhost then, use the following command to allow access to public users:

$ sudo ufw allow 2812


7. Access the Monit web interface

Access the web interface of the Monit server through the web browser. Enter the IP address of the server or machine where the Monit is installed as follows:

http://your-server-ip-address:2812

Now, a dialogue box will pop up on your browser where you should enter the username and password.



[Need help in Installing Open Source Software? We can help you. ]

This article covers how to Install Monit monitoring server on the Ubuntu 20.04 system. Monit is an open-source utility used to supervise the processes and restart the services which are configured for it and have failed. Monit supervises the processes and restarts them on failure detection. Apart from the processes, Monit can also be used to monitor CPU, RAM, Disk, File Size and trigger alerts on out-of-bound values. It also shows how to trigger alert emails using custom templates. 

Now you can easily monitor your system using this lightweight tool.


To Install Monit on Ubuntu, run the following commands:

$ sudo apt update
$ sudo apt install monit

Related Posts