Thursday, July 28, 2011

Installing Munin On CentOS

Configuring Munin On CentOS  x86_64 :

Munin is a monitoring tool for servers. It uses RRDtool to log and graph data from your servers. The plugin API is very easy to grasp. Actually, I haven’t read the API documentation yet. I just looked at the output of the plugins and it looks easy to achieve. The data can be accessed through the web.
Munin works by polling your servers for the data hence two applications, Munin and Munin Node. The former periodically gathers data (crond) and the latter serves the data to the former. Please refer to the following for our example configuration. You can make up a domain if you want Munin to group your servers similar to the live demo.
  • Munin “Munin Server” – (
  • A Munin Node – (
 In this section, we set it up on

mkdir ~/downloads
cd ~/downloads

ls ~/downloads

-Install dag repo to get dependencies:
rpm -ivh

-To install Munin server:
yum localinstall munin-1.2.5-2.el5.rf.noarch.rpm --nogpgcheck -y

-After installing above rpm list /var/www/munin. If it exists refer /etc/httpd/conf.d/munin.conf to set apache configuration.

vim /etc/httpd/conf.d/munin.conf

ScriptAlias /munin/cgi "/var/www/munin/cgi/"

#  SSLRequireSSL
   Options ExecCGI
   AllowOverride None
   Order allow,deny
   Allow from all
#  Order deny,allow
#  Deny from all
#  Allow from
   AuthName "Munin Access"
   AuthType Basic
   AuthUserFile /var/www/munin/passwd
   Require valid-user

Alias /munin "/var/www/munin/"

#  SSLRequireSSL
   Options None
   AllowOverride None
   Order allow,deny
   Allow from all
#  Order deny,allow
#  Deny from all
#  Allow from
   AuthName "Munin Access"
   AuthType Basic
   AuthUserFile /var/www/munin/passwd
   Require valid-user

-Create a user for UI authentication using following:
htpasswd -c /var/www/munin/passwd munin

- Set permission to munin user:
chown -R munin:munin /var/www/munin

-Start apache/httpd and crond service
service httpd start && service crond restart
chkconfig httpd on

-You can check if it’s working through your browser (i.e. It will prompt for user/password which we defined above with htpasswd. So put user/password accordingly to access munin UI.



- Make sure you have installed dag repo before following below steps.

cd ~/downloads

yum localinstall munin-node-1.2.5-2.el5.rf.noarch.rpm --nogpgcheck -y

-Edit Munin’s configuration on the graph ( server (/etc/munin/munin.conf) and add following.
use_node_name  yes
- Edit munin-node config file:
vim /etc/munin/munin-node.conf
  allow ^127\.0\.0\.1$

service munin-node start

chkconfig munin-node on

 -Now wait for 5minutes and check your browser with for localhost. It will show default graphs for localhost.  If you are willing to add other graphs for apache and so which is explained next while adding other host as node.


Add a Node        (i.e.

-    Make sure you have installed Dag repo and munin-node rpms, follow above steps to do so.

After installing above, edit /etc/munin/munin-node.conf on remote host (i.e.
allow ^192\.168\.1\.1$
hostname  # required only if you don’t have DNS in-place

Start  munin-node service:
service munin-node start

chkconfig munin-node on

Check log file to make sure it works fine:
tail -f /var/log/munin/munin-node.log
2011/07/28-12:00:05 CONNECT TCP Peer: "" Local: ""

If you find something unusual, resolve the dependency issue related to plug-ins which can be found at /usr/share/munin/plugins

-Now wait for five minutes and check your browser with for


Suppose this host is running httpd/apache service and we want to get graphs for it, here we go:

ln -s /usr/share/munin/plugins/apache_* /etc/munin/plugins/

It doesn’t work default by just adding apache plug-ins to path to make it work.
mod_status  module provides performance during load testing or for allowing a monitoring program like munin or mrtg to gather activity data for later aggregation. We need to configure apache to “ExtendedStatus”, let’s see how:
To make sure about mod_status “LoadModule status_module modules/” in /etc/httpd/conf/httpd.conf. And refer next.

- Edit using vi or nano /etc/httpd/conf/httpd.conf and search for server-status, you will find:

#    SetHandler server-status
#    Order deny,allow
#    Deny from all
#    Allow from

- Change it to below:
SetHandler server-status
Order deny,allow
Deny from all
Allow from localhost

One more change we may want to make is to enable the ExtendedStatus setting in apache. This setting adds more information to the status page apache returns, like CPU use and requests per second. Enabling ExtendedStatus makes apache do a little extra work when it gets a status request, so you might weigh the extra information gained against the potential performance hit to a busy server.

Many monitoring applications that record performance over time, like munin, require that ExtendedStatus be enabled before they can monitor apache.

The ExtendedStatus setting must be set at the server level and applies to all virtual hosts running under apache. To enable it edit the httpd.conf file and look for the following entry:

#ExtendedStatus On

Uncomment that last line to enable ExtendedStatus, changing the configuration block to:

ExtendedStatus On

Restart apache, now that we've made sure the apache server status page is enabled and configured the way we want it, we'll need to restart apache:

service httpd restart

Install lynx

With apache's server status page restricted to localhost-only access we won't be able to see the page from our desktop's web browser. Luckily the server status page is just a bunch of text with no graphics, letting us use a simple approach: Run a text-based web browser while logged into the slice itself.

To try this option out we'll need to install a browser on the slice first. The browser we'll use is called "lynx", and you can install it with the following command:

yum install lynx   

No configuration is necessary, but lynx is keyboard-controlled so it's handy to know a few basic keystrokes when using it. There is a list of the most frequently-used commands at the bottom of the screen while lynx is running. If you visit a site with lynx you can navigate with the up and down keys and follow a highlighted link by hitting enter. Hit "q" to quit (and hit "y" to confirm the quit). Hit "h" to access lynx's documentation.

View the status page

The URL of the apache status page will be your domain name with "/server-status" tacked onto the end. In this section we're assuming you've configured your default server instance or virtual host to accept connections from the localhost only. Tell lynx to view your apache status page with the following command:

lynx http://localhost/server-status

You will see something like the following page if you have ExtendedStatus enabled (the example server was running, but it should look similar for all recent versions of Linux and Apache). With ExtendedStatus disabled the page will look similar, but with a few lines missing.

Srv  PID      Acc     M  CPU    SS   Req Conn  Child    Slot   Client            VHost                      Request
   0-0 10742 0/209/4209  _ 39.22  393   0   0.0  636.62  5435.21 king.example.comGET /server-status?auto HTTP/1.1
   1-0 4096  0/1006/5006 _ 1.98   93    0   0.0  1.03    2424.31 king.example.comGET /server-status?auto HTTP/1.1
   2-0 4095  0/1076/5076 _ 40.79  94    0   0.0  638.28  1678.18 king.example.comGET /server-status?auto HTTP/1.1

So, if above things go fine. Let’s move to apache plug-in for Munin:
ln -s /usr/share/munin/plugins/apache_* /etc/munin/plugins/

service munin-node restart

Now, wait for five minutes and you will be able to see apache related graphs.


Anonymous said...

Thanks a lot for your effort, but why using this 4shared crap for downloading.

Anonymous said...

you are really a just right webmaster. The website loading pace
is incredible. It sort of feels that you are doing
any distinctive trick. Furthermore, The contents are masterwork.
you've performed a wonderful job in this topic!

Also visit my webpage; buy wellbutrin from singapore