Kyberdigi Labs
 Projects
  NTA
   Requirements
   License
   Download
   Installation
   Configuration
   Running
   Advantages
   Full stats demo
   Changelog
   History
   Bugs
Access counter
 
|
Network Traffic Analyzer
Sometimes it is good to know, how the network is used, how many bytes were
received and how many bytes were sent. Therefore, here is Network Traffic
Analyzer, which can create simple network usage statistics.
Such statistics can tell you, how good your network connection really is (who cares
about what Internet provider say ;-)), when was the network down, which time
is the best time for downloading large packages of data etc. etc. Or with
this software you can just better imagine, how many traffic can your home computer
generate.
Requirements
The basic for every computer is operating system. This software runs well
on Linux (it need not run on kernels 2.0.x, see the bugs
section), but it maybe can be ran on other platforms, I don't know. Please
let me know if you are more experienced with it. This software is a package
of few simple Perl scripts which generate static HTML files and some
pictures using the GD library.
List of requirements:
Note 1: On my old computer (Pentium 166 MHz MMX, 192M RAM, with a really lot of
processes running) I've tried to create full stats of last 24 hours, 7 days,
4 weeks and 6 months. The script was running for about 9 seconds.
Note 2: The script stores its data in a few files. You should have about
20kB free disk space per graph per network device.
License
This software is distributed under the terms of GPL.
Text version available.
Download
You can download one simple tarred and gziped archive
via HTTP protocol from this page:
nta-1.1.tar.gz
Size: 25552 bytes MD5: 41b4cc13912066595d897c001c42d013
You can download older versions too
Precompiled RPM packages (GD library for Perl inclusive,
tested on Redhat 7.2, 7.3, SuSE 7.2, 7.3 and 8.0, other distribution should
work too) made by Ondřej Suchý
<ondrej@kyberdigi.cz>
Installation
First, unpack the archive.
$ tar xzf nta-1.1.tar.gz
Now you should see a directory nta-1.1 so step into it.
$ cd nta-1.1
Note: if you are installing this software from the RPM
packages, just type rpm -i package_name.rpm. NTA will install
itself into the /usr/local/nta directory.
Well, that's it! ;-) At this moment, you are ready to do some simple
configuration. You don't need to copy this files anywhere,
the location of these files doesn't matter. But I strongly recommend
you not to copy any of here located files away.
You don't need to be the superuser. For installing and running this
software, it is absolutelly O.K. to be a non-privileged user.
Configuration
Before the first run, you should edit the config.pl file, which
is the only configuration file for this simple software. Use your favorite
text editor for this action.
First of all you have to define network devices, which should the software
look at. You can usually list your network devices via the ifconfig
command. You can name each of devices listed in output of this command.
Here is an example:
%netdevices=(
'eth0' => 'Main Internet connection',
'eth1' => 'Local subnet',
'lo' => 'Loopback device'
);
Usually your home computer has only one network device, so it is O.K. to have
such simple configuration of devices:
%netdevices=(
'eth0' => 'Main Internet connection'
);
The rest of the config.pl file is a big %config variable.
You don't need to see all of it, but please take a good care about line
output_dir, where you must specify an existing directory with write
access. You can edit the other lines too, they are well commented, so it
should be not a problem for anybody to change configuration of whatever he
wants.
Running
The main script nta.pl needs to be executed every 5 minutes to create
correct stats. Use cron daemon to do it, for example via the crontab -e
command. I strongly recommend you not to do it as root, use non-privileged
account for this action. Put this line to the crontab file:
*/5 * * * * (cd /full/path/to/nta-1.1/; ./nta.pl)
I also recommend you to check if everything works before crontab editing.
Just step into the nta directory and run the nta script:
$ cd /path/to/nta-1.1/
$ ./nta.pl
If you can't see any output, everything works fine. Other way you should get
an error message. Check the output it the output directory specified in
config.pl file.
Advantages
- Very low disk space usage
- Just Perl language and GD library needed, nothing else, no daemons etc.
- No root account needed
- Big (and commented) configuration file
- Simplicity in most everywhere
Demo
I can show you a demo stats of a computer acting as a masquerading
firewall machine. There are two network devices in it, as this pseudopicture
shows:
Internet
_
+------------------+ /|\
| Firewall machine | | .---[ station 192.168.0.2 ]
+------------------+ | |
| eth0 public_ip >------~ +---[ station 192.168.0.3 ]
| | |
| eth1 192.168.0.1 >----------------+---[ station 192.168.0.4 ]
+------------------+ |
~--[ station 192.168.0.5 ]
Full stats demo (I promiss I'll update it
if I will have more data to show ;-)))
Changelog
1.1 (May 10th, 2006)
- added output_prefix: user can define if he wants
fully detailed stats (count in bytes) or 'nice'
values (KB, MB, GB etc.)
1.0 (May 30th, 2003)
- initial version released
History
I was searching the Internet for a simple tool to know the network traffic,
but nothing was simple enough. The best stats were generated by
MRTG, but this software wanted SNMP
running, which was not my wish. So I tried to create a really simple script,
which can not do as many things as MRTG does, but in the most simpliest way
get as same traffic stats as possible.
Hnnn ... and so I did (I think) ;-))
Bugs
Linux kernel 2.0.x
Antoine Megans reported, that Linux kernel version 2.0.x does not provide
special file /proc/net/dev, where NTA reads tha data about transferred
bytes. If you want to have stats about transferred bytes from another file
or command, just let cron (or something like that) create a randomly named
file and put this name in the config.pl, keyword proc_netdev (line 102
of default config.pl).
There are no other known bugs at this moment. If you know about any, just
send me an e-mail.
|