Munin is an open-source infrastructure monitoring tool. It uses RRDtool to create the graph for your infrastructure monitoring. It can be used to monitor computers, servers, and infrastructure. Munin is mainly written in Perl and has a master/node architecture.
With the Munin master, you can centralize the monitoring of your infrastructure and network devices, and the Munin node is the monitoring target. The Munin master can be operated with reverses such as Apache or Nginx.
In this tutorial, we will guide you through installing the Munin server monitoring tool on the Debian Linux server. First, you install the Apache2 web server and some dependencies, then Munin from the Debian repository. Then, a Linux host will be added to the Munin server for monitoring.
Prerequisites
Below, you will find some prerequisites for the installation of Munin:
- Two or more Debian 11 and Debian 12 servers. In this example, we will use 2 Debian servers, the munin-server and linux-host1.
- One non-root user with sudo/root privileges on all servers.
Installing the dependencies
Munin is a server monitoring tool that can be run under the Apache2 web server. Now install the Apache2 web server with additional modules such as libcgi and fcgid for Apache2.
First, update your package list using the apt command below.
sudo apt update
Next, install the Apache2 web server and some modules needed for the Munin installation.
sudo apt install apache2 apache2-utils libcgi-fast-perl libapache2-mod-fcgid
Enter Y when prompted to confirm the installation and press ENTER.
After installing the Aapche2 web server, activate the fcgid module with the following command.
sudo a2enmod fcgid
Now you can check the Aache2 service with the following systemctl command.
In your terminal output, you will see that the apache2 service is activated and is automatically executed when booting. And the status of the apache2 service is “running”.
sudo systemctl is-enabled apache2 sudo systemctl status apache2
Now you have installed the Apache2 web server and the libcgi and fcgid modules. Next, we will install Munin.
Installing the Munin server monitoring tool
After you have installed the Apache2 web server, install Munin from the official Debian repository. Then, Munin was set up with the Apache2 web server.
This example uses the computer munin-server as Munin’s master server. You must install the munin package on the master server.
Install the munin package using the following apt command. When prompted to confirm the installation, type Y and press ENTER.
sudo apt install munin
After installing munin, set up munin to run with the Apache2 web server and secure it with the basic authentication of the Apache module basic_auth.
Execute the following htpasswd command to create a new password file for munin. In this example, we will use the username munin and the password file will be created under“https://vitux.com/etc/munin/.munin-htpasswd“.
sudo htpasswd -c /etc/munin/.munin-htpasswd munin
You will be prompted to enter your user’s password. Ensure you enter a strong password, repeat the password, and then press ENTER.
Next, copy the example Munin configuration for Apache2 to“https://vitux.com/etc/apache2/sites-available/munin.conf“.
This configuration lets you start Munin with the Apache2 web server and the URL path “https://vitux.com/munin”.
sudo cp -p /etc/munin/apache24.conf /etc/apache2/sites-available/munin.conf
Now open the file“https://vitux.com/etc/apache2/sites-available/munin.conf” with the nano editor.
sudo nano /etc/apache2/sites-available/munin.conf
Change the default configuration with the new settings as below. In this example, you add the basic authentication for Munin via the password file“https://vitux.com/etc/munin/.munin-htpasswd” and the Apache2 module“basic_auth“.
# enable basic auth AuthUserFile /etc/munin/.munin-htpasswd Authtype Basic AuthName "Munin" Require valid-user Options FollowSymLinks SymLinksIfOwnerMatch Options None # enable basic auth AuthUserFile /etc/munin/.munin-htpasswd Authtype Basic AuthName "Munin" Require valid-user Options FollowSymLinks SymLinksIfOwnerMatch Require local SetHandler fcgid-script SetHandler cgi-script
Save the file and exit the editor when you are finished.
Next, run the following a2ensite command to activate the Apache2 configuration file munin.conf. This command creates a symlink from the munin.conf file to the“https://vitux.com/etc/apache2/sites-enabled/munin.conf” file.
sudo a2ensite munin.conf
Now run the following systemctl command to restart the Apache2 service and apply the new configuration file. No error message will be displayed if your Apache2 configuration is configured correctly.
sudo systemctl restart apache2
Then, enable the Munin service and check its status with the following systemctl command.
sudo systemctl enable munin sudo systemctl status munin
If Munin is installed correctly, you will see that the status of the Munin service is active.
Open your web browser and call up the IP address of the server followed by the URL path“https://vitux.com/munin” (e.g. http://192.168.5.100/munin/).
You will be prompted for basic authentication by the login pop-up. Enter your user and password and then click on“Login”.
You will see the Munin Server Monitoring Tool page if you have entered the correct user and password.
Now, you have installed the Munin Server Monitoring Tool as a master. Next, we will add a new Linux host for monitoring.
Adding a host to Munin server monitoring
To add the host to be monitored to the Munin master server, you need to install the “munin-node” package on your Linux hosts. The Debian/Ubuntu-based operating system defaults to Munin packages, while RHEL/CentOS/Rocky Linux/Alma Linux can install Munin packages via the EPEL repository.
For Debian/Ubuntu-based systems, install the “munin-node” package using the apt command below. By default, Debian/Ubuntu provides packages for Munin.
sudo apt install munin-node
You can add the EPEL repository on the host machine for RHEL/CentOS/Rocky Linux/Alma Linux. Then, install the package “munin-node” with the dnf command described below.
sudo dnf install epel-release sudo dnf install munin-node
Next, open the configuration file “https://vitux.com/etc/munin/munin-node.conf” with the nano editor.
sudo nano /etc/munin/munin-node.conf
Change the line “host_name” with the hostname of the computer. Then add the IP address of the Munin master in regex format to the line “allow“. Then change the IP address with the IP address of your Linux host in the line “host“.
# hostname of Linux host host_name linux-host1 # IP address of Munin master allow ^192.168.5.100$ # IP address of Linux host host 192.168.5.120
When you are finished, save and exit the nano text editor.
Now execute the following systemctl command to restart the “munin-node” service and apply the new configuration file.
sudo systemctl restart munin-node
Then activate the munin-node service so that it runs automatically at boot time. Then, make sure that the munin-node service is running.
sudo systemctl enable munin-node sudo systemctl status munin-node
If your munin-node is installed correctly, you will see the output that the munin-node service is running.
Next, switch to the munin master server “munin-server“.
Open the Munin configuration file“https://vitux.com/etc/munin/munin.conf” with the nano editor.
sudo nano /etc/munin/munin.conf
Add the Linux host computer with the configuration below to the Munin master. Change the host’s name and the Linux host’s IP address.
[dbserver.local-env.com] address 192.168.5.120 use_node_name yes
Save the file and exit the editor when you are finished.
Now run the following command to restart the Munin service and apply the new changes to the Munin master.
sudo systemctl restart munin
You must wait at least 5 minutes to get all the graphs from the Linux host.
Now, go back to the Munin dashboard to see that the new host has been added. In this example, the new Linux host is “dbserver.local-env.com“.
Status of the Munin node.
Click on the detailed host “munin.local-env.com” and you will see the graph showing the status of the Linux host.
Conclusion
Congratulations! You have installed the Munin Server Monitoring Tool on your Debian server. You have also added a Linux host to the Munin master server for monitoring. Now, you can add more servers to monitor some basic services in your server infrastructure.