Tuesday, September 27, 2011

Install and configure munin (and munin-node) for Server Monitoring

November 25, 2009 by  
Filed under General

2 Comments

Munin is an efficient and lightweight Monitoring tool. Its available in ’server’ and ‘node’ packages. You can install server in a single machine and node in all other machines and then view all information/statistical data in server machine.

This quick copy and paste howto explains steps needed to setup server and multiple nodes. These steps are tested in CentOS 5 Server but I do not issue any guarantee that this will work for you.

Step 1. Prepare Server machine. For quick installation and dependency resolution, you can install DAG repository:

# rpm -Uhv http://apt.sw.be/packages/rpmforge-release/rpmforge-release-0.3.6-1.el4.rf.i386.rpm

Step 2. Install munin (server) and munin-node (node) on this machine:

# yum install munin munin-node

Step 3. Setup a directory to store munin generated htmls, you can create a directory in your server DocumentRoot or in munin directory itself. Here we create it in munin’s directory:

# cd /etc/munin
# mkdir html
# chown munin:munin html -R

Step 4. If in previous step, you created a directory in your web server root, then you dont need to set an alias, else if you did the exact whats written in above step, create an alias:

# vi /etc/httpd/conf/httpd.conf

—–
Alias /server-health/ “/etc/munin/html/”
<Directory “/etc/munin/html”>
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
—–

Step 5. Configure munin for monitoring localhost (you are already in /etc/munin directory):

# vi munin.conf


htmldir /etc/munin/html

[localhost]
address 127.0.0.1
use_node_name yes

here we set the html directory and section for local machine. Feel free to change ‘localhost’ to any meaningful name like Monitoring Server etc. You can further read the file for more options.

Step 6. Start munin service:

# chkconfig munin-node on
# service munin-node start

Step 7. Restart your web server and then access the munin page from your browser by pointing it to http://localhost/server-health/. You can also password protect the munin page by using .htaccess or inserting rules in your httpd.conf file but its optional.

You should be able to view various parameters/values/trends related to disk,network,apache,mail etc of your local machine/server via browser. Let us configure multiple nodes now:

Step 8. SSH to any other machine/ server and install DAG repository as described in Step 1 and then install the munin node:

# yum install munin-node

Step 10. Configure the node to allow our main server get input from this machine. For this purpose, we need to add ‘Allow IP ADDRESS’ line in config file. Note that there’s already a Allow line which allow localhost to get values, we just need to add another line for server:

# vi /etc/munin/munin-node.conf

allow ^192.168.0.1$

Here 192.168.0.1 (change it as per your settings) is the IP of server machine, written in regex form which is required here.

Step 11. Start the node now:

# chkconfig munin-node on
# service munin-node start

Now configure the Server to monitor the above machine:

Step 12. Goto Server machine and update munin.conf and add a new section:

# vi /etc/munin.conf

[App_Server]
address 192.168.0.5
use_node_name yes

Here, App_Server is the name (you can write any), and 192.168.0.5 is the IP address of the machine in which we configured munin-node in Step 9 to Step 11.

After a while, Check you browser and munin should include the update from node machine.

Common Issues:

1. No values/stats are displayed or blank.
Please verify that munin-node service is running at machine. Verify it by telnet from machine itself:
# telnet localhost 4949
You should see munin prompt here, write fetch cpu and press ENTER. You should see various values related to your cpu. If you are not able to telnet to port 4949 (munin port) then possibly munin-node is not running or your iptable (firewall) or SELinux policy is preventing its usage.

After checking from localhost, go to Server machine and try to telnet from there:
# telnet 192.168.0.5 4949
You should get munin prompt and see values after issuing fetch cpu command there. If not, then firewall/selinux is preventing access this port or you didnt allowed this server from your munin-node.conf to get updates.

2. Why not compile from source?
Thats the best idea but when I tried the same, I got lots of perl modules dependencies/compile errors. Though, I managed to get its working but for a quick setup, yum is your friend.

3. I do not need all these values coming in graphs.
You can remove any plugin for which you do not want graph. Plugins are stored in /etc/munin/plugins directory and configured in plugins.conf. Configure these as per your requirements.

GD Star Rating
a WordPress rating system
Install and configure munin (and munin-node) for Server Monitoring, 5.5 out of 10 based on 2 ratings
Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

Related posts:

  1. Installing and configuring monit to monitor your server(s)
  2. Installing Suhosin as PHP Extension in Linux
  3. Install SSL certificate on Windows Server 2000 / 2003
  4. How to install Webmin on CentOS, RHEL, Fedora, Mandriva, SuSE
  5. Practical experience of migrating from HyperVM to VDSManager

Comments

2 Responses to “Install and configure munin (and munin-node) for Server Monitoring”
  1. admin says:

    If you have firewall in servers that you want to monitor, don’t forget to allow the source and port 4949. If you have iptables you may allow port by following command:

    iptables -A INPUT -p tcp –dport 4949 -j ACCEPT

    However, it will allow any IP to connect to your server’s 4949 port. You may exclusively allow munin’s server IP (say 207.29.48.122) by following command:

    iptables -A INPUT -p tcp -s 207.29.48.122 –dport 4949 -j ACCEPT

    Just change the IP to your actual IP address and run:
    service iptables save
    service iptables restart

    GD Star Rating
    a WordPress rating system
    Reply
  2. erwin says:

    What should be the next step in configuring a Linux Somba Server?

    I have a project for my school that I have to install Linux Somba Server on two computers and then connect them creating a network. I have set up the computers (Connected the power, mainframe, keyboards, mice, and monitors). I am about to install Linux on the two computers. Are there any configurations that should be done during the setup?

    GD Star Rating
    a WordPress rating system
    Reply

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!
Click here to cancel reply.