A high-performance network statistics collector for router servers, built using eBPF and gRPC.
- Real-time IPv4 and IPv6 connection statistics collection
- Kernel-level tracking using eBPF
- Efficient gRPC communication with TLS support
- JSON configuration file support
- Hot-reloadable configuration
- Comprehensive connection tracking
- Memory-efficient implementation
- Systemd service integration
- Linux kernel 5.8 or newer (for eBPF features)
- CMake 3.10 or newer
- GCC or Clang
- libbpf
- OpenSSL
- gRPC
- Protocol Buffers
- JSON-C
- Clone the repository:
git clone https://github.com/yourusername/network-stats-collector.git
cd network-stats-collector
- Run the build script:
chmod +x build.sh
./build.sh
The collector is configured using a JSON file. A sample configuration is provided in config.json
.
push_interval_ms
: Interval between data pushes (milliseconds)log_level
: Logging level (DEBUG, INFO, WARN, ERROR)log_file
: Path to log fileendpoints
: Array of gRPC endpoints to push data touse_tls
: Enable/disable TLSca_cert
: Path to CA certificateclient_cert
: Path to client certificateclient_key
: Path to client private keybatch_size
: Maximum number of connections to batch before pushingmax_connections
: Maximum number of connections to track
- Install the service:
sudo systemctl enable collector
- Start the service:
sudo systemctl start collector
- Check the status:
sudo systemctl status collector
- View logs:
sudo journalctl -u collector -f
- The collector uses mutual TLS authentication
- Runs with minimal privileges
- Secure communication channels
- Memory-safe implementation
The collector is optimized for performance:
- Uses eBPF for kernel-level tracking
- Implements zero-copy techniques
- Uses batched processing
- Minimizes memory allocations
- Uses lock-free data structures
See the LICENSE file for details.