Installing MRTG In Linux

The Multi Router Traffic Grapher (MRTG) is a tool to monitor the traffic load on network links. MRTG generates HTML pages containing graphical images which provide a live visual representation of the traffic.

MTRG Installation

1. Make a directory under /var/www/

  1. mkdir /var/www/html/mrtg

2. Create necassary folders and secure it.

  1. mkdir /var/www/html/mrtg/core
  2. chmod 700 /var/www/html/mrtg/core

3. Download and compile the tar file.

  1. wget
  2. tar zfx mrtg.tar.gz
  3. cd mrtg*
  4. ./configure —with-gd=/usr/local/lib
  5. make
  6. make install

This will install MRTG

4. The config and templates needs to be updated. Download the latest
updates and compile them also.

  1. wget
  2. tar zfx mrtgcfg.tar.gz
  3. chmod +x system

Move files to necassary locations:

  1. mv -f system /var/www/html/mrtg/core
  2. mv -f mrtg.cfg /var/www/html/mrtg/core

This will update the MRTG Config and template

5. Adding cron tab entry. This part is up to you to decide at what
interval this should work. I have set this to work every 5 minutes.

Either edit the cron tab and manually add the entries or just run this
command below.

  1. echo "*/5 * * * * root /usr/local/mrtg-2/bin/mrtg

/var/www/html/mrtg/core/mrtg.cfg" » /etc/crontab

  1. echo "" » /etc/crontab

6. Executing the commands below will start the MRTG for the first time.

  1. /usr/local/mrtg-2/bin/mrtg
  2. /var/www/html/mrtg/core/mrtg.cfg

If you see any errors or warnings below, just ignore that ;-)

7. Clean up the installation by removing the folders.

  1. rm -rf mrtg*

Thats it, done. DONE!

When the process is done MRTG will be installed in: /var/www/html/mrtg
and can be viewed at:


Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.