Wednesday, October 9, 2024
HomeHow toHow to Install Munin Monitoring Tool on Ubuntu 22.04

How to Install Munin Monitoring Tool on Ubuntu 22.04

Munin is a free, open-source system and powerful network monitoring tool for Linux. It provides a web-based interface to display all information in a graph. It uses a client-server model to monitor the resources of remote machines via a web browser. It enables network or system administrators to collect system information such as processor load, hard disk usage, network traffic, access to server services on one or more machines, and more. Munin is written in Perl and uses RRDtool to display collected information via graphs

Features

Munin offers a lot of useful features. Some of them are listed below:

  • Easy to Install – Munin software can be installed easily within 10 minutes.
  • Scalable – This allows you to monitor up to 100+ node clusters from the Munin system.
  • Real-time alerts – Munin polls nodes every 5 minutes. If something goes wrong, it will notify you immediately.
  • Flexible – Comes with 500+ plugins to monitor every service running on your server.
  • Extensible – It is customizable. So you can create your own custom plugin to supervise whatever you want.

This tutorial will show you how to install the Munin monitoring tool on Ubuntu 22.04.

Prerequisites

  • A server running Ubuntu 22.04.
  • A root password is configured on the server.

Update the System

First, you will need to update your system package cache to the updated version. You can update all the package cache using the following command:

apt update -y
apt upgrade -y

Once your system is updated, you can proceed to the next step.

Install Apache Web Server

Munin can run with many web servers including, Apache, Nginx, and Lighttpd. In this post, we will use Apache to run Munin.

You can install the Apache and other required packages with the following command:

apt-get install apache2 apache2-utils libcgi-fast-perl libapache2-mod-wsgi-py3 libapache2-mod-fcgid -y

Once all the packages are installed, you will also need to enable the fcgid module. You can enable it using the following command:

a2enmod fcgid

Once you are done, restart the Apache service to apply the changes:

systemctl restart apache2

Once you are finished, you can proceed to install Munin.

By default, the Munin package is included in the Ubuntu 22.04 default repository. You can install the Munin with other required packages using the following command:

apt-get install munin munin-node munin-plugins-extra -y

After installing all the packages, you will need to create an admin account and password to access Munin.

You can create it using the following command:

htpasswd -c /etc/munin/munin-htpasswd admin

Set your admin password as shown below:

New password: 
Re-type new password: 
Adding password for user admin

Once you are finished, you can proceed to the next step.

Configure Apache for Munin

Munin creates an Apache configuration file at /etc/munin/apache24.conf during the installation. You will need to copy it inside the Apache configuration directory.

cp -p /etc/munin/apache24.conf /etc/apache2/sites-available/munin.conf

Next, edit the Munin configuration file with the following command:

nano /etc/apache2/sites-available/munin.conf

Make the following changes:

ScriptAlias /munin-cgi/munin-cgi-graph /usr/lib/munin/cgi/munin-cgi-graph
Alias /munin/static/ /var/cache/munin/www/static/

<Directory /var/cache/munin/www>
AuthUserFile /etc/munin/munin-htpasswd
Authtype Basic
AuthName "Munin"
Require valid-user
Options FollowSymLinks SymLinksIfOwnerMatch
Options None
</Directory>

<Directory /usr/lib/munin/cgi>
AuthUserFile /etc/munin/munin-htpasswd
Authtype Basic
AuthName "Munin"
Require valid-user
Options FollowSymLinks SymLinksIfOwnerMatch

<IfModule mod_fcgid.c>
SetHandler fcgid-script
</IfModule>
<IfModule !mod_fcgid.c>
SetHandler cgi-script
</IfModule>
</Directory>

Alias /munin /var/cache/munin/www

Save and close the file then enable the Munin virtual host with the following command:

a2ensite munin

Next, restart the Apache and Munin service to apply the changes:

systemctl restart apache2
systemctl restart munin-node

You can check the status of the Munin with the following command:

systemctl status munin-node

You will get the following output:

? munin-node.service - Munin Node
     Loaded: loaded (/lib/systemd/system/munin-node.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2022-07-18 09:29:01 UTC; 6s ago
       Docs: man:munin-node(1)
             http://guide.munin-monitoring.org/en/stable-2.0/reference/munin-node.html
   Main PID: 4987 (munin-node)
      Tasks: 1 (limit: 4579)
     Memory: 9.3M
        CPU: 975ms
     CGroup: /system.slice/munin-node.service
             ??4987 /usr/bin/perl -wT /usr/sbin/munin-node --foreground

Jul 18 09:29:00 ubuntu2204 systemd[1]: Starting Munin Node...
Jul 18 09:29:01 ubuntu2204 systemd[1]: Started Munin Node.

You can also check the Apache status with the following command:

systemctl status apache2

You will get the following output:

? apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2022-07-18 09:28:52 UTC; 32s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 4921 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 4925 (apache2)
      Tasks: 56 (limit: 4579)
     Memory: 13.8M
        CPU: 153ms
     CGroup: /system.slice/apache2.service
             ??4925 /usr/sbin/apache2 -k start
             ??4926 /usr/sbin/apache2 -k start
             ??4927 /usr/sbin/apache2 -k start
             ??4928 /usr/sbin/apache2 -k start

Jul 18 09:28:52 ubuntu2204 systemd[1]: Starting The Apache HTTP Server...

Access Munin Web Interface

At this point, Munin is installed and configured with the Apache web server. Now, open your web browser and access the Munin web interface using the URL http://your-server-ip/munin. You will be redirected to the Munin login page:

Provide your admin username, password, and click on the Sign in button. You should see the Munin dashboard on the following page:

Click on the disk in the left pane. You should see the disk related information in the following screen:

Click on the processes. You should see the process related information in the following screen:

Click on the network. You should see the network related information in the following screen:

Conclusion

Congratulations! You have successfully installed the Munin monitoring server on Ubuntu 22.04. You can now explore the Munin features, add some remote machines to the Munin server and start monitoring and analyzing them from the web-based interface. Feel free to ask me if you have any questions.


RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here


Most Popular