How To Install & Configure Monit on Debian

We explain what Monit is and what it is for, as well as how to install it and configure it on Debian

What is Monit?

Monit has been created as an Open Source utility through which we can manage and monitor Unix Systems.

With Monit, we will be able to perform the maintenance and automatic repair of corrupt processes.

Update Debian 9

The first step is to update the Debian 9 packages and for this we will execute the following commands:

apt-get update -y
apt-get upgrade -y

Once the system will be updated, we proceed to its restart by executing the reboot command to apply the changes.

Install Monit on Debian 9

Once the system is updated, we proceed to install Monit by executing the following line:

apt-get install monit -y

Once Monit is installed, we proceed to execute the following lines to start Monit and configure it in the boot of Debian 9:

systemctl start monit
systemctl enable monit

Check Monit Status

We can see the current status of Monit in Debian 9 by running the following line:

systemctl status monit

The result will be the following. We can see that it is active.

Configure Monit on Debian 9

The next step is to access the /etc/monit/directory where the Monit configuration is hosted, the configuration directory of the servers and processes are in /etc/monit/conf-available/.
Monit has an integrated web interface, but default disables it, so we will access the /etc/monit/ directory by executing the following:

nano /etc/monit/monitrc

There we must locate the following lines:

# set httpd port 2812 and
# 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'

We will adjust it to the following:

set httpd port 2812 and
allow admin:monit # require user 'admin' with password 'monit'

Save the changes in the file using the following key combination Ctrl + O and exit the editor using the key combination Ctrl + X.

We restart the service by executing the following:

systemctl restart monit

Once the service is restarted we can verify the service status by running the following line:

netstat -ant | grep :2812
Note: In case of not having installed netstat we must execute the following command:
apt-get install net-tools

When executing netstat this will be the result: We can see that the port is open.

How To Access Monit on Debian

Once configured these values proceed to go to the browser and enter the following syntax:


When accessing we must enter the following credentials:

  • User: admin
  • Password: monit

Once entered the credentials click on OK

This will be Monit's initial environment in Debian 9:

There we can see details such as:

  • Name of the system
  • Service status
  • Load
  • CPU usage
  • Use of RAM memory
  • Use of Swap memory

We can check the status of Monit by executing the following command in the terminal:

monit status

The result will be the following:

How To Add Services to Monitor with Monit

With the Monit, interface configured we can add services such as Apache, Proftpd and Rsyslog for their respective monitoring.
To visualize the service templates that Monit brings pro defect we must go to the following directory:


How To Do Apache Monitoring

We can find the template of Apache within the configuiracion of Monit but it will be necessary to enable it, for it we will execute the following line:

ln -s /etc/monit/conf-available/apache2 /etc/monit/conf-enabled/

Finally we restart the service:

systemctl restart monit

How To Do Rsyslog Monitoring

To allow monitoring of this service we will run the next line:

ln -s /etc/monit/conf-available/rsyslog /etc/monit/conf-enabled/

Again we restart the Monit service:

systemctl restart monit

How To Do Proftpd Monitoring

This template is not available by default in Monit, so we must create a new file in / etc / monit / conf-available /, for this we execute the following:

nano /etc/monit/conf-available/proftpd

Within this new file we will paste the following:

check process proftpd with pidfile /var/run/
start program = "/etc/init.d/proftpd start"
stop program = "/etc/init.d/proftpd stop"
if failed port 21 protocol ftp then restart

We save the changes using the following key combination Ctrl + O and exit the editor using Ctrl + X.

Once this file is saved, we will execute the following lines:

ln -s /etc/monit/conf-available/proftpd /etc/monit/conf-enabled
monit -t
systemctl restart monit

We can verify that these services have been added to the Monit web interface:

We can click on a service to see detailed information about it:

How To Monitor Through Debian 9 Terminal

If the monitoring of the processes is carried out through the console, we can execute the following line to display a summary of the active processes:

monit summary

This will be the result:

If we want to see the status of all the services, we will execute the following line:

monit status

This will be the result:

To know the state of a particular process we will execute the syntax:

monit status (process)

In this way Monit is a simple and complete alternative to see the status of the processes that must be monitored in real time providing ample information about them.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *