Mrtg Configuration Overview

Source: Internet
Author: User
Tags perl interpreter install perl mrtg
Mrtg configuration overview-Linux Enterprise Application-Linux server application information. For details, refer to the following section. The official site of MRTG introduces MRTG as follows:

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 this traffic. check http://www.ee.ethz.ch/stats/mrtg/ for an example. MRTG is based on Perl and C and works under UNIX and Windows NT. MRTG is being successfully used on your sites around the net.

In short, MRTG is a system used to monitor the data traffic of network devices, such as switches and routers. the cornerstone of MRTG is the SNMP Simple Network Management Protocol. Most of MRTG code is written in PERL.

Next I will briefly introduce the installation and configuration of MRTG on windows and * nix systems.

1. installation:

(1) install MRTG on windows:

Running MRTG on windows requires installation of the PERL interpreter. We recommend that you try activeperl 5.8.5 or later in activestate. The home page of activestate is http://www.activestate.com/
If you want to view the html data summary generated by MRTG in a browser from any location, you also need to install apache or IIS. For installation instructions, see relevant books or instructions, we will not repeat it here.
Then from http://people.ee.ethz.ch /~ Oetiker/webtools/mrtg/pub/download mrtg's latest example mrtg 2.11.1.zip, decompress and install.

(2) * install MRTG on the nix platform:

First, PERL is installed on almost all * nix systems by default, so this step can be skipped in most cases. If you need to install PERL 5.8.5 or later, see the system manual.

Install apache 1.4. There are countless instructions on installing apache on the Internet. I recommend www.chinaunix.net on my FreeBSD system, the default installation path of apache is/usr/local/www/. The default page storage directory is/usr/local/www/data/, which is different from that of linux, note the differences with the system used in the following configuration steps.

The installation of MRTG involves several versions of shared libraries. Therefore, it is not recommended to install MRTG from the source code. if you are using debian or redhat, we strongly recommend that you use apt-get or rpm packages. If you are using BSD series, we strongly recommend that you use ports for installation.

Debian:
Apt-get install mrtg-2.11.1.tar.gz

FreeBSD or OpenBSD:
Cd/usr/ports/net-mgmt/mrtg/
Make install

I personally prefer to use port for installation, because it is easy to use ports for installation.

2. Configuration:

In windows, MRTG will be installed in a separate directory, depending on your preferences. In * nix, the typical layout is that all binary files, that is, the command line tool that comes with MRTG, will be installed in the/usr/local/bin directory, the configuration file is stored in the/usr/loca/etc/mrtg/directory.

The two main command line tools are producer maker and indexmaker. the producer maker is used to generate configuration files, while the indexmaker is used to generate html pages. these two tools are used exactly the same in windows and * nix. I will introduce them separately.

Here, I will take a 444 switch between xincun 5 #1100 devices as an example to describe that all the above installation processes are correct. At the same time, the following operations may require root permissions:

(1) Use of producer maker:

First, go to the/usr/local/etc/mrtg/directory:
Cd/usr/local/etc/mrtg/

There is only one mrtg. cfg. sample file in this directory. Then, type the following command:
/Usr/local/bin/mongomaker -- global "WorkDir:/usr/local/www/data/mrtg" -- global "RunAsDaemon: yes" -- global "Language: chinese "-- output example. cfg -- community = ******* 202.115.1.unity

Describe the meaning of the above command:
-- Global "WorkDir:/usr/local/www/data/mrtg"
This is a global configuration option. Specify the working directory as/usr/local/www/data/mrtg/. MRTG will put all the images and data in this directory, you can also use other options to separate images and data.

-- Global "RunAsDaemon: yes"
Specify mrtg to run in the form of a servo process. This line is required. If this line does not exist, mrtg will exit after running on the foreground.

-- Global "Language: chinese"
Specifies Chinese instructions on the html page.

-- Output example. cfg
Specify the configuration file name as example. cfg.

-- Community = ******
Specify the password. For security considerations, I use ***** to replace the password entered in the command line.

202.115.1.20.
This is the IP address of the 444 switch between the 5 #1100 devices in xincun.

After you enter the preceding command correctly and press the Enter key, mongomaker obtains the required configuration information from the switch through the SNMP Simple Network Management Protocol, for example, the IP address and network interface type on each network interface. after obtaining all the information about the vswitch, mongomaker writes the information to example. go to the cfg configuration file. in this case, mongomaker's work is complete.

Note: Here is only a very limited configuration example. In fact, the MRTG configuration file has many options and can be precisely controlled. for other configuration options for MRTG, see MRTG's maker manual http://people.ee.ethz.ch /~ Oetiker/webtools/mrtg/javasmaker.html

(2) Run mrtg:

So far, a configuration file example. cfg has been generated in the current directory. Now we can start MRTG and input the following in the command line:
/Usr/local/bin/mrtg example. cfg

If the configuration file is correct, the following line is output in the terminal console:
Daemonizing MRTG...

Congratulations, MRTG has started working.

Otherwise, let's start your troubleshooting journey. In most cases, errors are caused by incorrect typing.

(3) Use of indexmaker:

Compared with the use of volume maker, indexmaker is simpler. Enter the following command in the command line:
Indexmaker -- output =/usr/local/www/data/mrtg/index.html example. cfg

Here, indexmaker generates the html file/usr/local/www/data/mrtg/index.html according to the content of example. cfg.

Now, enter http: // 202.115.22.157/mrtg in any web browser to view the data traffic on the switch. here, 202.115.22.157 is my current IP address. You need to replace it with your own IP address When configuring.

Similarly, indexmaker has many other options. If you are interested in other options of indexmaker, see the indexmaker manual http://people.ee.ethz.ch /~ Oetiker/webtools/mrtg/indexmaker.html

In summary, this article seems to have a very strong sense, but because the most important thing in the process is to obtain information on network devices, it takes a lot of time to describe it.

Again, the purpose of this article is to briefly introduce the basic installation and configuration process of MRTG. For more information about the installation and configuration of MRTG, see the description on the official website of the MRTG project.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.