MRTG Installation steps

MRTG installation
=================

SNMP installation

[user@linux]#yum install net-snmp*

Configuration of snmpd.conf
============================

Inside the /etc/snmp/ folder, there will be the snmp configuration
file named, snmpd.conf

#mv snmpd.conf snmpd.conf.old
#vi snmpd.conf

Enter the following line in the new configuration file to set the Read
Only community string to any password of your choice, say for eg.,
1q2w3e

rocommunity 1q2w3e
[user@linux]#etc/rc.d/init.d/snmpd start

 

Run the following commnds from the command line

[user@linux]#snmpwalk -v 1 -c 1q2w3e localhost system 

[user@linux]#snmpwalk -v 1 -c 1q2w3e localhost interface
The above steps are called as polling localhost. You can poll any SNMP
aware network device that has SNMP enabled. All you need is the IP
address and SNMP read only string and you’ll be able to get similar
results.There are currently three versions of SNMP; versions 1, 2 and 3. The
Linux snmpwalk and snmpget commands have v 1, v 2c and v 3 switches for
specifying the SNMP version to be used for queries. Always make sure you
are using the correct one.

Now that we know SNMP is working correctly on your Linux server, we can
configure a SNMP statistics gathering software package such as MRTG to
create online graphs of your traffic flows.

Gd installation
===============
This is a graphic drawing library developed by Thomas Boutell. The present versions only develop PNG images as GIF images runs into problems.

http://www.libgd.org/releases/

#wget http://www.libgd.org/releases/ 

#tar -xvf gd-(*.*.*).tar.gz
#cd gd(*.*.*)
#env CPPFLAGS="-I../zlib -I../libpng" LDFLAGS="-L../zlib -L../libpng" ./configure --disable-shared --without-freetype --without-jpeg

#make

For Gd to produce graphic PNG images you need libpng
====================================================

This can be downloaded from

http://sourceforge.net/projects/libpng/files/libpng15/1.5.0/libpng-1.5.0.tar.xz/download

#tar -xvf libpng-1.5.0.tar.gz 

#cd libpng-1.5.0 

#env CFLAGS="-O3 -fPIC" ./configure --prefix=$INSTALL_DIR

#make

zlib is needed by libpng to compress those graphic images
=========================================================

Zlib can be downloaded from

http://downloads.sourceforge.net/project/libpng/zlib/1.2.5/zlib-1.2.5.tar.gz?r=&ts=1288349087&use_mirror=space

http://downloads.sourceforge.net/project/libpng/zlib/1.2.5/zlib-1.2.5.tar.gz?r=&ts=1288349087&use_mirror=space#tar -xvz zlib-1.2.5.tar.gz #cd zlib-1.2.5 #./configure #makeFinally MRTG Compilation
========================

can be downloaded from

http://oss.oetiker.ch/mrtg/pub/

#wget http://oss.oetiker.ch/mrtg/pub/mrtg-2.16.4.tar.gz

#tar -xvf mrtg-2.16.4.tar.gz

# cd mrtg-2.16.4

# ./configure --prefix=/usr/local/mrtg-2

#make

#make install

Configuring mrtg
================

#cd /usr/local/mrtg-2/bin

#mkdir /home/mrtg

#./cfgmaker --global 'WorkDir: /home/mrtg' --global 'Options[_]: bits,growright' --output /home/mrtg/mrtg.cfg 1q2w3e@localhost

#./indexmaker --output=/home/mrtg/index.html /home/mrtg/mrtg.cfg

Configuring on ZEUS web server
==============================

Then if that is zeus web server

1.Check the server and select the configure button

2.Now you will be taken to a new page where in left side you will have URL mapping option just below URL handling, select url mapping.

3.Add the word /mrtg/ to the space corresponding to “Map requests for (relative to document root)”

4.Add /home/mrtg/ to the space corresponding to “Map requests to (filesystem path)”

Now apply setting and save the settings

Configuration in apache web server
==================================
Configuration in apache web server is simple it is just by adding an alias in apache configuration file.

1.#vi /etc/https/conf/httpd.conf to open the apache configuration file
2.Add the line “Alias /mrtg/ /home/mrtg/” save and exit.
3.#/etc/init.d/httpd restart to restart apache server.

that’s it you are done..

Cron for mrtg
=============

#vi /var/spool/cron/root

add the following line

*/5 * * * * env LANG=C /usr/local/mrtg-2/bin/mrtg /home/mrtg/mrtg.cfg --logging /var/log/mrtg.log >/dev/null 2>&1

#service crond restart 

http://serverip/mrtg/

Thank you for visiting helpinlinux.com

Leave a Reply

Protected by WP Anti Spam