Install Munin on Ubuntu 20.04 for server monitoring

Munin is a complete software for monitoring computers, especially servers. It helps system administrators to collect various system information that can be viewed through a web interface, such as CPU load, hard drive usage, network traffic, access to server services on one or more 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 primary Munin instance acts as the master, information from all machines is collected and evaluated on them; while other servers or machines will be called nodes, which collect data only on the local machine and make it available to the master.

The master computer can query the “Munin node” on other computers on 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 open source alternatives Munin, Nagios and Icinga are among them.

Steps of Munin monitoring on Ubuntu 20.04 LTS Linux

1. Switch to the 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 the Ubuntu System Update

Before going any further, let’s first run the update system 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 through 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 extra or extra repository on our system.

apt install munin

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

If your server or the remote server you want to monitor also has a Mysql or MariaDB database, monitoring that also allows a few 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 the logs and other directories required to store the 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 + O, press the Enter key, then Ctrl + X to exit the file.

5. Configure Apache to monitor the Munin server

We already have a pre-built Apache config file for Munin in its directory, so just symbolic link this file for Apache.

Navigate to the Apache 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 Munin’s web interface outside of your local host, that is, the server where you installed this server monitoring tool, edit Munin’s 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 To FollowSymLinks SymLinksIfOwnerMatch

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

Configure the 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 the IP address of your Munin server with a directory of it. For example:

http://server-ip-address/munin

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

7. Configure the 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 edit the node configuration file:

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

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

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

allow ^192.168.0.108$

Set the node for Munin

Restart the 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 your own in the format above.

Save file Ctrl + O, hurry Enter key, and to quit use Ctrl + X.

configure remote Ubuntu system server monitoring

Recharge Munin:

sudo service munin restart

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

Munin node configuration web interface


Source link

Steven L. Nielsen

Leave a Reply

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