How to install Munin on Ubuntu and CentOS

Munin is a free monitoring system that allows you to collect data from multiple servers and display it in graphs. This article covers installation and basic configuration on both Ubuntu and CentOS.

Architecture

Munin uses a master/node model:

  • munin (master): collects data and generates graphs/HTML reports.
  • munin-node: runs on each monitored server and exposes metrics.

Installing on Ubuntu/Debian

Install the master and node

sudo apt-get update
sudo apt-get install munin munin-node

Configure the node

Edit /etc/munin/munin-node.conf and make sure the master is allowed to connect:

allow ^127\.0\.0\.1$
allow ^::1$
# Add your master IP if it's a remote server:
# allow ^203\.0\.113\.10$

Configure the master

Edit /etc/munin/munin.conf and add the hosts to monitor:

[localhost]
    address 127.0.0.1
    use_node_name yes

[remote-server]
    address 203.0.113.20
    use_node_name yes

Start services

sudo service munin-node start
sudo update-rc.d munin-node enable

Munin master runs via cron (every 5 minutes by default). Graphs are generated in /var/cache/munin/www/.

Installing on CentOS

Add the EPEL repository

sudo yum install epel-release

Install packages

sudo yum install munin munin-node

Configure the node

Edit /etc/munin/munin-node.conf:

allow ^127\.0\.0\.1$

Configure the master

Edit /etc/munin/munin.conf:

[localhost]
    address 127.0.0.1
    use_node_name yes

Start and enable services

sudo service munin-node start
sudo chkconfig munin-node on

Accessing the web interface

Set up a web server (Apache or Nginx) to serve /var/cache/munin/www/. For Apache on Ubuntu:

sudo apt-get install apache2

Munin includes an Apache config at /etc/munin/apache24.conf — symlink it:

sudo ln -s /etc/munin/apache24.conf /etc/apache2/conf-enabled/munin.conf
sudo service apache2 restart

Then browse to http://your-server-ip/munin.

On this page