In this short article we will learn how to install Monit, a monitoring tools on Fedora 38 operating system.
In today’s fast-paced digital world, the stability and performance of computer systems are of paramount importance. Whether you are running a small web server, a complex network infrastructure, or managing a cluster of servers in a data center, you need robust monitoring tools to ensure that your systems are running smoothly. Monit, a versatile open-source monitoring tool, has gained recognition for its ability to keep a watchful eye on your system’s vital statistics, and it’s an invaluable addition to any system administrator’s toolkit.
In this article, we will explore Monit and its capabilities, illustrating how it can help us maintain the reliability and performance of our systems.
What Is Monit?
Monit is an open-source, small, and lightweight monitoring tool designed to monitor Unix-like systems. It’s designed to keep an eye on various aspects of a system, including system resources, processes, services, and more. Monit is highly customizable, making it suitable for a wide range of monitoring and automation tasks. It is written in C and can be easily installed on various Unix-like systems, such as Linux and FreeBSD.
- Process Monitoring. Monit excels at monitoring and managing processes. It can start, stop, or restart processes when they go down or become unresponsive. This feature is particularly useful for ensuring that critical applications and services are always available.
- System Resource Monitoring. Monit can monitor system resource usage, such as CPU, memory, and disk space, and alert you when these resources are nearing their limits. This helps prevent resource bottlenecks that can impact system performance.
- Service Monitoring. Monit allows you to monitor and manage services like web servers, databases, and email servers. It can automatically restart services if they become unresponsive, minimizing downtime.
- File and Directory Monitoring. You can set up Monit to monitor files and directories for changes, which is useful for tracking log files, configuration files, and critical directories for unauthorized modifications.
- Event-Based Alerts. Monit can send alerts when issues are detected. You can configure email notifications, custom scripts, or trigger specific actions when predefined conditions are met.
- Web-Based Interface: Monit provides a simple web interface that allows you to view the status of your monitored resources, configure monitoring rules, and manage processes and services remotely.
How To Install Monit On Fedora 38
Monit is available on Fedora’s default repository, making the installation quick and straightforward. Here’s how we can install Monit on a Fedora 38 system:
1. Update System
2. Install Monit
3. Start and enable Monit
4. Configuring Firewall
5. Accessing Monit Web Interface
Step 1: Update System
Update system to ensure all packages are up to date to avoid any issues.
$ sudo dnf update
Step 2: Installing Monit on Fedora 38
After our Fedora 38 has been updated, then we will install Monit on our system. We will use the following command to install the application.
$ sudo dnf install monit
[ramansah@bckinfo ~]$ sudo dnf install monit Last metadata expiration check: 0:01:44 ago on Sun 05 Nov 2023 03:22:39 AM CET. Dependencies resolved. =============================================================================================================== Package Architecture Version Repository Size =============================================================================================================== Installing: monit x86_64 5.32.0-4.fc38 fedora 388 k Transaction Summary =============================================================================================================== Install 1 Package Total download size: 388 k Installed size: 986 k Is this ok [y/N]: y Downloading Packages: monit-5.32.0-4.fc38.x86_64.rpm 281 kB/s | 388 kB 00:01 --------------------------------------------------------------------------------------------------------------- Total 106 kB/s | 388 kB 00:03 Fedora 38 - x86_64 1.6 MB/s | 1.6 kB 00:00 Importing GPG key 0xEB10B464: Userid : "Fedora (38) <email@example.com>" Fingerprint: 6A51 BBAB BA3D 5467 B617 1221 809A 8D7C EB10 B464 From : /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-38-x86_64 Is this ok [y/N]: y Key imported successfully Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : monit-5.32.0-4.fc38.x86_64 1/1 Running scriptlet: monit-5.32.0-4.fc38.x86_64 1/1 Verifying : monit-5.32.0-4.fc38.x86_64 1/1 Installed: monit-5.32.0-4.fc38.x86_64 Complete!
Step 3 : Start and enable Monit
Once Monit is installed, we will need to enable and start the service, For this purpose, we will use command line :
$ sudo systemctl start monit $ sudo systemctl enable monit $ sudo systemctl status monit
[ramansah@bckinfo ~]$ sudo systemctl start monit [ramansah@bckinfo ~]$ sudo systemctl enable monit Created symlink /etc/systemd/system/multi-user.target.wants/monit.service → /usr/lib/systemd/system/monit.service. [ramansah@bckinfo etc]$ sudo systemctl status monit ● monit.service - Pro-active monitoring utility for unix systems Loaded: loaded (/usr/lib/systemd/system/monit.service; enabled; preset: disabled) Drop-In: /usr/lib/systemd/system/service.d └─10-timeout-abort.conf Active: active (running) since Sun 2023-11-05 03:26:30 CET; 3min 42s ago Docs: man:monit(1) https://mmonit.com/wiki/Monit/HowTo Main PID: 4214 (monit) Tasks: 2 (limit: 4009) Memory: 5.1M CPU: 290ms CGroup: /system.slice/monit.service └─4214 /usr/bin/monit -I Nov 05 03:26:30 bckinfo systemd: Started monit.service - Pro-active monitoring utility for unix systems. Nov 05 03:26:30 bckinfo monit: New Monit id: ed3355503fc28b689cb4f41920b9df09 Stored in '/root/.monit.id' Nov 05 03:26:30 bckinfo monit: Starting Monit 5.32.0 daemon with http interface at [localhost]:2812 Nov 05 03:26:30 bckinfo monit: 'bckinfo' Monit 5.32.0 started
We will verify Monit by issuing its version.
$ monit --version
[ramansah@bckinfo ~]$ monit --version This is Monit version 5.32.0
Step 4: Configuring Firewall
If our system has blocked any connection from outside, then we need to open a connection on the firewall. The application is running on port 2812.
[ramansah@bckinfo etc]$ sudo firewall-cmd --zone=public --permanent --add-port=2812/tcp success [ramansah@bckinfo etc]$ sudo firewall-cmd --reload success [ramansah@bckinfo etc]$ sudo firewall-cmd --list-ports 80/tcp 443/tcp 1025-65535/tcp 1025-65535/udp
Step 5: Accessing Monit Web Interface
At this point, we have successfully installed Monti hen we will try to access it. The URL will be located at URL :http://<ip_address>:2812.
To log in to this application, we will use user : admin and passowrd : monit.
At this point, we have successfully installed Monit on Fedora 38 operating system.