'*******************************************************************************
'*                                                                             *
'* TTraffic 1.0.0 (distributed under GNU GENERAL PUBLIC LICENSE)              *
'* by kamborio                                                                 *
'*                                                                             *
'* ------------------------------------------------------                      *
'*  _                       _                   _                              *
'* | | __  __ _  _ __ ___  | |__    ___   _ __ (_)  ___                        *
'* | |/ / / _` || '_ ` _ \ | '_ \  / _ \ | '__|| | / _ \                       *
'* |   < | (_| || | | | | || |_) || (_) || |   | || (_) |                      *
'* |_|\_\ \__,_||_| |_| |_||_.__/  \___/ |_|   |_| \___/                       *
'* ------------------------------------------------------                      *
'*                               http://www.kamborio.com/                      *
'*                                                                             *
'* Copyright (C) 2001 David A. Pérez (david@kamborio.com)                      *
'*                                                                             *
'* This program is free software; you can redistribute it and/or modify it     *
'* under the terms of the GNU General Public License as published by the Free  *
'* Software Foundation; either version 2 of the License, or (at your option)   *
'* any later version.                                                          *
'*                                                                             *
'* This program is distributed in the hope that it will be useful, but WITHOUT *
'* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       *
'* FITNESS FOR A  PARTICULAR PURPOSE. See the GNU General Public License for   *
'* more details.                                                               *
'*                                                                             *
'* You should have received a copy of the GNU General Public License along     *
'* with this program; if not, write to the:                                    *
'*                                                                             *
'* Free Software Foundation, Inc.                                              *
'* 59 Temple Place - Suite 330                                                 *
'* Boston, MA 02111-1307, USA                                                  *
'*                                                                             *
'*******************************************************************************

TTrafic is a small VBScript to analyse MRTG (http://www.mrtg.org/) log files. By
using this script, you will be able to know which amount of traffic is going
through your interfaces.



INSTALLATION

Copy the file TTrafic.asp to the directory where MRTG is generating the HTML
pages.

The files generated by MRTG have the extension HTML by default. You have to edit
your MRTG config file and modify it to make MRTG generate the HTML pages with
the extension ASP.

You should add or edit this line to your config file:

Extension[_]: asp

Now, you only need to include the file on the generated pages. The best way to do
this, is by editing the MRTG config file and adding this line,

<!-- #Include File = "TTrafic.asp" -->

to the PageTop option.

For example:

Target[core.router.4]: 4:public@core.router
MaxBytes[core.router.4]: 1310720
Title[core.router.4]: core.router: Ethernet0
PageTop[core.router.4]: <H1>Traffic Analysis for core.router: Ethernet0
 </H1>
 <TABLE>
   <TR><TD>System:</TD><TD>core.router in the office</TD></TR>
   <TR><TD>Maintainer:</TD><TD>Myself</TD></TR>
   <TR><TD>Interface:</TD><TD>Ethernet0 (4)</TD></TR>
   <TR><TD>IP:</TD><TD> (10.0.0.1)</TD></TR>
   <TR><TD>Max Speed:</TD><TD>2.0 MBits/s</TD></TR>
 </TABLE>
 <!-- #Include File = "TTrafic.asp" -->



QUERYS

If the generated page is "core.router.4.asp", you can try to query the page like
this:

http://server/MRTG/core.router.4.asp?Period=365&Order=M

This will give you the traffic information for the last 365 days. You can enter
any value here. The default is 30 days.

Order can be any of these values: K, M, G, T or P.

K stands for kbytes, M for Megabytes, G for Gigabytes, T for Terabytes and P for
Petabytes. If you enter any other value, you will receive the information in
Bytes. The default is Gigabytes.