HOBALL 筆記簿

December 7, 2009

A Brief description of installing MRTG on CentOS5.3 with Lighttpd

Filed under: Linux — Tags: , , — hoball @ 7:06 pm

Requirements: net-snmp, net-snmp-utils, mrtg, lighttpd

mrtg : Multi Router Traffic Grapher

net-snmp and net-snmp-utils : SNMP (Simple Network Management Protocol) is a protocol used for network management. The NET-SNMP project includes various SNMP tools. net-snmp package contains the snmpd and snmptrapd daemons, documentation, etc. You also want to install the net-snmp-utils package, which contains NET-SNMP utilities.

Install the packages

# yum install mrtg net-snmp net-snmp-utils

Configure snmpd.conf

# cp /etc/snmpd/snmpd.conf /etc/snmpd/snmpd.conf.factory-default

# vi /etc/snmpd/snmpd.conf

Comment out the contents, append: (http://www.sofee.cn/blog/2006/10/21/49/)

##############################################################
# Added by Justin
## sec.name source community
com2sec local   localhost       public
com2sec lan     192.168.1.0/24  public

## group.name sec.model sec.name
group   MyRWGroup       v1      local
group   MyRWGroup       v2c     local
group   MyRWGroup       usm     local
group   MyROGroup       v1      lan
group   MyROGroup       v2c     lan
group   MyROGroup       usm     lan

view all    included  .1                               80
#view mib2   included  .iso.org.dod.internet.mgmt.mib-2 fc

## context sec.model sec.level prefix read write notif
access MyROGroup ""      any       noauth    exact      all    none   none
access MyRWGroup ""      any       noauth    exact      all    all    all
rocommunity  public
disk / 100000
disk /mnt/share 500000
##############################################################

Save and close the file

# chkconfig snmpd on
# service snmpd restart

Make sure you see interface IP, by running the following command:

# snmpwalk -v 1 -c public localhost IP-MIB::ipAdEntIfIndex

Sample Outputs:

IP-MIB::ipAdEntIfIndex.123.xx.yy.zzz = INTEGER: 2
IP-MIB::ipAdEntIfIndex.127.0.0.1 = INTEGER: 1
Configure MRTG

# vi /etc/mrtg/mrtg.cfg

OR

# /usr/bin/cfgmaker –global ‘WorkDir: /var/www/mrtg’ –output /etc/mrtg/mrtg.cfg public@127.0.0.1

Create the html file

# indexmaker --output=/var/www/mrtg/index.html /etc/mrtg/mrtg.cfg

Configure Lightttpd

# vi /etc/lighttpd/lighttpd.conf

Add a new alias:

alias.url + ( "/mrtg" => "/var/www/mrtg/www" )

or Append the alias:

alias.url += ( "/mrtg" => "/var/www/mrtg/www" )

Please read the followings for detailed tutorials or documentation.

English Tutorials:

http://www.cyberciti.biz/faq/centos-fedora-linux-multi-router-traffic-grapher-tutorial/

Chinese Tutorials:

http://lincf0315.blogspot.com/2007/04/mrtgcentos.html

http://forum.icst.org.tw/phpbb/viewtopic.php?t=14871

http://www.lslnet.com/linux/f/docs1/i05/big5132597.htm

http://www.sofee.cn/blog/2006/10/21/49/

Official documentation:

http://oss.oetiker.ch/mrtg/doc/mrtg-reference.en.html

http://oss.oetiker.ch/mrtg/doc/mrtg-unix-guide.en.html

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: