Install Munin on Ubuntu 20.04 for server monitoring

Munin is a complete computer monitoring software, especially servers. It helps system administrators to collect various system information that can be viewed through a web interface such as CPU load, hard disk usage, network traffic, access to server services on single or multiple computers, etc.

It is suitable for monitoring a single server or a large number of servers. Munin itself is configured as a master/client application. If there are multiple machines to be monitored, the server with the main instance of Munin acts as the master, information from all machines is collected and evaluated on it; while other servers or machines will be called nodes, which only collect data from 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 monitoring an entire computer network. If you are looking for Munin open source alternatives, Nagios and Icinga are among them.

Munin Monitoring Steps on Ubuntu 20.04 LTS Linux

1. Switch to root user

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

sudo -i

2. Run Ubuntu System Update

Before going any 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 set up a web server on Ubuntu to access the web interface over a Munin network. Therefore, use the command below 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, so we don’t need to add any additional or additional repositories to our system.

apt install munin

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

If your server or the remote server you want to monitor also has a Mysql or MariaDB database, monitoring it also activates some additional 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 the Munin configuration file:

nano /etc/munin/munin.conf

In the file delete the # symbol placed 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+Opress the Walk in key, then CTRL+X to exit the file.

5. Configure Apache for Munin Server Monitoring

We already have a pre-built Apache configuration file for Munin in its directory, so just symlink this file for Apache.

Navigate to Apache’s configuration directory.

cd /etc/apache2/conf-enabled

Create a symbolic link

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

(optional) If you want to access the Munin web interface outside of your localhost, i.e. the server where you have installed this server monitoring tool, 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 Nothing for FollowSymLinks SymLinksIfOwnerMatch

See the screenshot below to get an idea. While to save the file press CTRL+Opress the Walk in key, then CTRL+X to exit the file.

Configure Apache Web Server for Munin Server Monitoring

Restart Apache:

systemctl restart apache2

Restart the Munin service

systemctl restart munin munin-node

To check the status

systemctl status munin munin-node

Munin service status on Ubuntu

6. Access the 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

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

7. Configure Node to monitor multiple systems

If you want to monitor remote Linux systems, first install the Munin node in it:

sudo apt install munin-node

After that, modify the node configuration file:

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

Add the Munin main server IP address where you want to collect node system statistics. In the format below.

For example, our master server IP address is 192.168.0.108. The format will therefore be as follows:

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 in its configuration file that you want to monitor there.

sudo nano /etc/munin/munin.conf

Add the Node address in the format below:

[node0.example.com]
       address 192.168.0.106
         use_node_name yes

Change the address and domain values ​​to yours in the above format.

Save the file CTRL+Ohurry Walk in key, and to quit use CTRL+X.

configure ubuntu remote system server monitoring

Reload Munin:

sudo service munin restart

Now on your Munin web interface you will have the added node:

Munin node configuration web interface


Source link