How to Install and Configure Munin on Ubuntu Server 12.04

in How To, Monitoring

This tutorial explains How to install and configure Munin on ubuntu server 12.04 LTS, With munin you can easily monitor the performance of your Ubuntu Server stats, networks, running apps on a simple to read website. It makes it easy to determine “what’s different today” when a performance problem crops up. It makes it easy to see how you’re doing capacity-wise on any resources.

There are two parts of Munin Monitoring Software, Munin Master and Munin node.  Munin Server is the software website and configuration for what stats are pulled and what domains are monitored.  Munin Node is the actual software that monitors the server and produces the stats for Munin Master.

Install Munin on Ubuntu Server

Step 1 . Make sure your package repositories and installed programs are up to date by typing following commands:

sudo apt-get update

Step 2 . Make sure apache2 already installed on your ubuntu server then install munin package:

sudo apt-get install apache2
sudo apt-get install munin munin-node

After installing munin done, you can access it from browser by typing 127.0.0.1/munin or localhost/munin. But, it’s forbidden if accessed from another like (domain/munin). you can open and edit file /etc/munin/apache.conf.

sudo nano /etc/munin/apache.conf

Change Allow from 127.0.0.1 ::1 into Allow from all

Alias /munin /var/cache/munin/www
<Directory /var/cache/munin/www>
       Order allow,deny
#      Allow from localhost 127.0.0.0/8 ::1
       Allow from all
       Options None
# This file can be used as a .htaccess file, or a part of your apache
# config file.
#
# For the .htaccess file option to work the munin www directory
# (/var/cache/munin/www) must have "AllowOverride all" or something
# close to that set.
#
#      AuthUserFile /etc/munin/munin-htpasswd
#      AuthName "Munin"
#      AuthType Basic
#      require valid-user
# This next part requires mod_expires to be enabled.
#
# Set the default expiration time for files to 5 minutes 10 seconds from
# their creation (modification) time. There are probably new files by
# that time.
#
      <IfModule mod_expires.c>
             ExpiresActive On
             ExpiresDefault M310
      </IfModule>
</Directory>

Munin localdomain localhost.localdomain if eth0 Ubuntu Server How to Install and Configure Munin on Ubuntu Server 12.04

Protect The Munin Output Directory with Password

To protect the munin Output Directory with Password, open and edit /etc/munin/apache.conf with following configuration below:

sudo nano /etc/munin/apache.conf
Alias /munin /var/cache/munin/www
<Directory /var/cache/munin/www>
       Order allow,deny
#      Allow from localhost 127.0.0.0/8 ::1
       Allow from all
       Options None
#      This file can be used as a .htaccess file, or a part of your apache
#      config file.
#
#      For the .htaccess file option to work the munin www directory
#      (/var/cache/munin/www) must have "AllowOverride all" or something
#      close to that set.
#
       AllowOverride None
       AuthUserFile /etc/munin/munin-htpasswd
       AuthName "Munin"
       AuthType Basic
       require valid-user
#      This next part requires mod_expires to be enabled.
#
#      Set the default expiration time for files to 5 minutes 10 seconds from
#      their creation (modification) time. There are probably new files by
#      that time.
#
      <IfModule mod_expires.c>
               ExpiresActive On
               ExpiresDefault M310
      </IfModule>
</Directory>

You must create the password for /etc/munin/munin-htpasswd. on this case we want to log in to munin with the username Munin, run the following command:

sudo htpasswd -c /etc/munin/munin-htpasswd Munin

Enter a password for Munin, restart your apache and munin-node, you’re done!

sudo service apache2 restart
sudo service munin-node restart

Access it from your favorite browser , on address bar type http://host/munin

Munin Authentication How to Install and Configure Munin on Ubuntu Server 12.04

Munin localdomain localhost.localdomain cpu Ubuntu Server How to Install and Configure Munin on Ubuntu Server 12.04

 

Advertisement:
  • riccardo

    thanks for this tutorial, could you write a guide where you explain how to add other hosts for their controlls? thanks a lot…

  • i82blikeu

    thanks a lot, man!

  • jakke

    This tutorial should be called “How to install Munin on precise”
    There’s no configuration part, which is why most people will come and check this out…

  • http://www.claimid.com/koolinus kOoLiNuS

    everything is up and running since 6 hours … but I do not have any graph drawed and at the bottom of each panel I have a ‘-nan’ message.

    I do have AppArmor enabled … is that causing the problem ???

    • http://www.claimid.com/koolinus kOoLiNuS

      Solved by myself … I did mispell something in the virtualhost path declaration. After setting it out all works regularly now …

  • Witkoz

    Worked like a charm. Thanks!

Previous post:

Next post: