Friday 20 January 2012

how to Install and configure Munin on linux server

The Installation and configuration are listed below
...................................................

Server Monitoring With munin

Munin produces nifty little graphics about nearly every aspect of the server (load average, memory usage, CPU usage, MySQL throughput, eth0 traffic, etc.) without much configuration, whereas monit checks the availability of services like Apache, MySQL, Postfix, Postgresql and takes the appropriate action such as a restart if it finds a service is not behaving as expected. The combination of the two gives you full monitoring: graphics that lets you recognize current or upcoming problems (like "We need a bigger server soon, our load average is increasing rapidly."), and a watchdog that ensures the availability of the monitored services.

Although munin lets you monitor more than one server, we will only discuss the monitoring of the system where it is installed here.

This tutorial is written for RHEL-4, but the configuration should apply to other distributions with little changes as well.

1:Enable The RPMforge Repository

wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
rpm -Uvh rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm

2:Install And Configure munin

To install munin on RHEL-4, we do this:

yum install munin munin-node

3:Then we create the system startup links for munin and start it:
chkconfig --levels 235 munin-node on
/etc/init.d/munin-node start

Note:if chkconfig is not working from your login then do the following
yourlogin# su -
enter the root password:XXXXXXX
and again apply the chkconfig command you will have that.

4:we must edit the munin configuration file /etc/munin/munin.conf. We want munin to put its output into the directory /var/www/html/domaindirectory(serverweb)/munin, therefore we change the value of htmldir, and we want it to use the name serverweb instead of localhost.localdomain in the HTML output, therefore we replace localhost.localdomain with server1web. Without the comments,

vim /etc/munin/munin.conf

[...]
dbdir /var/lib/munin
htmldir /var/www/html/serverweb/munin
logdir /var/log/munin
rundir /var/run/munin

Where to look for the HTML templates
tmpldir /etc/munin/templates
[...]
a simple host tree
[server1.domain.com] #you domain name
address 127.0.0.1
use_node_name yes
[...]
5:Next we create the directory /var/www/html/serverweb/munin and change its ownership to the user and group munin, otherwise munin cannot place its output in that directory. Then we restart munin:

mkdir -p /var/www/html/serverweb/munin
chown munin:munin /var/www/html/serverweb/munin
/etc/init.d/munin-node restart

6: after a few minuts open your browser and access the link your.domain.com/munin

7: Password-Protect The munin Output Directory (Optional)
Now it is a good idea to password-protect the directory /var/www/html/serverweb/munin unless you want everybody to be able to see every little statistic about your server.

To do this, we create an .htaccess file in /var/www/html/serverweb/munin:

vim /var/www/html/serverweb/munin/.htaccess

AuthType Basic
AuthName "Members Only"
AuthUserFile /var/www/html/serverweb/.htpasswd

require valid-user


8:Then we must create the password file /var/www/html/serverweb/.htpasswd. We want to log in with the username admin, so we do this:
htpasswd -c /var/www/html/serverweb/.htpasswd admin

9:open browser and type http://www.serverweb.com/munin
user name: admin
password: admin

10: Thats all about for x86_64 RHEL-4 server.

Regards & Thanks
Imran Ullah

No comments:

Post a Comment