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.,

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.


#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


For Gd to produce graphic PNG images you need libpng

This can be downloaded from

#tar -xvf libpng-1.5.0.tar.gz 

#cd libpng-1.5.0 

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


zlib is needed by libpng to compress those graphic images

Zlib can be downloaded from -xvz zlib-1.2.5.tar.gz #cd zlib-1.2.5 #./configure #makeFinally MRTG Compilation

can be downloaded from


#tar -xvf mrtg-2.16.4.tar.gz

# cd mrtg-2.16.4

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


#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 


Thank you for visiting

One comment

  1. Free Stuff says:

    There are certainly lots of particulars like that to take into consideration. That could be a great level to deliver up. I offer the ideas above as general inspiration however clearly there are questions just like the one you carry up where a very powerful factor shall be working in sincere good faith. I don?t know if best practices have emerged round things like that, however I am positive that your job is clearly recognized as a fair game. Each girls and boys really feel the impression of just a second? pleasure, for the remainder of their lives.

Leave a Reply

Protected by WP Anti Spam