Munin actually consists of two parts, namely Munin Master and Munin node. Munin Server is the data gatherer and grapher which also hosts the software website. You only need one (1) Munin Server. The Munin Server will periodically poll all the nodes in your network it’s aware of for data, which it in turn will use to create graphs and HTML pages for viewing via web browser. Munin Node is the agent that monitors and extracts data from the node it runs on, and then passes the data to the server for further processing.
Installing Munin Monitoring System
Munin is written in Perl, so it requires Perl and several Perl modules. It also depends on RRD. So don’t be surprise if the installer also asks for installation of many Perl modules as dependencies. Here’s the requirement for Munin:
- RRD with perl support
- Perl modules for server: Time::HiRes, Storable, Digest::MD5, HTML::Template, Text::Balanced
- Perl modules for node: Net::Server
- Gnu Make
This tutorial assumes that we’re installing both Munin Server and Munin Node on the same host.
In Centos/Fedora/Redhat/Scientific Linux (requires EPEL repo for Munin):
yum update all yum install epel-release yum yum install munin munin-node
In Ubuntu/Debian:
sudo aptitude update sudo aptitude install munin munin-node
In SUSE Linux:
Install Munin using the YaST -> Software -> Software Management or by using zypper:
zypper in munin munin-node
Configuring Munin Server
The configuration file for Munin Server is munin.conf located in /etc/munin, which defines how munin-update, munin-graph, munin-limits, munin-html and other Munin programs work. We need to configure several basic settings in order to Munin Server to run properly.
Server Variables
Server variables specifies where the location of the RRD databases, the HTML output, logs and the lock/pid files, which must be writable by the user running munin-cron.
dbdir /var/lib/munin htmldir /var/www/html/munin logdir /var/log/munin rundir /var/run/munin
You may also want to define the path for the templates:
tmpldir /etc/munin/templates
Host Definitions
Define the hosts which Munin Node is running. In this example, we configure a simple host tree which is running on localhost (127.0.0.1). For external hosts, specifies the IP address.
[server-FQDN-name] address 127.0.0.1 use_node_name yes
More information on the configuration options is on the wiki.
Configure Munin Node
Munin-node is the agent client that in charge of collecting the data. The default munin-node.conf should be working automatically in most cases, but you can also configured your own parameters, including the user and group that the munin-node process runs as. The munin-node configuration file is located in /etc/munin/munin-node.conf.
Here is an example of the basic munin-node.conf file:
log_level 4 log_file /var/log/munin/munin-node.log pid_file /var/run/munin/munin-node.pid background 1 setseid 1 user root group root host * port 4949
More information on the configuration options is on the wiki.
Configure Firewall
If the Munin master server needs to communicate with remote nodes, port 4949 (or any other ports defined in munin-node.conf on the remote hosts) needs to be opened so that Munin nodes can receive connections from the Munin master.
To open port 4949 in IPTables:
iptables -A INPUT -p tcp --dport 4949 -j ACCEPT
Set Munin to Start on Boot and Start Munin Node Service
Configure munin-node service so that it’s automatically run on boot, and then start munin-node service. Munin-node is the one responsible to gather the data for the server, so it must run persistently.
In Centos/Fedora/Redhat/Scientific Linux:
chkconfig --add munin-node chkconfig munin-node on service munin start
In Ubuntu/Debian:
update-rc.d munin-node defaults /etc/init.d/munin-node
In SUSE Linux:
insserv munin-node /etc/init.d/munin-node
Using Munin
The setting up of Munin monitoring system is basically done. Just wait for a couple of minutes so that Munin can start retrieving system information and generating some data.
To view Munin stats, just visit http://server-FQDN-name/munin/ or http://ip-address/munin/. Depending on how you configure that “htmldir” directive for Munin server and how you configure the web server to access the path (such as through alias and etc), you may have customized the URL which you’re using to access Munin web pages. In such case, just point to the correct URL as in your setup.
The default installation of Munin Node only enables some common system-related plugins. If you want to monitor more systems of your servers, enable more Munin node plugins.