<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://hurlster.com/wiki/index.php?action=history&amp;feed=atom&amp;title=RTG</id>
	<title>RTG - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://hurlster.com/wiki/index.php?action=history&amp;feed=atom&amp;title=RTG"/>
	<link rel="alternate" type="text/html" href="https://hurlster.com/wiki/index.php?title=RTG&amp;action=history"/>
	<updated>2026-08-25T19:00:48Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.38.4</generator>
	<entry>
		<id>https://hurlster.com/wiki/index.php?title=RTG&amp;diff=2406&amp;oldid=prev</id>
		<title>Gqwill69 at 17:21, 27 July 2011</title>
		<link rel="alternate" type="text/html" href="https://hurlster.com/wiki/index.php?title=RTG&amp;diff=2406&amp;oldid=prev"/>
		<updated>2011-07-27T17:21:47Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=== Get Source ===&lt;br /&gt;
 http://sourceforge.net/projects/rtg/&lt;br /&gt;
&lt;br /&gt;
=== Build Supporting Packages ===&lt;br /&gt;
 apt-get install libapache2-mod-php5 mysql-server php5-mysql php5-snmp rrdtool  \&lt;br /&gt;
 libmysqlclient-dev libmysqlclient16 php-pear php5-cgi php5-cli php5-gd \&lt;br /&gt;
 php5-mysql php5-snmp libsnmp-base libsnmp libsnmp-dev php5-snmp snmp gcc g++ make patch unp&lt;br /&gt;
&lt;br /&gt;
=== Compile ===&lt;br /&gt;
 ./configure&lt;br /&gt;
 make&lt;br /&gt;
 make install&lt;br /&gt;
&lt;br /&gt;
This will install all the configuration files under /usr/local/rtg folder&lt;br /&gt;
&lt;br /&gt;
=== Configure ===&lt;br /&gt;
Now you need to copy rtgplolt file using the following command&lt;br /&gt;
 cp /usr/local/src/rtg-0.7.4/src/rtgplot /usr/local/bin/rtgplot&lt;br /&gt;
&lt;br /&gt;
If you want to configure your database you must know the MYSQL root password. The createdb script will setup the database for RTG.&lt;br /&gt;
 /usr/local/rtg/etc/createdb mysqlrootpassword&lt;br /&gt;
&lt;br /&gt;
If you want to configure Rtg you need to edit two configuration files in &lt;br /&gt;
 /usr/local/rtg/etc/routers&lt;br /&gt;
&lt;br /&gt;
=== Target Maker file ===&lt;br /&gt;
&lt;br /&gt;
Edit rtgtargmkr.pl(located at /usr/local/rtg/etc) to change the default SNMP read community if necessary.  &amp;lt;br&amp;gt;To use 64bit OIDs (recommended if supported by the device), change the &amp;quot;bits&amp;quot; field in rtgtargmkr.pl to 64.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
rtgtargmkr.pl script to manage the RTG target file.  The first run will create a targets.cfg file.&lt;br /&gt;
&lt;br /&gt;
 ./rtgtargmkr.pl&lt;br /&gt;
&lt;br /&gt;
This will create a targets.cfg file with all your routers and switches interfaces details in this.One more important thing&amp;lt;br&amp;gt; is if you do any changes to your router configuration file you need to run the rtgtargmkr.pl otherwise it will not show the &amp;lt;br&amp;gt;new changes after running this script you need to update your database to see these changes.When you run the perl &amp;lt;br&amp;gt;script it will give the command name you need to run in mysql database command you can see one example as follows&lt;br /&gt;
&lt;br /&gt;
      Interface description changed.&lt;br /&gt;
       Was: &amp;quot;global network 100Mbps&amp;quot;&lt;br /&gt;
       Now: &amp;quot;global_network 100Mbps&amp;quot;&lt;br /&gt;
       Suggest: UPDATE interface SET description=&amp;#039;global_network 100Mbps&amp;#039; WHERE id=7&lt;br /&gt;
&lt;br /&gt;
now you need to login in to your mysql database using the following command&lt;br /&gt;
 mysql rtg -p -u snmp&lt;br /&gt;
 Enter PASSWORD&lt;br /&gt;
 mysql&amp;gt; UPDATE interface SET description=&amp;#039;global_network 100Mbps&amp;#039; WHERE id=7;&lt;br /&gt;
&lt;br /&gt;
this will update the changes in your database.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Presently you need to do manually every time you do some changes and this one i don&amp;#039;t like personally.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Starting Poller===&lt;br /&gt;
&lt;br /&gt;
Start up the poller to use the target list&lt;br /&gt;
&lt;br /&gt;
 /usr/local/rtg/bin/rtgpoll -v -t /usr/local/rtg/etc/targets.cfg&lt;br /&gt;
&lt;br /&gt;
If the poller does not find a configuration file, it will create one in the current directory called &amp;quot;rtg.conf&amp;quot;.  You may need to edit this file if your installation is non-standard.  If the poller is successful, the &amp;quot;Polls&amp;quot; counter in the statistics banner will increase and then a countdown to the next poll is displayed. The DBInserts should increment after the second polling round.&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
 Interval         300&lt;br /&gt;
 HighSkewSlop     3&lt;br /&gt;
 LowSkewSlop      .5&lt;br /&gt;
 OutOfRange       93750000000&lt;br /&gt;
 SNMP_Ver         1&lt;br /&gt;
 SNMP_Port       161&lt;br /&gt;
 DB_Host          localhost&lt;br /&gt;
 DB_Database      rtg&lt;br /&gt;
 DB_User          snmp&lt;br /&gt;
 DB_Pass          rtgdefault&lt;br /&gt;
 Threads          5&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
The target file specifies the objects to be SNMP polled.  Comments must be preceded with a &amp;#039;#&amp;#039; sign.  Elements in the target file are tab delimited.&lt;br /&gt;
&lt;br /&gt;
The format of the target file is fixed:&lt;br /&gt;
&lt;br /&gt;
 Host  OID  64/32  Community  Table   ID   Description&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
 Host        = IP or hostname of target&lt;br /&gt;
 OID         = Full SNMP OID, e.g. .1.3.6.1.2.1.31.1.1.1.10.19&lt;br /&gt;
 64/32/0     = Specify 64/32 bit objects or 0 for gauge objects&lt;br /&gt;
 Community   = SNMP Community&lt;br /&gt;
 Table       = MySQL table in the database to use&lt;br /&gt;
 ID          = A unique ID that is used with each insert&lt;br /&gt;
 Description = Free text&lt;br /&gt;
&lt;br /&gt;
rtgpoll first reads the configuration file, then the target file.For each SNMP poll, rtgpoll will attempt an SQL INSERT of the form:&lt;br /&gt;
&lt;br /&gt;
 INSERT INTO Table VALUES (ID, NOW(), bigint)&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
Adding poller to crontab&lt;br /&gt;
&lt;br /&gt;
 crontab -e&lt;br /&gt;
 &lt;br /&gt;
 @reboot /usr/local/rtg/bin/rtgpoll -v -t /usr/local/rtg/etc/targets.cfg -c /usr/local/rtg/etc/rtg.conf&lt;br /&gt;
&lt;br /&gt;
The above command automatically starts when you reboot your server.&lt;br /&gt;
&lt;br /&gt;
=== Web interface and Graphs ===&lt;br /&gt;
&lt;br /&gt;
your configuration is ready and now you need to configure the web interface to view graphs and 95th percentile data for this you need to configure the following steps&lt;br /&gt;
&lt;br /&gt;
 cp /usr/local/rtg/web/ /var/www/rtgweb/&lt;br /&gt;
&lt;br /&gt;
Copy the rtgplot binary to the /var/www/rtgweb/ directory and *add* .cgi&lt;br /&gt;
&lt;br /&gt;
 cp /usr/local/rtg/bin/rtgplot /var/www/rtgweb/rtgplot.cgi&lt;br /&gt;
 &lt;br /&gt;
 or&lt;br /&gt;
 &lt;br /&gt;
 ln -i -s /usr/local/bin/rtgplot /var/www/rtgweb/rtgplot.cgi&lt;br /&gt;
&lt;br /&gt;
Now you need to create a apache2 website enable file name rtg with the following content&lt;br /&gt;
&lt;br /&gt;
 vi /etc/apache2/sites-enabled/rtg&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;Directory &amp;quot;/var/www/rtgweb/&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
       AllowOverride AuthConfig&lt;br /&gt;
       AddType application/x-httpd-php .php&lt;br /&gt;
       AddHandler cgi-script .cgi&lt;br /&gt;
       Options +ExecCGI&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/Directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and exit this file.Now you need to enable this site using the following&lt;br /&gt;
&lt;br /&gt;
 a2ensite rtg&lt;br /&gt;
&lt;br /&gt;
Restart apache server&lt;br /&gt;
&lt;br /&gt;
 /etc/init.d/apache2 restart&lt;br /&gt;
&lt;br /&gt;
Now you need to secure rtg web interface with .htaccess file for this we need to create a .htaccess file in /var/www/rtgweb/ directory&lt;br /&gt;
&lt;br /&gt;
 cd /var/www/rtgweb/&lt;br /&gt;
 &lt;br /&gt;
 touch .htaccess&lt;br /&gt;
&lt;br /&gt;
Now you need to enter the content in .htaccess file as follows&lt;br /&gt;
&lt;br /&gt;
 AuthUserFile /var/www/rtgweb/.htpasswd&lt;br /&gt;
 AuthName Members&lt;br /&gt;
 AuthType Basic&lt;br /&gt;
 require valid-user&lt;br /&gt;
&lt;br /&gt;
Now you need to create admin user or users using the following command&lt;br /&gt;
&lt;br /&gt;
 htpasswd -b /var/www/rtgweb/.htpasswd  masteradmin password&lt;br /&gt;
&lt;br /&gt;
the above command will create a username as masteradmin with password as password.&lt;br /&gt;
&lt;br /&gt;
You can access rtg using the following command&lt;br /&gt;
&lt;br /&gt;
 http://yourserverip/rtgweb/&lt;br /&gt;
&lt;br /&gt;
Point your web browser at the URL (substitute your site in)&lt;br /&gt;
&lt;br /&gt;
       http://yourserverip/rtgweb/rtg.php  (Interactive Reports)&lt;br /&gt;
       http://yourserverip/rtgweb/95.php   (95th Percentile Queries)&lt;br /&gt;
       http://yourserverip/rtgweb/view.php (MRTG-style overview + day/wk/mo plots)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Linux]]&lt;/div&gt;</summary>
		<author><name>Gqwill69</name></author>
	</entry>
</feed>