Munin

From ArchWiki
Revision as of 14:47, 28 February 2010 by Winch (Talk | contribs) (Configuration)

Jump to: navigation, search

"Munin the monitoring tool surveys all your computers and remembers what it saw. It presents all the information in graphs through a web interface. Its emphasis is on plug and play capabilities. After completing a installation a high number of monitoring plugins will be playing with no more effort.

Using Munin you can easily monitor the performance of your computers, networks, SANs, applications, weather measurements and whatever comes to mind. 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.

Munin uses the excellent RRDTool (written by Tobi Oetiker) and the framework is written in Perl, while plugins may be written in any language. Munin has a master/node architecture in which the master connects to all the nodes at regular intervals and asks them for data. It then stores the data in RRD files, and (if needed) updates the graphs. One of the main goals has been ease of creating new plugins (graphs). " Munin

Simply put, munin allows you to make graphs about system statistics. See a running munin example

Installation

Munin relies on a client-server model. The client is munin-node, and the server is munin (refered to "munin-master" in the documentation). You must have munin-node and munin-master installed for this installation to work.

You will only need to install munin-master on a single machine. But munin-node will need to be installed on all machines you wish to monitor. This article will focus on a single machine installation. Further documentation may be found on the munin documentation wiki.

The following guide sets up a munin under a directory beneath the html root.

Dependencies

Munin requires the following packages:

# pacman -S apache php php-apache

Add an entry to your rc.conf:

 DAEMONS=(syslog-ng network netfs crond httpd)

Edit /etc/hosts.allow by adding the following line:

httpd: ALL

Optional sanity check

Start the webserver:

# /etc/rc.d/httpd start

Create a test document:

# echo "Testing httpd" > /srv/http/index.html

Open a web browser and access http://127.0.0.1/ -- you should see the test document.

If it did not work try the following and check again:

# chown -R http:http /var/run/httpd/

Finally, stop the webserver:

# /etc/rc.d/httpd stop

Installing Munin

Currently there's a munin and a munin-node package in extra.

# pacman -S munin munin-node

Configuration

Add the daemon to /etc/rc.conf:

DAEMONS=(syslog-ng network netfs crond httpd munin-node)

Create a directory under the web root where the cronjob will write the generated html and graphs. This directory needs to exist and be writeable to the munin user.

# mkdir /srv/http/munin
# chown munin:munin /srv/http/munin

Uncomment the htmldir entry in /etc/munin.conf and change it to the directory created in the previous step:

htmldir /srv/http/munin

Run the following to have munin collect data and update the generated html and graphs every 5 minutes:

# crontab /etc/munin/munin-cron-entry -u munin

You can run also run monin-cron manually instead of using the cronjob or for testing.

# su - munin --shell=/bin/bash
$ munin-cron

Testing the Installation

Start the services:

#/etc/rc.d/httpd start
#/etc/rc.d/munin-node start

Then test the interface by pointing your browser to http://localhost/munin

Note: It might take a while for the graphs to have data, so be patient. Wait about 30 minutes to an hour.

Plugins

There are many munin plugins (and they're easy to write). You can start looking for plugins on the munin exchange.

Basically all plugins are installed in the following manner (although there are exceptions, review each plugin!):

Download a plugin, then copy or move it to /usr/lib/munin/plugins

  cp <plugin> /usr/lib/munin/plugins/

Now link the plugin to /etc/munin/plugins

  ln -s /usr/lib/munin/plugins/<plugin> /etc/munin/plugins/<plugin>

Test your plugin, you do not need to use the full path to the plugin, munin-run should be able to figure it out.

  munin-run <plugin>

Now restart munin-node

  /etc/rc.d/munin-node restart

Then refresh the web page, there should be no need to restart munin-master.

If you want to remove a plugin, simply delete the linked file in /etc/munin/plugins/ no need to actually remove the plugin from /usr. Many scripts also follow the following naming convention <plugin>_<device>. This allows multiple links to a single plugin.