Network Traffic Monitoring Tool
Throughputd is a network traffic monitoring utility. It listens for IPv4 and IPv6 traffic and maintains records of how much data (in bytes) is going to and from each IP. This data is accumulated and saved to a sqlite database at a set interval.
throughputd [options...] [<interfaces>]
Valid options are:
-t integer Interval between writes in seconds (default: 5)
-f path Path to sqlite database (default: throughputd.db)
-p path Path to PID file (default: none)
-a table Name of database table (default: network_traffic)
-d Daemonize after starting (only if debugging disabled)
## Schema
The current schema for the output sqlite database is as follows:
```sql
CREATE TABLE IF NOT EXISTS network_traffic (
id INTEGER PRIMARY KEY AUTOINCREMENT,
ip TEXT NOT NULL,
timestamp INTEGER NOT NULL,
send_total INTEGER NOT NULL,
recv_total INTEGER NOT NULL
);
Note: the table name can be altered with the -a option
The current dependencies of throuputd are gcc, libpcap, libpthread, and libsqlite3. After these libraries are installed on the system you can simply run make
to build the binary. There is also a make install
target to install the binary onto the system.
Sample distribution packaging scripts for RPM based distributions (Fedora, CentOS/Red Hat Enterprise Linux, Mageia, and openSUSE) and Debian based distributions (Debian and Ubuntu) are provided. These can be used to generate native packages for supported Linux distributions.
-
Install
rpm-build
and the dependencies.-
Fedora/CentOS/RHEL install commands:
-
Fedora 22 and newer:
sudo dnf install rpm-build sqlite-devel libpcap-devel @development-tools
-
CentOS/RHEL + Fedora 21 and older:
sudo yum install rpm-build sqlite-devel libpcap-devel @development-tools
-
-
Mageia install commands:
-
Mageia 5:
sudo urpmi rpm-build sqlite3-devel pcap-devel gcc
-
Mageia 6:
sudo dnf install rpm-build sqlite3-devel pcap-devel gcc
-
-
openSUSE Tumbleweed install commands:
sudo zypper install rpm-build sqlite-devel libpcap-devel gcc
-
-
Download the tarball from GitHub.
-
Construct your build root by running
mkdir -p ~/rpmbuild/{SOURCES,SPECS,SRPMS,RPMS,BUILD,BUILDROOT}
-
Place the downloaded tarball into
~/rpmbuild/SOURCES
. -
Extract the spec file (
throughputd.spec
) to~/rpmbuild/SPECS
. -
Change into
~/rpmbuild/SPECS
and runrpmbuild -bb throughputd.spec
to generate the RPM. -
Retrieve the built throughputd RPM from
~/rpmbuild/RPMS/<arch>
(where<arch>
is your computer's architecture)
-
Install
build-essential
and the dependencies by runningsudo apt-get install build-essential libsqlite3-dev libpcap0.8-dev
-
Download the tarball from GitHub.
-
Extract the tarball and change into the directory (typically
throughputd-master
) and rundpkg-buildpackage -b -us -uc
-
Retrieve the built throughputd Debian package
After building your package, you can install it by doing the following:
Fedora 22+/Mageia 6+: sudo dnf install </path/to/built/rpm>
Fedora 21 and older/CentOS/RHEL: sudo yum install </path/to/built/rpm>
Mageia 5: sudo urpmi </path/to/built/rpm>
openSUSE Tumbleweed: sudo zypper install </path/to/built/rpm>
Run the following commands:
-
sudo dpkg -i </path/to/built/deb>
-
If it complains about missing dependencies, then run
sudo apt-get install -f