1080*80 ad

Installing Monitorix on Ubuntu 20.04

How to Install and Configure Monitorix on Ubuntu 20.04: A Step-by-Step Guide

Keeping a close eye on your server’s health and performance is not just good practice—it’s essential for maintaining stability and security. For administrators seeking a powerful yet simple solution, Monitorix stands out as a superb choice. This free, open-source, and lightweight monitoring tool is designed to collect and visualize a vast amount of system data with minimal resource overhead.

In this comprehensive guide, we will walk you through the entire process of installing and configuring Monitorix on an Ubuntu 20.04 server. By the end, you’ll have a fully functional monitoring dashboard providing deep insights into your system’s performance.

What is Monitorix?

Monitorix is a versatile system monitoring tool that excels at visualizing data. It regularly collects information on system load, network traffic, memory usage, disk I/O, and services like Nginx, Apache, and MySQL. Its standout feature is the built-in web server, which presents this data in a series of clear, easy-to-read graphs, making performance analysis incredibly straightforward.

Prerequisites

Before we begin, ensure you have the following:

  • An Ubuntu 20.04 server.
  • A user with sudo or root privileges.

Step 1: Update Your System

First, it’s always a best practice to update your system’s package repository to ensure you have the latest software and security patches.

sudo apt update
sudo apt upgrade -y

Step 2: Install Required Dependencies

Monitorix has a few dependencies that are necessary for it to run correctly. These include Perl libraries, a web server component, and other essential utilities. You can install them all with a single command.

Install all required packages by running:

sudo apt install -y rrdtool perl libwww-perl libmailtools-perl libmime-lite-perl librrds-perl libdbi-perl libxml-simple-perl libhttp-server-simple-perl libconfig-general-perl libio-socket-ssl-perl

This command ensures that every component Monitorix relies on is present on your system before we proceed with the installation.

Step 3: Download and Install Monitorix

Monitorix is not available in the default Ubuntu 20.04 repositories. Therefore, we need to download the .deb package directly from its official sources using the wget command.

First, download the package:

wget http://www.monitorix.org/monitorix_3.14.0-1_all.deb

(Note: You can check the official Monitorix website for the latest version and update the URL if needed.)

Once the download is complete, install the package using dpkg:

sudo dpkg -i monitorix_3.14.0-1_all.deb

After the installation finishes, the Monitorix service should start automatically.

Step 4: Configure the Monitorix Service

Now that Monitorix is installed, let’s take control of its service using systemctl. This allows us to start, stop, and enable it to run on boot.

To check the status of the service, run:

sudo systemctl status monitorix

You should see an “active (running)” status. If it’s not running, you can start it with:

sudo systemctl start monitorix

To ensure Monitorix automatically starts every time your server reboots, enable the service:

sudo systemctl enable monitorix

Step 5: Customize Monitorix Configuration (Optional but Recommended)

The main configuration file for Monitorix is located at /etc/monitorix/monitorix.conf. While the default settings work well, you can customize them to better suit your needs.

Open the file with a text editor like nano:

sudo nano /etc/monitorix/monitorix.conf

Here are a few key options you might want to adjust:

  • title: Change the title displayed on the web interface.
  • hostname: Set a custom hostname for the report.
  • theme_color: Change the color scheme (e.g., black, blue, white).

Actionable Security Tip: Enable Authentication

By default, the Monitorix web interface is accessible to anyone who knows your server’s IP address and port. It is highly recommended to enable built-in password protection.

In the /etc/monitorix/monitorix.conf file, find the <auth> section. Modify it to look like this:

<auth>
        enabled = y
        msg = Monitorix: Restricted access
        htpasswd = /var/lib/monitorix/htpasswd
</auth>

Save and close the file. Next, you need to create the htpasswd file and add a user. Replace admin with your desired username.

sudo htpasswd -d -c /var/lib/monitorix/htpasswd admin

You will be prompted to create a password for the new user.

Finally, restart the Monitorix service to apply all your configuration changes:

sudo systemctl restart monitorix

Step 6: Allow Access Through the Firewall

If you are using UFW (Uncomplicated Firewall) on your Ubuntu server, you need to open the port that Monitorix uses to allow access to its web interface. By default, Monitorix listens on port 8080.

Allow traffic on port 8080 with this command:

sudo ufw allow 8080/tcp

Then, reload the firewall to apply the new rule:

sudo ufw reload

Step 7: Access the Monitorix Web Interface

You’re all set! You can now access the Monitorix dashboard from your web browser. Navigate to the following URL, replacing your_server_ip with your server’s actual IP address:

http://your_server_ip:8080/monitorix

If you enabled authentication, you will be prompted for the username and password you created.

Once logged in, you will be greeted with a comprehensive dashboard full of graphs detailing your system’s load, kernel usage, memory allocation, network traffic, and much more.

Conclusion

You have now successfully installed and secured Monitorix on your Ubuntu 20.04 server. This powerful, lightweight tool provides you with the critical insights needed to monitor system health, troubleshoot performance issues, and make informed decisions about resource management. Take some time to explore the different graphs and familiarize yourself with the wealth of data at your fingertips.

Source: https://kifarunix.com/install-monitorix-on-ubuntu/

900*80 ad

      1080*80 ad