Munin is an excellent system monitoring tool similar to RRD tool which will give you ample information about system performance on multiple fronts like a disk, network, process, system, and users. These are some of the default properties Munin monitors.

How Munin works?

Munin works on a client-server model. Munin server process on the main server try to collect data from client daemon which is running locally(Munin can monitor it’ss own resources) or from a remote client(Munin can monitor hundreds of machines) and displays them in graphs on it’s web interface.

Configuring Munin in nutshell

This is of two steps as we have to configure both server and client.
1)Install Munin server package and configure it so that it get data from clients.
2)Configure Munin client so that server will connect to client daemon for data collocation.

Install munin server in Linux

Munin server installation on Ubuntu/Debian based machines

apt-get install munin apache2

Munin server installation on Redhat/Centos based machines. Make sure that you enable EPEL repo before installing Munin on Redhat based machines as by default Redhat based machines do not have Munin in their repos.

yum install munin httpd

Configuring Munin server in Linux

Below are the steps we have to do in order to bring the server up.
1) Add host details which need monitoring in /etc/munin/munin.conf
2) Configure apache web server to include munin details.
3) Create Username and password for web interface
4) Restart apache server

Step 1: Add hosts entry in this file in /etc/munin/munin.conf. Go to the end of the file and a client to monitor. Here in this example, I added my DB server and it’s IP address to monitor

Example:

[db.linuxnix.com]
 address 192.168.1.25
 use_node_name yes

Save the file and exit.

Step 2: Edit/create munin.conf file in /etc/apache2/conf.d folder to include Munin Apache related configs. In another note, by default other Munin web related configs are kept in /var/www/munin folder.

vi /etc/apache2/conf.d/munin.conf

Content:

Alias /munin /var/www/munin
<Directory /var/www/munin>
 Order allow,deny
 Allow from localhost 127.0.0.0/8 ::1
 AllowOverride None
 Options ExecCGI FollowSymlinks
 AddHandler cgi-script .cgi
 DirectoryIndex index.cgi
 AuthUserFile /etc/munin/munin.passwd
 AuthType basic
 AuthName "Munin stats"
 require valid-user
 <IfModule mod_expires.c>
 ExpiresActive On
 ExpiresDefault M310
 </IfModule>
</Directory>

Save the file and exit

Step 3: Now create a username and password for viewing Munin graphs:

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

Note: For Redhat/Centos machines replace “apache2” with “httpd” in each path to access your config files.
Step 3: Restart Apache server so that Munin configurations are picked-up by Apache.

Ubuntu/Debian based:

service apache2 restart

Centos/Redhat based:

service httpd restart

Install and configure Munin client in Linux

Step 1: Install Munin client in Linux

apt-get install munin-node

Note: If you want to monitor your Munin server, then you have to install Munin-node on that as well.

Step 2: Configure client by editing Munin-node.conf file.

vi /etc/munin/munin-node.conf

Example:

allow ^127\.0\.0\.1$
allow ^10\.10\.20\.20$
# Which address to bind to;
host *
# And which port
port 4949

Note: 10.10.20.20 is my Munin server and it’s connections to 4949 port on client to get it’s data.

Step 3: Restart Munin-node on client server

service munin-node restart

Testing connection

Check if you are able to connect client from the server on 4949 port, otherwise, you have to open that port on the client machine.

telnet db.linuxnix.com 4949

Just a side note: We can send munin understandable commands like list, nodes, config, fetch etc. If you want to fetch CPU details execute below command once you connected to 4949 port.

fetch cpu
user.value 40755020
nice.value 125960
system.value 43575690
idle.value 46709201946
iowait.value 1081255
irq.value 3264
softirq.value 107719
steal.value 408952

Accessing Munin web interface

http://munin.linuxnix.com/munin/index.html

Hope this helps to configure basic Munin server.

The following two tabs change content below.
Mr Surendra Anne is from Vijayawada, Andhra Pradesh, India. He is a Linux/Open source supporter who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. He works as Devops Engineer with Taggle systems, an IOT automatic water metering company, Sydney . You can contact him at surendra (@) linuxnix dot com.