Skip to content

aybarsm/net-stats-collector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Network Statistics Collector

A high-performance network statistics collector for router servers, built using eBPF and gRPC.

Features

  • 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

Requirements

  • Linux kernel 5.8 or newer (for eBPF features)
  • CMake 3.10 or newer
  • GCC or Clang
  • libbpf
  • OpenSSL
  • gRPC
  • Protocol Buffers
  • JSON-C

Building

  1. Clone the repository:
git clone https://github.com/yourusername/network-stats-collector.git
cd network-stats-collector
  1. Run the build script:
chmod +x build.sh
./build.sh

Configuration

The collector is configured using a JSON file. A sample configuration is provided in config.json.

Configuration Options

  • push_interval_ms: Interval between data pushes (milliseconds)
  • log_level: Logging level (DEBUG, INFO, WARN, ERROR)
  • log_file: Path to log file
  • endpoints: Array of gRPC endpoints to push data to
  • use_tls: Enable/disable TLS
  • ca_cert: Path to CA certificate
  • client_cert: Path to client certificate
  • client_key: Path to client private key
  • batch_size: Maximum number of connections to batch before pushing
  • max_connections: Maximum number of connections to track

Usage

  1. Install the service:
sudo systemctl enable collector
  1. Start the service:
sudo systemctl start collector
  1. Check the status:
sudo systemctl status collector
  1. View logs:
sudo journalctl -u collector -f

Security

  • The collector uses mutual TLS authentication
  • Runs with minimal privileges
  • Secure communication channels
  • Memory-safe implementation

Performance

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

License

See the LICENSE file for details.

About

A high-performance network statistics collector for router servers, built using eBPF and gRPC.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published