Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I'd like to monitor bandwidth usage. What should I use?
If you're interested in monitoring bandwidth and have done a little research, you probably have run across MRTG, RRDtool, and Cricket. While these three packages are all fantastic and popular tools, you should also consider a lesser known tool named RTG. (Learn about all of your options, and then choose the utility that best suits your needs.) As of this writing, the current version of RTG, which is available from http://rtg.sourceforge.net and is licensed under the GPL, is 0.7.4.
Designed for enterprises and service providers that need to collect time-series SNMP data from a large number of targets, RTG is a flexible, scalable, high-performance SNMP statistics monitoring system. All collected data is inserted into a relational database that provides a common interface for applications to generate complex queries and reports. Currently the only officially supported database is MySQL, but PostgreSQL support is available in CVS.
Written in C, RTG runs as a multi-threaded daemon, making it extremely lightweight and fast. Unlike tools such as MRTG, it does no data averaging. The up-side to this is that you can get information from arbitrary time intervals and get exact information suitable for billing. The downside is that, as time goes on, you have more and more data to store (MRTG data files never grow due to the data consolidation algorithm it uses).
Installation is the usual ./configure && make && make install. You�ll need the MySQL libraries, often called mysql-devel by distributions, and Net-SNMP libraries to perform the install. After the make install is complete, run the included script to create the necessary MySQL database, tables, and user.
$ /usr/local/rtg/etc/createdb mysql_root_password
Now that the database is setup, add any routers you want to monitor to /usr/local/rtg/etc/routers. The format is device:community:bits, where device is the DNS name or IP address of the device you�d like to monitor, community is the SNMP community name, and bits is an optional parameter to allow you to change the default behavior of using 32-bit SNMP counters. After you�ve entered each device on its own line, run /usr/local/rtg/etc/rtgtargmkr.pl, which creates a targets.cfg file.
You are now ready to run the RTG poller:
If the poller fails to find a configuration file, it creates one named rtg.conf in the current directory. (You may need to edit this file if your installation is non-standard.) By default, rtgpoll stays in the foreground. Once you have everything configured and working correctly, add the appropriate line to run rtgpoll in the background to your startup scripts.
Now that you have the poller running, take a look at the data. RTG provides a variety of web scripts to display the information. Additionally, since the data is simply stored in the database, you are free to write a script in your preferred language to present the data in a way that� most useful to you.
For this article, let�s assume that you already have a PHP-enabled web server running. First, copy the included scripts to a directory accessible from your web server.
You can now view Interactive Reports at http:// your_machine /rtg/rtg.php; 95th percentile queries at http:// your_machine /rtg/95.php; and MRTG-style overview and daily, weekly, and monthly plots at http:// your_machine /rtg/view.php.
You can also call rtgplot.cgi directly by passing in the appropriate parameters.
Additionally, RTG provides a command-line Perl script that yields plain, text reports. For instance, typing $./report.pl customername 01/01/2005 01/02/2005
generates a report like that shown in Figure One.
FIGURE ONE: The output of RTG�s reporting script
Period: [01/01/2005 00:00:00 to 01/03/2005 00:00:00]
In Out Avg In Avg Out Util Util Max In Max Out Max Ut Max Ut
Connection MBytes MBytes Mbps Mbps In % Out% Mbps Mbps In% Out%
Ethernet0/1 x.x.x.x 106 212 0.08 0.16 0.80 1.60 0.70 0.90 7.00 14.20
Total: 106 212 0.08 0.16 0.80 1.60 0.70 0.90 7.00 14.20
By using the included scripts and leveraging the ability to write your own custom scripts, RTG will quickly and easily allow you to not only monitor bandwidth usage, but also setup billing scripts, trigger alerts based on custom monitoring thresholds and almost anything else you can imagine.