Study

MRTG for Dummies

Easy step by step MRTG tutorial for Windows users

Multiple Router Traffic Grapher (MRTG) is used for monitoring network traffic on Routers, Switches, and Servers. It can also be used in many other ways as MRTG is very powerful. MRTG will run on a variety of operating systems, including most Microsoft Windows versions, UNIX/Linux and Mac OS X. In this tutorial however we concentrate on installing and using MRTG on a Windows machine.

To learn more about MRTG, visit the website at http://www.mrtg.org. There are loads of documentation and examples available for you to use. However, it can still be confusing to set up MRTG for the very first time.

This document is intended for the Novice and more specifically, a novice using a Windows Operating System. It is a great way to get started and build up your confidence using MRTG. By following right along, you can have MRTG fully functional in 15 minutes or less – no experience required!

After you have configured MRTG once, you can do the second device configuration in less than 5 minutes. (This is guaranteed to impress your significant other!) You do not have to read this through before you begin. Just follow the steps exactly and you will be successful. (FYI: there is not any restart required so you can install or configure at anytime.)

Assumptions: It is assumed you are running a version of Microsoft Windows NT 4.0, Windows 2000, or Windows XP and that SNMP is installed and running on what you are trying to monitor. Also assumed is you have the rights or authority to monitor the traffic on that device.

I also assume you have a reasonable fast connection to the Internet. This tutorial is based upon many high quality PNG graphic files which may load slow over dial up connection. However, all pages should load in about 1 minute on a 56K connection. Be patient, it is worth it!

You need 2 items of software before you begin.

First, you need MRTG. It is available at http://www.mrtg.org. Download the latest version available. (mrtg-2.9.17.zip was used in the following example.)

Second, you need a copy of PERL from ActiveState Tool Corp. at http://www.activestate.com/. Again, download the latest version available. (Active PERL 5.6.1.626 was used in the following example.)

These programs are under constant development so don’t be alarmed that your version is newer. The process is still the same.

(You will also need a copy of WinZip (http://www.winzip.com) installed, if you do not already have it.)

You are now ready to proceed.

There are 5 distinct steps to getting MRTG running for the first time. Follow the link to each step below to begin.

1.        INSTALLING PERL

2.        INSTALLING MRTG

3.        RUNNING CFGMAKER

4.        RUNNING MRTG

5.        RUNNING MRTG AS DAEMON

That’s it! Five easy steps to success. What if it doesn’t work? Make sure you did it exactly as shown. The demo in the example has worked for me dozens of times. If this doesn’t fix it, then I would search the list-serve archive. If you have a problem, my guess is it has happened several times before. You can do a full search of the MRTG archives. Also, don’t try to do too much before you get one good running installation on something simple. Only a fool would jump in and try to monitor a complex box. (Yes, I was a fool!) I do suggest signing up for the MRTG users mailing list. It is quite good and stays on topic and isn’t full of spam!

INSTALLING PERL

Download the latest version of Perl from ActiveState to your desktop. After the download process has completed, double click on the program to begin the installation process.

Choose Next to continue.

 

Accept the End-User License Agreement and choose Next to continue.

 

Change the installation path to match your computer. (This set up uses F:\Perl\.)
Choose Next to continue.

 

Verify the following choices are selected and choose Next to continue.

 

Choose Install to begin the installation process.

 

The installation will take a few minutes.

 

After a few minutes, choose Finish to complete the installation.

 

To verify the Perl path is set correctly, Right Click on My Computer and select Properties.

 

Select the Environment Variables from the Advanced tab.

 

See the path listed under System Variables.

 

Choose OK to close the current windows. You have successfully installed Perl.
Now you can install MRTG.

INSTALLING MRTG

Before you can install MRTG, you need to download and install Perl first.

Download MRTG to your desktop.

You also need WinZip (or another unzip utility).

Double Click the MRTG icon to unzip the file.

 

Notice there is a default path (right) in the above screen. Choose the location to unzip MRTG and then choose Extract. After the extraction process completes, close WinZip.

 

Navigate to the location you extracted MRTG to and notice the odd name on the folder.
Right Click on the folder and select Rename. Change the name to mrtg.

 

Create a new folder called on the same drive called mrtghtml.

 

You are now finished with the installation of MRTG.

The next step is to create a config file for the MRTG data you will collect. You can create this file with CFGMAKER.

RUNNING CFGMAKER

CFGMAKER is used to create a configuration text file for MRTG Data Collection.
It is ran from a DOS Prompt. Before running CFGMAKER, download an install MRTG and Perl.

Begin by opening a DOS Window by typing command in the Run box. Choose OK.

 

Navigate to the mrtg\bin directory.

 

This is the fun part! At this point, you must know the community string and IP address for the equipment you want to monitor. If you don’t know, you most likely don’t have any business monitoring it! In this document, I will use a Windows NT Server. It would work exactly the same for a router, bridge, or switch. The only difference would be the output file might include several interfaces (or ports) instead of just one. We will use the community string of public and an IP of 10.1.1.1. Substitute yours as appropriate. Also, we will name the cfg file server.cfg.
Use a name that makes sense to you and your environment.

Type the following syntax on one line as follows. (DOS may automatically wrap the text which is acceptable.)

perl cfgmaker public@10.1.1.1 –global “WorkDir: f:\mrtghtml” –output server.cfg

Hit Enter when finished. If you used the correct information, your output should look similar to the output below.

 

You have now created your first cfg file. For more config options also check Indexmaker. We can now move forward and start collecting data. Read further and learn how to start MRTG.

RUNNING MRTG

You are now ready to collect data with MRTG.

At the command prompt, type

perl mrtg server.cfg

substituting the name of your cfg file as needed.

 

You have now collected your first data. Wait about 5 minutes and run the same command again.

Navigate to the mrtghtml directory created earlier and open the web page. It should be defined as the device IP and interface number. If you did a something with multiple active interfaces, you will have many web pages.
Double click to open the web page in Internet Explorer (or your default browser).

 

Your web page will look close to mine. CLICK HERE. Notice the Daily Graph has the start of a graph on the left edge. Also, there is data directly below the graph which represent the traffic levels. If you scroll down to the bottom, you will find some broken picture links.

Here is how to fix them. Navigate to the \mrtg\images directory. Select all images and copy.

 

Navigate to the \mrtghtml directory and paste. The problem is now fixed. Refresh the web page in the browser to see the corrected image links.

 

Lets progress to collecting data 24 X 7 X 365.

COLLECTING DATA 24 X 7 X 365

You could collect data sitting around all day and run MRTG manually from a command prompt. However, I bet you have better things to do with your time. The simplest way to run MRTG is to run it as a daemon.

Navigate to the \mrtg\bin directory and find your cfg file. This example has used server.cfg. Open the file with Notepad.

 

Your cfg file will look similar to this.CLICK HERE.Near the top of the file, type the following syntax:

RunAsDaemon: Yes
Interval: 5

This will cause MRTG to run every 5 minutes.

 

Return to the DOS window and run MRTG again.

 

MRTG is now collecting data every 5 minutes. You can minimize the DOS window to your task bar. Now you have completely finished installing MRTG.

Closing the window will cause MRTG to die!

If you accidentally closed your MRTG window, open a new DOS window and restart MRTG.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

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