Monit – A Open Source Tool for Managing and Monitoring Linux System

Monit is a free open source and very useful tool that automatically monitors and manages processes, files, directories, checksums, permissions, filesystems, and services like Apache, Nginx, MySQL, FTP, SSH, SMTP, and so on in a UNIX/Linux based systems and provides an excellent and helpful monitoring functionality to system administrators.

The monit has a user-friendly web interface where you can directly view the system status and setup up processes using a native HTTP(S) web server or via the command line interface. This means you must have web server like Apache or Nginx installed on your system to access and view the monit web interface.

[ You might also like: 20 Command Line Tools to Monitor Linux Performance ]

What Monit Can Do

Monit has the ability to start a process if it is not running, restart a process if not responding, and stop a process if uses high resources. Additionally, you can also use Monit to monitor files, directories, and filesystems for changes, checksum changes, file size changes, or timestamp changes.

With Monit, you can able to monitor remote hosts’ TCP/IP port, server protocols, and ping. Monit keeps its own log file and alerts about any critical error conditions and recovery status.

This article is written to describe a simple guide on Monit installation and configuration on RHEL-based and Debian-based Linux distributions.

Step 1: Installing Monit in Linux

By default, the Monit monitoring program is not available from the default system base repositories, you need to add and enable a third-party epel repository to install the monit package under RHEL-based distributions such as CentOS, Rocky Linux, and AlmaLinux.

--------- On RHEL 9 based Systems --------- 
# dnf install 

--------- On RHEL 8 based Systems --------- 
# dnf install

--------- On RHEL 7 based Systems ---------
# yum install

Once you’ve added the epel repository, install the Monit package by running the following yum command.

# yum install monit
# dnf install monit  [On Fedora Linux]
Install Monit in RHEL
Install Monit in RHEL

For Ubuntu/Debian/Linux Mint user’s can easily install using the apt command as shown.

$ sudo apt install monit

Step 2: Configuring Monit in Linux

Monit is very easy to configure, in fact, the configuration files are created to be very easily readable and making them easier for users to understand. It is designed to monitor the running services every 2 minutes and keeps the logs in “/var/log/monit“.

Monit has a web interface that runs on port 2812 using a web server. To enable the web interface you need to make changes in the monit configuration file.

The main configuration file of monit located at /etc/monit.conf under (RedHat/CentOS/Fedora) and /etc/monit/monitrc file for (Ubuntu/Debian/Linux Mint).

Open this file using your choice of editor.

# vi /etc/monitrc
$ sudo nano /etc/monit/monitrc

Next, uncomment the following section and add the IP address or domain name of your server, allow anyone to connect and change the monit user and password or you can use default ones.

set httpd port 2812 and
     use address  # only accept connections from localhost
     allow        # 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
Configure Monit in Linux
Configure Monit in Linux

Once you’ve configured it, you need to start, enable and verify the monit service to reload the new configuration settings.

# systemctl start monit
# systemctl enable monit
# systemctl status monit
Start Monit in RHEL
Start Monit in RHEL

Now, you will be able to access the monit web interface by navigating to the following URLs.


Then enter the user name as “admin” and password as “monit“. You should get a screen similar to the one below.

Monit Login
Monit Login
Monit Service Manager
Monit Service Manager
Monit System Status
Monit System Status

Step 3: Adding Linux Services to Monit Monitoring

Once the monit web interfaces are correctly set up, start adding the programs that you want to monitor into the /etc/monitrc under (RedHat/CentOS/Fedora) and /etc/monit/monitrc file for (Ubuntu/Debian/Linux Mint) at the bottom.

Following are some useful configuration examples for monit, which can be very helpful to see how a service is running, where it keeps its profile, how to start and stop a service, etc.

Monitor Apache in Monit

check process httpd with pidfile /var/run/
group apache
start program = "/usr/bin/systemctl httpd start"
stop program = "/usr/bin/systemctl httpd stop"
if failed host port 80
protocol http then restart
if 5 restarts within 5 cycles then timeout

Monitor Apache2 in Monit

check process apache with pidfile /run/
start program = "/usr/bin/systemctl apache2 start" with timeout 60 seconds
stop program  = "/usr/bin/systemctl apache2 stop"

Monitor Nginx in Monit

check process nginx with pidfile /var/run/
start program = "/usr/bin/systemctl nginx start"
stop program = "/usr/bin/systemctl nginx stop"

Monitor MySQL in Monit

check process mysqld with pidfile /var/run/mysqld/
group mysql
start program = "/usr/bin/systemctl mysqld start"
stop program = "/usr/bin/systemctl mysqld stop"
if failed host port 3306 then restart
if 5 restarts within 5 cycles then timeout

Monitor SSH in Monit

check process sshd with pidfile /var/run/
start program "/usr/bin/systemctl sshd start"
stop program "/usr/bin/systemctl sshd stop"
if failed host port 22 protocol ssh then restart
if 5 restarts within 5 cycles then timeout

Once you’ve configured all programs for monitoring, check monit syntax for errors. If found any errors fix them, it’s not so tough to figure out what went wrong. When you get a message like “Control file syntax OK“, or if you see no errors, you can proceed ahead.

# monit -t
$ sudo monit -t

After fixing all possible errors, you can type the following command to start the monit service.

# systemctl monit restart
$ sudo systemctl monit restart

This is how looks monit after adding all Linux services for monitoring.

Linux Monitoring Services with Monit
Linux Monitoring Services with Monit
If you read this far, tweet to the author to show them you care. Tweet a thanks
Ravi Saive
I am an experienced GNU/Linux expert and a full-stack software developer with over a decade in the field of Linux and Open Source technologies

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

49 thoughts on “Monit – A Open Source Tool for Managing and Monitoring Linux System”

  1. Is it possible to collect telemetry data through Monit? I mean to know whether Monit can be used as a replacement for Opentelemetry.

  2. Yes, to monitor multiple hosts from a single dashboard you need to install M-monit, an enterprise application, with a one-time license fee (it is not expensive).

    We use Mmonit at my work to monitor over 100 hosts, has email and slack notifications and metric charts, an excellent monitoring tool that’s much easier to set up and maintain than Nagios.


Got something to say? Join the discussion.

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.