Server monitoring using Munin in CentOS 5.6 + DirectAdmin

1. Download RPMForge Package. Check your system with uname -a command to get the suitable package. Below is the current one I got :

32-bit system

wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm

64-bit system

wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm

If you want to check for the latest one, check it from -> http://packages.sw.be/

My instruction will base on x86_64 package.

 

2. Install GPG Key for DAG

rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt

 

3. Verify the package

rpm -K rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm

 

4. After verification, install RPMForge package.

rpm -i rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm

 

5. Run command below : Basically, it will install Munin, set it to run at startup, start munin, create folder for munin to access through the web. (You can just copy and paste into your SSH)

yum install munin munin-node
chkconfig –levels 235 munin-node on
/etc/init.d/munin-node start
chown -R munin:munin /var/www/munin
ln -s /var/www/munin /var/www/html/munin
service httpd restart && service crond restart

That's it. You may also want to protect your munin directory so that no one without password will not be able to access. What you have to do is

 

6. Create .htaccess file in munin Directory

nano /var/www/html/munin/.htaccess

In that file, put the text below :

AuthType Basic
AuthName "Members Only"
AuthUserFile /var/www/munin/.htpasswd
<limit GET PUT POST>
require valid-user
</limit>

Then, save it.

 

7. Create .htpasswd file contains username and password to allow to access your munin (Here munin-admin is a username)

htpasswd -c /var/www/munin/.htpasswd munin-admin

Then enter your password and that's it. Alternatively, if you don't have htpasswd program on your server, you can just create .htpasswd file and put username and password in it. The password has to be encoded in MD5 format. (You can google and find any htpasswd generator. The format will be :

username:password

==================================

Troubleshoot : If there is no graph and you see /var/log/munin/munin-html.log like below

Jul 24 11:50:10 - processing domain: localhost
Jul 24 11:50:10 - processing node: localhost
Jul 24 11:50:10 - processing service: apache_accesses
Jul 24 11:55:11 - Starting munin-html, checking lock
Jul 24 11:55:11 - could not copy style.css into htmldir
Jul 24 11:55:11 - could not copy logo.png into htmldir
Jul 24 11:55:11 - could not copy definitions.html into htmldir
Jul 24 11:55:11 - processing domain: localhost
Jul 24 11:55:11 - processing node: localhost
Jul 24 11:55:11 - processing service: apache_accesses

or error in /var/log/munin/munin-graph.log

Jul 24 11:55:11 - Unable to graph /var/lib/munin/localhost/localhost-ntp_clock_nectec_or_th-jitter-g.rrd: Could not save png to '/var/www/munin/localhost/localhost-ntp_clock_nectec_or_th-year.png'
Jul 24 11:55:11 - Graphed service : ntp_clock_nectec_or_th (0.08 sec * 4)
Jul 24 11:55:11 - Unable to graph /var/lib/munin/localhost/localhost-vmstat-sleep-g.rrd: Could not save png to '/var/www/munin/localhost/localhost-vmstat-month.png'
Jul 24 11:55:11 - Unable to graph /var/lib/munin/localhost/localhost-vmstat-sleep-g.rrd: Could not save png to '/var/www/munin/localhost/localhost-vmstat-week.png'
Jul 24 11:55:11 - Unable to graph /var/lib/munin/localhost/localhost-vmstat-sleep-g.rrd: Could not save png to '/var/www/munin/localhost/localhost-vmstat-day.png'
Jul 24 11:55:11 - Unable to graph /var/lib/munin/localhost/localhost-vmstat-sleep-g.rrd: Could not save png to '/var/www/munin/localhost/localhost-vmstat-year.png'
Jul 24 11:55:11 - Graphed service : vmstat (0.07 sec * 4)
Jul 24 11:55:11 - Processed node: localhost (2.94 sec)
Jul 24 11:55:11 - Processed domain: localhost (2.94 sec)
Jul 24 11:55:11 - Munin-graph finished (2.95 sec)

Then, check ownership of your munin file and directory. I got the problem with a directory (www) above munin directory. Original is :

dr-xr-x--- 10 webapps apache 4096 Jul 25 13:54 www


I, then, have to chmod 755 /var/www to make it work. After I chmod it, below is what it will look like :

drwxr-xr-x 10 webapps apache 4096 Jul 25 13:54 www

Update : 2012.12.20 : For Security reason, chmod 551 /var/www to make it work. After I chmod it, below is what it will look like :

dr-xr-x--x  9 webapps apache 4096 Jun 10  2011 www

Tested with :
1. CentOS 5.6 - 64 bits
2. DirectAdmin 1.39.1 - With Custombuild 1.2
3. PHP 5.3.6

Update : 2011.08.08

You may want to use EPEL repository instead which will give you a newer version of Munin (1.4.5 vs 1.2.x). If you do, then, do the following :

1. Download EPEL repository

wget http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

 

2. Install it

rpm -Uvh epel-release-5-4.noarch.rpm

Then, continue with step 5 above.

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.