amset

.info
.co.uk - exchange consultancy
.net - internet based solutions

Broadband - Exchange
Login Scripts - Net Admin
Outlook - Windows Mobile
Windows

Contact - Advertise

AddThis Social Bookmark Button

Network Admin

Branding "System Properties"
with Your Own Information
... Win XP, 2000 and older
... Vista

Changing ISPs Plan

Changing Internal
IP Addresses Plan

Custom Text on the
"Workstation Locked" Screen

Downloading a Complete
Internet Explorer Installation

Group Policy Admin

Login Scripts

Limiting the Number of Logins a User Can Make

MRTG Statistics

Recovery Console

Reset Administrator Password

Run As

Subnet Masks

Uptime Statistics

Using NetMeeting for
Remote Control

Viewing Printers in a
Web Browser

Install and Setup MRTG on Windows and IIS

MRTG is a popular stats logging tool which takes information from SNMP compatible equipment and creates a graph. Over time it can show data patterns for troubleshooting or idle interest. Getting this package to operate correctly on Windows can be tricky, so this page outlines how to do it, and make sure that it keeps updating without further intervention from a user.

Requirements

MRTG - You will need the precompiled version for use on Windows. You can download it from the following location: http://people.ee.ethz.ch/~oetiker/webtools/mrtg/pub/
Get the highest version available - the Windows version is in a .zip file.

Perl for Windows - Download from here: http://www.activestate.com/Products/ActivePerl/

SNMP Device - This page uses a PIX 501. It is very similar for other devices.

Optional - Web Server - If you want to serve the web pages that this application creates, then you will need a web server - such as IIS or PWS.

Device Configuration

Make sure that the device you want to collect statistics from has SNMP with at least read setup. You may also have to enter a community name - the default is usually "public" but you can change this. Make sure that you remember what you have called it.
You may also have to or wish to configure what machines can collect SNMP information. This is usually restricted by IP address. Add the IP address of the machine that you are going to run MRTG on.
The device should also have a static IP address - which is usually the case if you are collecting statistics of a gateway device.

Installation

Install Perl from the setup file you downloaded from ActiveState (above). If you have IIS or Personal Web Server on your machine the installer should detect this and add the required entries in to the web server. This isn't required as the application doesn't actually run as a web application.

Extract MRTG in to it's own folder. For ease of use, move the main MRTG folder in to the root of your C:\ drive in a directory called MRTG. This makes calling the scripts easier.

Create another directory called MRTGHTML - this is where the output from the application will be placed. Again create this in the root of your C:\ drive. If you want IIS to look at this content, then add an virtual directory to your web site pointing at this location.

Test the Installation

Testing that the installation works is very simple. Open a Command Prompt (DOS) window and change to the c:\mrtg\bin directory.

Type the following command

perl mrtg

You should get the help message about the correct way of using mrtg.

Creating the Configuration File

MRTG will create the configuration file for you.

Enter the following command, adjusting it for your own environment as appropriate.

perl cfgmaker public@10.0.0.254 --global "WorkDir: c:\mrtghtml" --output gateway.cfg

"public" is the SNMP community name.

"10.0.0.254" is the IP address of the device you want to monitor.

C:\mrtghtml is the location to store the output graphs

gateway.cfg is the file you want to write the configuration to. This can be anything as long as it ends in .cfg

Test the Configuration

Once the file has been written, you can test the configuration.

Drop in to a command prompt, again in the c:\mrtg\bin directory and type the following command:

perl mrtg gateway.cfg

Press enter.

After a moment or two you should see some graphs and HTML files appear in your chosen output directory.

Running MRTG repeatedly

To get MRTG to repeat the process and therefore create a series of graphs that show the traffic over time, you need to adjust the configuration file. You will find the file in the c:\mrtg\bin directory. Open it in notepad. Under the section which tells you what created the file add the following two lines.

RunAsDaemon: Yes
Interval: 5

The shortest the interval will run is 5, but you can increase it.

If you enter the same command as when testing the configuration, the process will be repeated every five minutes, if you leave the DOS window open.

Hiding the running MRTG

Obviously you will want to hide the running MRTG session.

  1. Create a new notepad document and enter the command used to start mrtg in to the top line.
    ie
    perl mrtg gateway.cfg
  2. Save the file as mrtg.bat (choose "All Files" from the types menu and enter the full file name) and save it in the root of your C:\ drive. You could also use the MRTG directory.
  3. Open a new notepad document and enter the following text:
    CreateObject("Wscript.Shell").Run "c:\mrtg.bat",0
  4. Save the file as mrtg.vbs also in the root of your C:\ drive or in another location easily to hand.
  5. Place a shortcut to the vbs file in your startup group.
    Placing a shortcut to the bat file will not work as this will leave a DOS window open on your machine.

Sponsored Links

Last Page Update:
18/02/2006

Back to the Top
Contact Us - Advertise on amset.info
NetAdmin Index - Home Page


Broadband - Exchange - Login Scripts - Network Admin - Outlook - Windows Mobile - Windows


© Amset IT Solutions Ltd. 1998 - 2008. All rights reserved. Reproduction of any content on this web site is prohibited without express written consent. Use of this web site is subject to our terms and conditions. All trademarks and registered trademarks are property of their respective owners. This site is not endorsed or recommended by any company or organisation mentioned on this site. This site is to provide guidance only and as such we cannot be held responsible for any consequences of following the advice given.