How to install munin on Ubuntu

I was recently installing a monitoring tool to monitor my website and owncloud.  I found myself installing munin and thought I may as well put together quick install note; nothing elaborate, just a few simple steps.  It is assumed you know what you are doing with Ubuntu and Apache2.

About Munin

Munin is a helpful utility that provides a visual way to monitor a server. It is set up to be extremely plug and play. It can be installed very quickly through apt-get.

We will install and configure Munin on a monitoring server, the munin client will be on the same server though it could be a remote system (more likely).

Step One – Install Munin

Install the server and client components with the following command:

sudo apt-get install munin

Once the package is installed, you only need to make a few changes to get your installation working.

Step Two – Configure Munin

Start off by opening the main munin configuration file:

sudo vi /etc/munin/munin.conf

There are a few lines that we have to adjust:

# dbdir /var/lib/munin
# htmldir /var/cache/munin/www
# logdir /var/log/munin
# rundir  /var/run/munin

The four lines should now look like this:

dbdir /var/lib/munin
htmldir /var/www/munin
logdir /var/log/munin
rundir  /var/run/munin

Additionally, two other lines should be changed within the configuration file. “Tmpldir” should be uncommented and the server name on the line localhost.localdomain should be updated to display the hostname, domain name, or other identifier you’d like to use for your monitoring server. We will use “MuninMonitor” in this guide:

tmpldir /etc/munin/templates

[MuninMonitor]
    address 127.0.0.1
    use_node_name yes

Save and close this file for now.

Next, you will be editing Munin’s apache configuration file to point apache in the right direction when you request the monitoring information. Open Munin’s apache configuration file:

sudo nano /etc/munin/apache.conf

There are a few items that need to be addressed at the top of this file. We need to change both the alias declaration and the directory path to point to the “htmldir” attribute we set in the munin.conf file.

We also need to allow connections from outside of the local computer, since you are likely accessing this cloud server remotely.

Change the beginning of this file to reflect this information:

Alias /munin /var/www/munin
<Directory /var/www/munin>
	Order allow,deny
	#Allow from localhost 127.0.0.0/8  ::1
	Allow from all
	Options None

Next, you will need to create the directory path that you referenced in the munin.conf file and modify the ownership to allow munin to write to it:

sudo mkdir /var/www/munin
sudo chown munin:munin /var/www/munin

Once all of these changes are in place, you can restart apache and munin to make the changes effective.

sudo service munin-node restart
sudo service apache2 restart

It might take a few minutes to generate the necessary graphs and html files. After about five minutes, your files should be created and you will be able to access your data. You should be able to access your munin details at:

your_ip_address/munin

If you get an error message in your browser similar to the following, you need to wait longer for munin to create the files:

Forbidden

You don't have permission to access /munin/ on ...

That is it!  Happy monitoring.

Caution

If you are planning on exposing this to the www I suggest you secure your install with an .htaccess file and adjust your firewall rules accordingly.  IIRC the port is 4949 TCP.

You must be logged in to post a comment.

Proudly powered by WordPress   Premium Style Theme by www.gopiplus.com
WordPress Appliance - Powered by TurnKey Linux