How to Install Monit Monitoring Tool on Ubuntu 16.04

By Hitesh Jethva, Alibaba Cloud Tech Share Author. Tech Share is Alibaba Cloud’s incentive program to encourage the sharing of technical knowledge and best practices within the cloud community.

Monit is a free and open source tool for managing and monitoring processes, programs, files, directories and filesystems on a Unix system. Monit also monitors different services like Apache, Nginx, MySQL, FTP, SSH, Sendmail and many more. It allows system administrators to get notified and fix problems as soon as possible with minimal interruption. Monit comes with user-friendly web interface where you can easily view the system status. You can also monitor remote hosts TCP/IP port, server protocols and ping using Monit. If any services go down, Monit conducts automatic maintenance and repair and can execute meaningful causal actions in error situations. Monit keeps its own log file and alerts about any critical error conditions and recovery status via customizable messages.

In this tutorial, I will walk you through the process of installing Monit monitoring tool on an Alibaba Cloud Elastic Compute Service (ECS) Ubuntu 16.04 Server


  1. A fresh Alibaba Cloud ECS Ubuntu 16.04 instance.
  2. A static IP address is configured.
  3. A root password is set up to your instance.

Launch Alibaba Cloud ECS Instance

First, log in to your Alibaba Cloud ECS Console. Create a new ECS instance, choosing Ubuntu 16.04 as the operating system with at least 2GB RAM. Connect to your ECS instance and log in as the root user.

Once you are logged into your Ubuntu 16.04 instance, run the following command to update your base system with the latest available packages.

Install Monit

By default, Monit is available in the Ubuntu 16.04 default repository. You can install it by just running the following command:

Once the Monit has been installed, start Monit service and enable it to start on boot time with the following command:

You can check the status of Monit with the following command:


Enable Monit Web Interface

Monit comes with user friendly-web interface to view the system status and manage them through the web browser. By default, Monit web interface is disabled. You can enable it by editing /etc/monit/monitrc configuration file:

Make the following changes:

Save the file, then restart Monit service to apply the changes:

Open your web browser and type the URL http://your-server-ip:2812. You will be redirected to the Monit login page:

Provide monit username as admin and password as monit, then click on the Sign In button. You should see the Monit default dashboard in the following page:

Click on the to view to system status of your server in the following page:

Configure Services for Monitoring

By default, Monit comes with a pre-defined configuration template for different services. You can list all of them with the following command:

Configure Monit for Apache, SSH and FTP service

First, you will need to install Apache and vsftpd to your system. You can install them with the following command:

Next, you will need to create the configuration file for vsftpd. You can do this with the following command:

Add the following lines:

Save and close the file. Then, enable the configuration file with the following command:

By default, Apache and SSH configuration file is available in /etc/monit/conf-available/ directory. So, you will only need to enable them. You can do this with the following command:

Next, verify the Monit status with the following command:


Next, restart the Monit service to apply the changes:

You can see the new service on the Monit web interface:

Click on the apache to see the detailed information of apache service in the following page:

You can also check the status of all the service using the following command:


Test the Monitoring

Monit is now configured and working fine. It’s time to test the action of Monit when the service or process dies. Let’s stop the vsftpd service and check whether Monit starts vsftpd automatically or not.

You can stop the vsftpd service with the following command:

Wait for the command to take effect and then check the Monit log file:

You should see that vsftpd service started automatically:

Configure Email Delivery for Monit Notifications

Monit also provides notifications via email if any service goes down. To do so, you will need to install Postfix as your MTA to your system. You can install it with the following command:

During the installation process, you will be asked to select a server configuration type as shown in the following image:

Choose Internet Site and click on the OK button to complete the installation.

Next, you will need to configure /etc/monit/monitrc for setting up email notifications. Here, we will configure Monit to send an alert via email if apache service goes down.

Make the following changes:

Save and close the file. Then, restart Monit to apply the changes:

Next, stop the Apache service to check whether Monit send an email notification or not:

Check the mail with the following command:

If everything works well, you should see the following output:

Congratulations! You have successfully installed Monit monitoring tool on an Alibaba Cloud Elastic Compute Service (ECS) Ubuntu 16.04.


Follow me to keep abreast with the latest technology news, industry insights, and developer trends.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store