RTG (Bandwidth and
Installation and Configuration
What is RTG ?
RTG Stands for Real Traffic Grabber.RTG is a flexible, scalable,
high-performance SNMP statistics monitoring system. It is
designed for enterprises and service providers who need to
collect time-series SNMP data from a large number of targets
quickly. All collected data is inserted into a relational
database that provides a common interface for applications to
generate complex queries and reports. RTG includes utilities
that generate configuration and target files, traffic reports,
95th percentile reports and graphical data plots. These
utilities may be used to produce a web-based interface to the
Runs as a daemon, incurring no cron or kernel startup overhead
Written entirely in C for speed, incurring no interpreter
Multi-threaded for asynchronous polling and database insertion
Inserts data into a relational database where complex queries
and reports may be generated
Performs no data averaging in order to support billing, etc.
RTG comes as C source code and is intended to run on UNIX
systems. RTG requires a UNIX system with POSIX thread support,
64-bit long integers and a sane compiler (gcc works great). RTG
requires two external packages:
If you want to configure your database you must know the MYSQL
root password. The createdb script will setup the database for
If you want to configure Rtg you need to edit two configuration
files in /usr/local/rtg/etc folder i.e routers
routers file, adding each router you wish to SNMP poll, one per
line. To specify a per-router non-default community string,
add "router:community" in the routers file. To specify a
per-router non-default response bit width, add "router:community:bits"
in the routers file.
Edit rtgtargmkr.pl(located at /usr/local/rtg/etc) to change the
default SNMP read community if necessary. To use 64bit OIDs
(recommended if supported by the device), change the "bits"
field in rtgtargmkr.pl to 64.
rtgtargmkr.pl script to manage the RTG target file. The first
run will create a targets.cfg file.
This will create a targets.cfg file with all your routers and
switches interfaces details in this.One more important thing is
if you do any changes to your router configuration file you need
to run the rtgtargmkr.pl otherwise it will not show the new
changes after running this script you need to update your
database to see these changes.When you run the perl script it
will give the command name you need to run in mysql database
command you can see one example as follows
Interface description changed.
Was: "global network 100Mbps"
Now: "global_network 100Mbps"
Suggest: UPDATE interface SET description='global_network
100Mbps' WHERE id=7
now you need to login in to your mysql database using the
#mysql rtg -p -u snmp
mysql> UPDATE interface SET description='global_network 100Mbps'
this will update the changes in your database.
Presently you need to do manually every time you do some changes
and this one i don't like personally.
If the poller does not find a configuration file, it will create
one in the current directory called "rtg.conf". You may need to
edit this file if your installation is non-standard. If the
poller is successful, the "Polls" counter in the statistics
banner will increase and then a countdown to the next poll is
displayed. The DBInserts should increment after the second
If rtgpoll or rtgplot cannot find an rtg.conf file in any of
these paths, it will attempt to create one in the current
working directory.Most users maintain a master rtg.conf file
customized for their environment. rtg.conf contains the
following configurable fields:
Interval is the time between successive polls of the target
list,default is 300 seconds (5 minutes). HighSkewSlop defines
the maximum number of Intervals allowed between two consecutive
poll values before the time in seconds between said points is
deemed too large to calculate a valid rate. With the default
Interval and HighSkewSlop values, that time would be 300 * 3 (15
minutes). LowSkewSlop defines the minimum number of Intervals
alloweed between two consecutive poll values before the time in
seconds between said points is deemed two low to calculate a
valid rate. With the default Interval and LowSkewSlop values,
that time would be 300 * 0.5 (2.5 minutes). OutOfRange defines
an upper bound above which rtgpoll will never attempt an insert
into the database.
OutOfRange should be a multiple of the maximum number of bytes
possible in the defined Interval for your highest speed link.
The default OutOfRange value will suffice in most
installations. SNMP_Ver specifies the SNMP version the poller
will use. The number of threads rtgpoll will use is defined in
the variable Threads.
Variables in rtg.conf must match the names above
exactly.Comments and blank lines are allowed and the ordering of
variables in rtg.conf does not matter.
The target file specifies the objects to be SNMP polled.
Comments must be preceded with a '#' sign. Elements in the
target file are tab delimited.
The format of the target file is fixed:
# Host OID 64/32 Community Table ID Description
Host = IP or hostname of target
OID = Full SNMP OID, e.g. .22.214.171.124.126.96.36.199.188.8.131.52
64/32/0 = Specify 64/32 bit objects or 0 for gauge objects
Community = SNMP Community
Table = MySQL table in the database to use
ID = A unique ID that is used with each insert
Description = Free text
rtgpoll first reads the configuration file, then the target
file.For each SNMP poll, rtgpoll will attempt an SQL INSERT of
INSERT INTO Table VALUES (ID, NOW(), bigint)
Where Table is the name of the database table and ID is an
integer. Both Table and ID come from the target list, NOW() is
the current timestamp and bigint is the delta value between
successive SNMP polls.
RTG makes no attempt at determining rate; one must look at the
time difference successive entries in the database. The RTG
graphing and reporting tools automatically calculate rate.