How To Install Monitorix on AlmaLinux 8: Free Monitoring Tool

Posted on

How To Install Monitorix on AlmaLinux 8: Free Monitoring Tool

How To Install Monitorix on AlmaLinux 8: Free Monitoring Tool

This guide will walk you through the process of installing Monitorix on AlmaLinux 8. Monitorix is a powerful, free, and open-source system monitoring tool. It’s designed to track a wide range of system resources and services on your Linux server. This versatile tool is built around two core components: the Monitorix daemon, which is written in Perl and handles the actual data logging, and its web interface, driven by the CGI script, monitorix.cgi, which provides a visual representation of the collected data.

Beyond simply tracking overall system load, file system activity, and kernel usage, Monitorix also delves into hardware details. It can monitor subsystem temperatures, battery status (if applicable), and UPS statistics. Furthermore, it seamlessly integrates with popular third-party Linux applications, providing insights into mail servers, libvirt-based virtual machines, and database systems like MySQL, Nginx, and MongoDB.

Now, let’s get started with the installation and configuration of Monitorix on AlmaLinux 8. Follow the steps outlined below to set up this invaluable monitoring tool on your server.

Before proceeding, ensure you have a non-root user with sudo privileges and a basic firewall configured on your AlmaLinux 8 server. If you haven’t already done so, refer to our guide on Initial Server Setup with AlmaLinux 8 for detailed instructions.

Installation Steps of Monitorix on AlmaLinux 8

Installing Monitorix is a straightforward process. Follow these steps:

  1. Update Package Index: Begin by updating your local package index to ensure you have the latest package information.

    sudo dnf update
  2. Install EPEL Repository: Install the Extra Packages for Enterprise Linux (EPEL) repository. This repository provides additional packages not found in the default AlmaLinux repositories, including Monitorix.

    sudo dnf install epel-release -y
  3. Install Monitorix and Dependencies: Install Monitorix along with its required Perl modules. These modules provide the necessary functionality for Monitorix to collect and display system data.

    sudo dnf install monitorix perl-CGI perl-HTTP-Server-Simple perl-rrdtool perl-Config-General perl-LWP-Protocol-https perl-LWP-Protocol-http10 -y
  4. Verify Installation: Once the installation is complete, verify it by checking the Monitorix version.

    monitorix -v
    **<mark>Output</mark>**
    Monitorix version 3.15.0 (07-Dec-2022)

Manage Monitorix Service

After installation, you need to manage the Monitorix service.

  1. Enable and Start Monitorix Service: Enable the Monitorix service to start automatically at boot time and start it immediately.

    sudo systemctl enable --now monitorix
  2. Verify Service Status: Verify that the Monitorix service is active and running.

    sudo systemctl status monitorix
    **<mark>Output</mark>**
    ● monitorix.service - Monitorix
       Loaded: loaded (/usr/lib/systemd/system/monitorix.service; enabled; vendor p>
       Active: **<mark>active</mark>** (**<mark>running</mark>**) since Sat 2023-05-06 04:06:35 EDT; 14s ago
         Docs: man:monitorix(8)
      Process: 50968 ExecStart=/usr/bin/monitorix -c /etc/monitorix/monitorix.conf >
     Main PID: 50969 (/usr/bin/monito)
        Tasks: 2 (limit: 23668)
       Memory: 74.7M
       CGroup: /system.slice/monitorix.service
               └─50969 /usr/bin/monitorix -c /etc/monitorix/monitorix.conf -p /run/>
               └─51032 monitorix-httpd listening on 8080

Monitorix Config on AlmaLinux 8

The Monitorix configuration is stored in a single plain text file: /etc/monitorix/monitorix.conf. You’ll likely need to make a few adjustments to this file to tailor Monitorix to your specific environment.

  1. Backup Configuration File: Before making any changes, create a backup of the original configuration file.

    sudo cp /etc/monitorix/monitorix.conf /etc/monitorix/monitorix.conf.backup
  2. Edit Configuration File: Open the configuration file using your preferred text editor. Here, we use the vi editor.

    sudo vi /etc/monitorix/monitorix.conf
  3. Modify Settings: Adjust the settings within the configuration file to match your requirements. Here are some key settings to consider:

    # line 6: change to any title you like
    title = **<mark>Monitorix</mark>**
    
    # line 7: change to your hostname
    hostname = **<mark>your-hostname</mark>**
    
    # line 8: background color of admin site
    theme_color = **<mark>black</mark>**
    
    # line 12: change network units to bps (default is Bytes per/sec)
    netstats_in_bps = **<mark>y</mark>**
    
    # 28-43: change if you need
    <httpd_builtin>
            enabled = y
            host =
            port = 8080
            user = nobody
            group = nobody
            log_file = /var/log/monitorix-httpd
            # if enable permission for admin site, add settings
            hosts_deny = **<mark>all</mark>**
            hosts_allow = **<mark>10.0.0.0/24</mark>**
            autocheck_responsiveness = y
            <auth>
                    # if enable Basic auth, turn to [y]
                    enabled = n
                    msg = Monitorix: Restricted access
                    htpasswd = /var/lib/monitorix/htpasswd
            </auth>
    </httpd_builtin>
    
    # line 76: set kind of graphs you'd like to monitor
    # Graphs (de)activation
    # -----------------------------------------------------------------------------
    <graph_enable>
            system          = y
            kern            = y
            proc            = y
            hptemp          = n
            lmsens          = n
            gensens         = n
            ipmi            = n
            ambsens         = n
            nvidia          = n
            disk            = y
    .....
    .....
    • title: Sets the title displayed in the Monitorix web interface.
    • hostname: Specifies the hostname of the server being monitored.
    • theme_color: Adjusts the background color of the web interface.
    • netstats_in_bps: Changes the network statistics units to bits per second (bps) instead of bytes per second.
    • <httpd_builtin>: Configures the built-in web server.
      • port: Sets the port Monitorix listens on (default is 8080).
      • hosts_allow: Restricts access to the Monitorix web interface to specific IP addresses or networks.
      • <auth>: Enables basic authentication to protect the web interface with a username and password.
    • <graph_enable>: Enables or disables specific graphs for different system components.
  4. Save and Close: Once you’ve made the necessary changes, save the file and exit the editor.

  5. Restart Monitorix Service: To apply the changes, restart the Monitorix service.

    sudo systemctl restart monitorix

Configure Firewall for Monitorix

If you have a firewall enabled, you need to allow access to port 8080, the default port used by Monitorix’s built-in web server.

  1. Open Port in Firewall: Open port 8080 in the firewall.

    sudo firewall-cmd --add-port=8080/tcp --permanent
  2. Reload Firewall: Reload the firewall to apply the new rule.

    sudo firewall-cmd --reload

Access Monitorix Web Interface

Now you can access the Monitorix web interface through your web browser.

  1. Open Web Browser: Open your web browser and enter the server’s IP address followed by :8080/monitorix.

    http://server-ip-address:8080/monitorix
  2. Select Graphs: On the initial screen, choose the graph you want to view and select the time frame (daily, weekly, monthly, or yearly). Click "OK" to display the graph.

    Monitorix 1
  3. View Graphs: You can now view the graphs and monitor your server’s performance.

    Monitorix graphs

Conclusion

Monitorix provides you with an accessible and powerful tool to keep an eye on your system’s health and performance. You have now successfully learned how to Install Monitorix on AlmaLinux 8 and configure it to monitor your server.

Hope you enjoy using Monitorix. You might also be interested in these articles:

Enable Brotli Compression in Nginx on AlmaLinux 9

Install Portainer on Rocky Linux 8

Set up ionCube Loader on Rocky Linux 8

Alternative Solutions for System Monitoring on AlmaLinux 8

While Monitorix is a great choice for system monitoring, there are other options available that might better suit specific needs or preferences. Here are two alternative solutions:

1. Netdata

Netdata is a real-time performance monitoring tool that provides highly detailed insights into system and application behavior. It’s known for its ease of use, comprehensive metrics collection, and beautiful, interactive dashboards.

Explanation:

Unlike Monitorix, which relies on Perl and CGI scripts, Netdata is written in C and uses a highly efficient data collection engine. This allows it to collect and visualize a much larger number of metrics with minimal performance overhead. Netdata automatically detects and configures itself to monitor a wide range of services and applications, making it very easy to set up. Its dashboards are dynamic and interactive, allowing you to zoom in on specific time periods and drill down into individual metrics.

Installation and Configuration (Simplified):

  1. Install Netdata:

    bash <(curl -Ss https://my-netdata.io/kickstart.sh)
  2. Access Web Interface:

    Open your web browser and navigate to http://your-server-ip:19999.

Code Example (Configuration – optional, for advanced customization):

Netdata’s configuration files are located in /etc/netdata/. You can modify these files to customize the metrics collected, the appearance of the dashboards, and other aspects of Netdata’s behavior. For example, to configure email alerts, you would edit the /etc/netdata/health.d/critical.conf file.

# Example: Sending email alerts for high CPU usage

on system.cpu.util percentage > 90
  warn: CPU usage is high
  delay: down 1m
  units: percentage
  every: 1m
  to: sysadmin@example.com

2. Prometheus and Grafana

Prometheus is a powerful, open-source monitoring and alerting toolkit that’s particularly well-suited for dynamic environments and microservices architectures. Grafana is a popular data visualization tool that integrates seamlessly with Prometheus, providing a rich and customizable dashboarding experience.

Explanation:

Prometheus works by scraping metrics from targets at regular intervals. These metrics are stored in a time-series database. Grafana then queries Prometheus to retrieve the metrics and display them in graphs, charts, and other visualizations. This combination provides a highly flexible and scalable monitoring solution. While the initial setup can be more complex than Monitorix or Netdata, the long-term benefits in terms of scalability and customizability are significant.

Installation and Configuration (Simplified):

  1. Install Prometheus: Download the latest Prometheus binary from the official website, extract it, and configure it to scrape metrics from your server.

  2. Install Grafana:

    sudo dnf install -y grafana
    sudo systemctl start grafana-server
    sudo systemctl enable grafana-server
  3. Configure Prometheus as a Data Source in Grafana: Access the Grafana web interface (usually at http://your-server-ip:3000), add Prometheus as a data source, and create dashboards to visualize your metrics.

Code Example (Prometheus Configuration – prometheus.yml):

This example configures Prometheus to scrape metrics from itself and from a node exporter (which collects system-level metrics).

global:
  scrape_interval:     15s
  evaluation_interval: 15s

scrape_configs:
  - job_name: 'prometheus'
    static_configs:
      - targets: ['localhost:9090']

  - job_name: 'node_exporter'
    static_configs:
      - targets: ['localhost:9100']

To monitor system metrics, you’ll need to install and configure the node exporter:

sudo dnf install -y prometheus-node-exporter
sudo systemctl start prometheus-node-exporter
sudo systemctl enable prometheus-node-exporter

These alternative solutions provide different approaches to system monitoring, each with its own strengths and weaknesses. Consider your specific needs and technical expertise when choosing the best monitoring tool for your AlmaLinux 8 server. Each tool offers a way to keep your systems healthy.

Leave a Reply

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