Install Munin on Ubuntu 20.04 for Server Monitoring

Munin is a comprehensive software for monitoring computers, especially servers. It helps the system administrators to collect various system information that can be viewed via a web interface such as processor load, hard disk usage, network traffic, access to server services on one or more computers, and more…

It is suitable for monitoring a single server or a large number of servers. Munin itself is set up as a master/client application. If there are several machines to be monitored then the server with Munin main instance act as a Master, the information from all machines is collected and evaluated on this; whereas other servers or machine will be known as nodes, that only collect data on the local machine and make it available to the master.

The master computer can query the “Munin node” on other computers in the network and thus display the information. Munin is therefore suitable for monitoring a single computer as well as for monitoring an entire computer network. If you are looking for Munin open-source alternatives then Nagios and Icinga are some of them.

Steps to Munin Monitoring on Ubuntu 20.04 LTS Linux

1. Switch to root user

Open command terminal or access the server via SSH. And then switch to root user for installing and setup the Munin Server monitoring solution.

sudo -i

 

2. Run Ubuntu system update

Before moving further let’s first run the system update command to refresh the system repository cache and install a new available version of the existing packages on the system.

apt update

 

3. Install Apache and some other dependencies

We need to configure a web server on Ubuntu to access the web interface over a network of Munin. Therefore, use the below-given command to install Apache and other required packages.

apt install apache2 libcgi-fast-perl libapache2-mod-fcgid

 

4. Command to Install Munin on Ubuntu 20.04 Server

Munin can be installed from package sources on Ubuntu, hence we don’t need to add any additional or extra repository on our system.

apt install munin

The above command will install Munin, Munin-node, and Munin plugins extra.

If your server or the remote server that you want to monitor also has Mysql or MariaDB database then to monitor it also enables few extra Munin plugins.

cd /etc/munin/plugins
ln -s /usr/share/munin/plugins/mysql_ mysql_
ln -s /usr/share/munin/plugins/mysql_bytes mysql_bytes
ln -s /usr/share/munin/plugins/mysql_innodb mysql_innodb
ln -s /usr/share/munin/plugins/mysql_isam_space_ mysql_isam_space_
ln -s /usr/share/munin/plugins/mysql_queries mysql_queries
ln -s /usr/share/munin/plugins/mysql_slowqueries mysql_slowqueries
ln -s /usr/share/munin/plugins/mysql_threads mysql_threads

Also, enable logs and other directories required to store data generated by Munin.

Edit Munin configuration file:

nano /etc/munin/munin.conf

In the file delete the # symbol given in front of the following lines to uncomment them. For more information, you can see the screenshot.

dbdir /var/lib/munin
htmldir /var/cache/munin/www
logdir /var/log/munin
rundir /var/run/munin

To save the file press Ctrl+O, press the Enter key, and then Ctrl+X to exit the file.

Enable Munin Log and HTML

 

5. Configure Apache for Munin Server monitoring

We already have a pre-build Apache configuration file for Munin inside its directory, hence, just create a Symbolic link of that file for Apache.

Go to Apache configuration directory.

cd /etc/apache2/conf-enabled

Create Symbolic Link 

ln -s /etc/munin/apache24.conf munin.conf

 

(optional) If you want to access the Munin Web interface outside your localhost, which means the server where you have installed this Server monitoring tool, then edit the Munin Apache configuration file.

nano /etc/munin/apache24.conf

Now, add the # symbol in front of the line “Require local” and after that add

Require all granted

And also change the Options value from None to FollowSymLinks SymLinksIfOwnerMatch

See the below screenshot to get an idea. Whereas to save the file press Ctrl+O, press the Enter key, and then Ctrl+X to exit the file.

Configure Apache web server for Munin Server monitoring

Restart Apache:

systemctl restart apache2

Restart Munin service

systemctl restart munin munin-node

To check the status

systemctl status munin munin-node

Munin Service Status on Ubuntu

 

6. Access Munin Server Web interface

Now, open a local or remote browser and point it to your Munin server IP-address along with a directory of it. For example:

http://server-ip-address/munin

Change Server-IP address with the actual address or domain name of your server.

Munin Server monitoring on Ubuntu 20.04

 

7. Setup Node to monitor multiple systems

If you want to monitor remote Linux systems then first install Munin node in that:

sudo apt install munin-node

After that edit the Node configuration file:

sudo nano /etc/munin/munin-node.conf

Add the Master Munin Server IP address where you want to collect the stats of the node system. In the below format.

For example, our master server ip-address is 192.168.0.108. So the format will be like this:

allow ^192\.168\.0\.108$

Set Node for Munin

Restart node service

sudo service munin-node restart

 

Now, go to Master Munin Server and add the node Ip-address there in its configuration file that you want to monitor there.

sudo nano /etc/munin/munin.conf

Add the Node Address in the below format:

[node0.example.com]
       address 192.168.0.106
         use_node_name yes

Change the address and domain values as per yours in the above format.

Save the file Crtrl+O, press Enter key, and to exit use Ctrl+X.

configure Server Monitoring of remote system Ubuntu

Reload Munin:

sudo service munin restart

 

Now, on your Munin Web interface you will have the added Node:

Munin Node Configuration web interface

 

 

2 thoughts on “Install Munin on Ubuntu 20.04 for Server Monitoring”

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.