Make sure you only do this on your master node.
Note that to be able to visualize the graphs/data collected by Munin on the master, you'll need to install apache2
(the web server) on your master host as well.
Let's do this now:
$ sudo apt-get install apache2 apache2-utils
This shouldn't take more than a few seconds. Test that the service is running by pointing your browser at http://hostN.ws.nsrc.org
, where N
is the number of your master host.
Note: apache2-utils
is required for the htpasswd
program to be installed.
$ sudo apt-get install munin
The list of packages to be installed is long! But don't worry, installation won't take long.
By default, installing the munin
package, installs both the munin master process (which collects data) and the munin-node
.
Run the following command to verify that munin-node
is active on your master host:
$ ps ax | grep munin
You should see something similar:
3997 ? Ss 0:00 /usr/bin/perl -wT /usr/sbin/munin-node
Included in Munin is a configuration file for Apache2. First, let's copy the file into Apache's configuration directory:
$ sudo cp /etc/munin/apache.conf /etc/apache2/conf-available/munin.conf
Let's modify the file, so we can access Munin from our web browser.
$ sudo editor /etc/apache2/conf-enabled/munin.conf
You will have to do the following changes multiple times.
Skip the first section which looks like this:
# Enable this for cgi-based templates
# Alias /munin-cgi/static /var/cache/munin/www/static
# ScriptAlias /munin-cgi /usr/lib/munin/cgi/munin-cgi-html
# <Location /munin-cgi>
# Order allow,deny
# Allow from all
# AuthUserFile /etc/munin/munin-htpasswd
# AuthName "Munin"
# AuthType Basic
# require valid-user
# </Location>
After this, every time you see this line:
Allow from localhost 127.0.0.0/8 ::1
replace it with:
Allow from all
Same thing for the user authentication. Every time you see:
# AuthUserFile /etc/munin/munin-htpasswd
# AuthName "Munin"
# AuthType Basic
# require valid-user
replace it with:
AuthUserFile /etc/munin/munin-htpasswd
AuthName "Munin"
AuthType Basic
require valid-user
(Remove the #
in front)
Save the file and exit.
Now, to emable the configuration, run the following commands:
$ sudo a2enconf munin.conf
You should see:
Enabling conf munin.
To activate the new configuration, you need to run:
service apache2 reload
As indicated, reload the apache2
configuration:
We still need to create a user + password to allow access to the Munin web statistics. To do so:
$ sudo htpasswd -c /etc/munin/munin-htpasswd sysadm
This will create the sysadm
user. When prompted, enter a password for the user. Please use the same password as for the sysadm
user.
Now, point your browser to http://hostN.ws.nsrc.org/munin
- N
is the number of your master host.
You should be prompted for a user and password. The user is sysadm
, and the password is the one you set just now.
You will be presented with the following screen:
Munin Main Screen
If you click on 'localhost.localdomain', you'll be able to navigate the following categories of statistics, for the host localhost
(that is, the machine that munin is running on.
disk munin network processes system
Take a moment to browse these categories. It should be pretty clear what each of them stands for.
Q: Explore the munin
category. Why do you think it is useful to have these statistics ?
Let's make the names more meaningful - localhost.localdomain
isn't very informative.
Edit the file /etc/munin/munin.conf
:
$ sudo editor /etc/munin/munin.conf`
Most of the default values don't need to be touched, the Ubuntu package has reasonable settings.
Move down and fine the section:
[localhost.localdomain]
address 127.0.0.1
use_node_name yes
... replace localhost.localdomain
with hostN.ws.nsrc.org
, where N
is the number of your master host.
Once this is done, save the file and exit.
Now, we just need to wait 5 minutes for munin to run again - Munin on the collector side doesn't run as a daemon (service) - it it called by cron
from /etc/cron.d/munin
, which in turns calls /usr/bin/munin-cron
.
This is done every 5 minutes by default.
After this time has elapsed, navigate once more to http://hostN.ws.nsrc.org/munin
, and you should notice that the name of the only host being monitored now reflects what we set it to.
Notice on the left menu, how Groups
lists the domain for our workshop, ws.nsrc.org
.