Configuring Multi Router Traffic Grapher
To get started using Multi Router Traffic Grapher (MRTG) you will need to download the appropriate version for your operating system from http://oss.oetiker.ch/mrtg/. Another version, which is packaged with a few useful SNMP tools, is available from www.openxtra.co.uk/products/mrtgxtra. php.MRTG also requires Perl to function. Perl is a versatile scripting language that is in wide use. Perl is very rich in features and has modules to accomplish a variety of useful tasks.You can download ActivePerl from www.activestate.com/store/freedownload.aspx?prdGuid=81fbce82-6bd5- 49bc-a915-08d58c2648ca. After you have both of these downloaded, follow these steps to configure them.
- Run the installation file for Perl.
- Choose the target installation directory.
- When prompted, allow the Installation Wizard to add Perl to the PATH environment variable and create the Perl file extension association. This way your Perl scripts can be executed without having to explicitly provide the full path to the Perl executable.
- Uncompress the MRTG Zip file to a directory of your choosing.
- From the \mrtg-2.14.7\bin\ directory, run perl mrtg. It won't really do anything yet, because we still need to create the configuration file. This test is just to establish that Perl is in the PATH and can execute mrtg.
- From the \mrtg-2.14.7\bin\ directory, enter the following command: perl cfgmaker <SNMP STRING>@<SNMP DEVICE IP> -global "WorkDir: C:\www\webroot" -output mrtg.cfg. This will create an initial configuration file.You can always use a different working directory.The working directory is where MRTG will place the HTML files, so it is typically in the directory structure of a Web server. If everything works properly, you will receive no output on the command line, but an mrtg.cfg file will have been generated in the \bin\ directory.
If you get an error it probably means the community string is incorrect or the SNMP security settings are not enabling MRTG to connect. In either of those cases you can follow these steps to adjust the SNMP security settings on Windows XP.
- To edit the SNMP properties on a Windows XP system, open the Services plug-in (Start | Run | services.msc).
- Locate the SNMP service and double-click it. Click the Security tab.
- Ensure that the SNMP community strings are set correctly.
- If you do not wish to restrict which machines can use SNMP to communicate with the SNMP device, select the Accept SNMP packets from any host radio button. Otherwise, ensure that the system running MRTG is listed in the Accept SNMP packets from these hosts section and click OK.
At this point you should have the mrtg file successfully created using cfgmaker. This file is only the starting point and will still require some manual editing before it's really ready to use.
- You can now run MRTG using the following command from the \bin directory: perl mrtg mrtg.cfg.The first time you run the command you will get some warnings about missing log files.This is normal the first time it is run.
- Several files will be generated, the primary one being an HTML file beginning with the target host's name/IP address. If you open this in a browser it will show the bytes in and bytes out traffic statistics.
By scheduling MRTG to run regularly, you can build a history of data points that are used to populate the graphs.MRTG can be run in daemon mode. In this mode, once you start MRTG it will not exit; it will stay running and continue to collect data.To do this requires two steps. First, edit the configuration file and add the line RunAsDaemon:Yes in the Global Properties section. Second, start MRTG using the following command from a command prompt: start /b perl mrtg mrtg.cfg.Yet another way to accumulate the needed data is to run MRTG as a Windows service using the SRVANY.exe and INSTSRV.exe Microsoft utilities. Given the wide range of options, there should be a way to execute MRTG that suits your environment.
MRTG has the benefit that there are no limitations on the number of systems you can collect data from.Although throughput is the default metric, if you know the OID of the metric you wish to monitor,MRTG can collect and record historical data for that as well. Some good examples might be disk space, CPU utilization, network errors, and available memory. As an example of specifying the target OID, here is a target specification:
Target[RTR]: 1.3.6.1.2.1.2.2.1.14.1&1.3.6.1.2.1.2.2.1.20.1:pass@192.168.1.25
The OID format is <OID for first line in graph>&>OID for second line in graph>. In this example, you would be specifying a target device at IP address 192.168.1.25, using the SNMP community string of "pass."The OID to read would be 1.3.6.1.2.1.2.2.1.14.1 (input error counts) for one line on the graph, and 1.3.6.1.2.1.2.2.1.20.1 (output error counts) for the other line.The last number is the interface number. So the input error count on interface #2 would be 1.3.6.1.2.1.2.2.1.14.2.The label in the brackets (in this example "RTR") would be displayed on the graph page as a device name.
As you can see, getting simple throughput graphs in an HTML page using MRTG is pretty painless.With a little work, you can configure MRTG to graph a wide range of useful information. I would highly recommend doing some reading on the MRTG page with third-party documentation (http://oss.oetiker.ch/mrtg/3party.en.html). This page has many articles describing how to use MRTG in various circumstances. There are also links to many graphical utilities to help you manage your configuration files. For increased granularity in your graphs (as small as one-minute intervals) and more aesthetic graphs, check out RRDtool at http://oss.oetiker.ch/rrdtool/.
In this tutorial:
- Network Reporting and Troubleshooting
- Reporting on Bandwidth Usage and Other Metrics
- Collecting Data for Analysis
- Understanding SNMP
- SNMP Security
- Configuring Multi Router Traffic Grapher
- Configuring MZL & Novatech TrafficStatistic
- Configuring PRTG Traffic Grapher
- Configuring ntop
- Enabling SNMP on Windows Hosts
- Enabling SNMP on Linux Hosts
- Troubleshooting Network Problems
- Using a GUI Sniffer
- Using a Command-Line Sniffer
- Windump
- ngSniff
- Tcpdump
- Additional Troubleshooting Tools
- Netcat
- Tracetcp
- Netstat