Network Management & Monitoring with Linux
MRTG is an advanced tool written by Tobias Oetiker and Dave Rand to graphically represent the data SNMP agents brings to SNMP managers. It generates nice HTML pages with GIF graphics about inbound and outbound traffic in network interfaces in almost real time. This abstracts the idea of dealing directly with objects of an MIB with a command line tool like CMU-SNMP. This is the simplest and most powerful tool to monitor my routers I have found on the Internet.
MRTG uses an SNMP implementation coded entirely in Perl, so there is no need to install other packages. The main program is written in C to speed up the logging process and the generation of GIF images. The graphics are generated with the help of the GD library from Thomas Boutell, author of the WWW FAQ.
One of the highlights of MRTG is its expandability and powerful configuration. It's very easy to monitor any SNMP variables instead of traffic, like error packets, system load, modem availability and others. It's even possible to import data from an external program to feed the data, so you can use it to monitor login sessions and other information not available through SNMP.
It comes with some tools to watch your router for interfaces, extract their characteristics and generate a base configuration file you can easily tweak to accommodate your needs.
Another interesting feature of MRTG is the amount of information it generates. It permits four levels of detail for each interface: traffic in the last 24 hours, the last week, the last month and a yearly graphic. This allows you to gather information for statistical purposes. It maintains an accumulated database with all this information with the help of a consolidation algorithm that prevents the data in the logs from eating up your disk space.
It also generates a main page that contains the GIF images of the daily details of every interface of a router, which lets you have a complete idea of what's happening in your router with a simple look. You can see the main page and a detail page generated by MRTG in Figures 3 and 4.
Figure 4. Interface Detail Page
Let's see a basic installation procedure. First of all, you need the distribution of MRTG. At the time of this writing, the latest version was 2.1; check the URL in the references sidebar for the latest version.
A package you must install before compiling MRTG is the GD graphic library. The URL is in the references sidebar, too. The current version of GD is 1.2, and you shouldn't have any problems compiling and installing it. Simply run make in the directory you unpacked the distribution and a file called libgd.a will be generated. Copy this file to /usr/local/lib and all the .h files to the directory /usr/local/include/gd.
At this point you should have GD up and running. Now is the time to build the MRTG package. Unpack the distribution, and edit the Makefile, indicating where to find the GD libraries and header files, and the Perl 5.003 binary—usually /usr/bin/perl or /usr/local/bin/perl. This is done through the variables GD_LIB, GD_INCLUDE and PERL.
Build the main program by typing make rateup, and when the compilation finished, enter make substitute to include the correct PATH to the Perl interpreter within the set of Perl scripts that MRTG uses.
Copy the following files to the final destination of the binaries (for example, /usr/local/mrtg): BER.pm, SNMP_Session.pm, mrtg and rateup. You can also copy to this location the two configuration programs, indexmaker and cfgmaker.
Ensure that all the programs have the execution bit set. Now we're ready to build a simple configuration file. At this point you should have SNMP read access to your router. In a Cisco router, the configuration lines to allow this are the following:
access-list 99 permit 193.147.0.8 access-list 99 permit 193.147.0.9 access-list 99 permit 193.147.0.130 snmp-server community public RO 99
This allows read-only requests from the addresses specified in the access list 99 using “public” as a password (community). If you want to allow every node in the network Read Only (RO) access to the router, you can have a line like this one:
snmp-server community public ROIf you have another brand of router, check the manuals to determine how to allow SNMP access to them.
The cfgmaker script greatly simplifies the task of building the configuration file. All you have to do is run it with the following arguments:
cfgmaker <community>@<router-host-name or IP>
For example:
cfgmaker public@mec-router.rediris.es > mrtg.cfgIt will discover every interface in your router and write a section in the file with its specifications of numbers of interfaces, maximum speed, description, etc, with some HTML tags to include them in the detail page. It's possible to edit this HTML layout to suit your language, preferences, etc. You can see in Figure 5 the output for one of the interfaces of my router.
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.
Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.
Sponsored by ActiveState
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?
| Non-Linux FOSS: libnotify, OS X Style | Jun 18, 2013 |
| Containers—Not Virtual Machines—Are the Future Cloud | Jun 17, 2013 |
| Lock-Free Multi-Producer Multi-Consumer Queue on Ring Buffer | Jun 12, 2013 |
| Weechat, Irssi's Little Brother | Jun 11, 2013 |
| One Tail Just Isn't Enough | Jun 07, 2013 |
| Introduction to MapReduce with Hadoop on Linux | Jun 05, 2013 |
- Containers—Not Virtual Machines—Are the Future Cloud
- Non-Linux FOSS: libnotify, OS X Style
- Linux Systems Administrator
- Validate an E-Mail Address with PHP, the Right Way
- Lock-Free Multi-Producer Multi-Consumer Queue on Ring Buffer
- Senior Perl Developer
- Technical Support Rep
- UX Designer
- Introduction to MapReduce with Hadoop on Linux
- RSS Feeds
- One advantage with VMs
46 min 31 sec ago - about info
1 hour 19 min ago - info
1 hour 20 min ago - info
1 hour 21 min ago - info
1 hour 23 min ago - info
1 hour 24 min ago - abut info
1 hour 26 min ago - info
1 hour 27 min ago - info
1 hour 28 min ago - info
1 hour 29 min ago




Comments
NPRE
I am monitoring my AIX PPC machines through MRTG, but standard AIX SNMP does not provide any information CPU/Paging/Disk ..etc.
You need to install a different SNMP agent, or collect the data via a different method, I use the NRPE agent and plugins, with the mrtg-nrpe.pl
Dipl.-Ing. Fadi Sodah
Network and Systems Engineer
IBM AIX System Specialist, CCNP, CCSP
great article
Easy to understand and great article.
Thank u David
mib compilation.
hi,
i,Hrisikesh want to know how to compile the new MIB which is specific to my company product and in which path i will put the new MIB in linux 2.4.18-14.
and what is procedure to execute a new MIB in linux 2.4.18-14.
i am eagerly waiting to ur mail.
thanks
hrisi
Mrtg on Linux
Helllo
This is very impressive document, sir plz i need to add one more ip in my mrtg becuase we added one more ip on our ethernet and we need to know its usage as well and i am trying to find out where we add the new ip but i am not able to find it out.
Please help me out in this matter.
Thanks & Regards