How to Install Monit on Fedora 37/36/35

Monit is an open-source utility program that manages and monitors resources and services on Linux systems. Some services and resources managed by Monit are CPU usage, memory usage, server uptime, network connections, and server application services. It also ensures that all running services are always healthy by restarting services that stop or encounter operating errors such as system downtime, application crashes, or resource spikes. In addition, Monit can also be configured to send alerts to administrators when certain events occur, allowing administrators to take corrective action before problems escalate. As a result, Monit is an essential tool for keeping Linux systems running smoothly.

In the following tutorial, you will learn how to install Monit on Fedora 37/36/35 Linux using the version direct from Fedora’s repository and configure Monit to be accessible from your browser using the command line terminal.

Recommended Steps Before Installation

Before you begin, update your system to ensure all packages are up to date to avoid any issues.

sudo dnf upgrade --refresh

Install Monit on Fedora Linux

Monit is available on Fedora’s default repository, making the installation quick and straightforward.

First, use the following command to install the application.



sudo dnf install monit -y

Once installed, you will need to enable and start the service, which you can do using the following command.

sudo systemctl enable monit --now

Lastly, confirm Monit is operational without any errors using the following.

systemctl status monit

Example output:

example of monit status ok on fedora linux

As mentioned above, Monit is working on the back end. Now proceed to the next section to configure the web interface.

Configure Monit WebUI on Fedora Linux

Now that Monit is working, you need to edit the configuration file in the following path “/etc/monit/monitrc” using any text editor.

Open the configuration file with the following command.



sudo nano /etc/monitrc

Now find the lines in the configuration file.

# set httpd port 2812 and
# allow admin:monit

Next, modify the username and password with your own, you can keep admin, but I would change this. Optionally, you can adjust the default port of 2812 with another less-known port for users in sensitive environments.

Example:

set httpd port 2812 and
allow joshmonit:strongpassword

For users in local environments, you can uncomment the “allow localhost,” which will drop non-local clients.

Example:

use address localhost  # only accept connection from localhost (drop if y><p if you use M/Monit)
allow localhost        # allow localhost to connect to the server

Do not uncomment the above if you are accessing from outside.



Save the configuration file with CTRL+O, then exit with CTRL+X.

Once done, test the service to ensure the configuration file has no errors.

sudo monit -t

Example output:

Control file syntax OK

Now restart the service for the configuration file changes to take effect.

sudo systemctl restart monit

Configure Monit FirewallD Rules on Fedora Linux

By default, no rules are set up for Monit. This means you will need to create rules essential to stop attacks, failure to secure Monit will lead to issues down the track, so do not skip this unless you have other means to protect your installation and service.

First, add a new dedicated zone for Monit firewalld policy.



sudo firewall-cmd --permanent --new-zone=monit

Next, specify the allowed IP addresses permitted to access the Redis.

sudo firewall-cmd --permanent --zone=monit --add-source=1.2.3.4

Replace 1.2.3.4 with the IP address that will be added to the allow list.

Once you have finished adding the IP addresses, open the port of the Monit. By default, this is TCP port 2812 unless you have changed it.

sudo firewall-cmd --permanent --zone=monit --add-port=2812/tcp

Note that you can change the default port in your configuration file if you change the firewall port open rule above to the new value.

After running those commands, reload the firewall to implement the new rules.

sudo firewall-cmd --reload

Example output if successful:



success

Access Monit WebUI on Fedora Linux

Now that you have installed Monit and configured the back end, you can now proceed to access the Monit service using the server’s IP address.

Example:

http://192.0.150.220:2812

Users can use localhost for connecting locally.

http://localhost:2812

Example output:

login to monit on fedora linux webui

Log in with the username and password set in the configuration file. Once in, you will arrive at the main dashboard with your overall view.

Example:



example monit service manager on fedora linux

Once on the dashboard, you can click on your system to show more details stats.

Example:

example system status on fedora linux with monit webui

Also, for users that may encounter issues and need to adjust some settings, you can see the overview of your Monit settings using the web interface.

Example:

monit runtime information on fedora linux webui

The tutorial showed the basic setup; you can monitor extensively with different options. I would advise checking out the Monit Documentation Manual on the official website.

Update Monit on Fedora Linux

Given you have installed Monit using Fedora’s default repository, the process is the same using the command line terminal.



sudo dnf update --refresh

For desktop users with automatic updates enabled, I would advise running the terminal update commands every so often to ensure your system is correctly updated.

Remove Monit on Fedora Linux

Users that no longer require Monit on their Fedora Linux system use the following command to remove the application entirely.

sudo dnf autoremove monit

The above command will purge the data that was created with it.


Not what you were looking for? Try searching for additional tutorials.

Leave a Comment