In this tutorial, we will show you how to install Munin on Ubuntu 14.04. For those of you who didn’t know, Munin is a free and open-source networked resource monitoring tool. It offers to monitor and alerting services for servers, switches, applications, and services. Munin uses the RRDtool to create graphs that are accessible over a web browser. Also, Munin can be configured to send alerts when some service/application, etc. is not working and Munin will automatically send an additional email alert once the problem has been resolved.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple. I will show you the step-by-step installation of Munin on the ubuntu 14.04 server.
Prerequisites
- A server running one of the following operating systems: Ubuntu 14.04, and any other Debian-based distribution.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install Munin on Ubuntu 14.04
Step 1. First, make sure that all your system packages are up-to-date by running the following apt-get
commands in the terminal.
sudo apt-get update sudo apt-get upgrade
Step 2. Install Apache which is available from the Ubuntu repositories.
apt-get install apache2
Step 3. Install Munin.
Install Munin and extra plugins using the following command:
apt-get install munin munin-node munin-plugins-extra
Step 4. Configuring Apache webserver.
Next, you will be editing Munin’s apache configuration file to point apache in the right direction when you request the monitoring information:
mv /etc/munin/apache.conf /etc/munin/apache.conf.bak
Edit the ‘/etc/munin/apache.conf
’ configuration file and add the following lines:
#nano /etc/munin/apache.conf
<VirtualHost *:80> ServerName munin.your-domain.com ServerAlias www.munin.your-domain.com ServerAdmin yours@email.com DocumentRoot "/var/cache/munin/www" DirectoryIndex index.html <Directory "/var/cache/munin/www"> Options Indexes Includes FollowSymLinks MultiViews AllowOverride AuthConfig AuthUserFile /etc/munin/htpasswd AuthName "munin" AuthType Basic Require valid-user Order allow,deny Allow from all </Directory> CustomLog /var/log/apache2/munin.your-domain.com-access.log combined ErrorLog /var/log/apache2/munin.your-domain.com-error.log <Directory "/etc/munin/static"> Require all granted </Directory> <Directory "/usr/lib/munin/cgi"> Options +ExecCGI Require all granted <IfModule mod_fcgid.c> SetHandler fcgid-script </IfModule> <IfModule !mod_fcgid.c> SetHandler cgi-script </IfModule> </Directory> </VirtualHost>
Step 5. Configuring the Munin server.
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/cache/munin/www/ sudo chown munin:munin -R /var/cache/munin/www
Create a backup of the original Munin configuration file:
cp /etc/munin/munin.conf /etc/munin/munin.conf.orig
Edit the Munin configuration file and add/modify the following lines:
#nano /etc/munin/munin.conf dbdir /var/lib/munin htmldir /var/cache/munin/www logdir /var/log/munin rundir /var/run/munin tmpldir /etc/munin/templates includedir /etc/munin/conf.d graph_strategy cron cgiurl_graph /munin-cgi/munin-cgi-graph html_strategy cron [localhost] address 127.0.0.1 use_node_name yes
Create a password for the Munin administrator user:
htpasswd -c /etc/munin/htpasswd munin
Step 6. Start Apache and Munin services.
service apache2 start service munin-node start
If all is well, open Munin at http://munin.your-domain.com
using ‘munin’ as username and the previously generated Munin password as password and you will be able to access Munin graphs and data.
Congratulations! You have successfully installed Munin. Thanks for using this tutorial for installing Munin server monitoring on ubuntu 14.04 systems. For additional help or useful information, we recommend you to check the official main website.