Skip to content

seahow-uk/nodeprobe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

NodeProbe - Distributed Peer-to-Peer Network Monitor

NodeProbe is a distributed peer-to-peer system designed for network monitoring and topology discovery. Each node in the network operates independently while collaborating to maintain a comprehensive view of the entire network topology.

πŸ—οΈ Architecture

Core Components

  • HTTPS Web Server (Port 443): Provides secure API endpoints and web dashboard
  • Polling Service: Periodically queries other nodes to measure connectivity and response times
  • Reporting Service: Sends network snapshots to designated reporting servers
  • SQLite Database: Stores node information and polling results locally
  • TLS Certificate Management: Automatically generates self-signed certificates for HTTPS

Key Features

  • Autonomous Operation: Each node operates independently without central coordination
  • Dynamic Discovery: Nodes discover each other through seed configurations and peer sharing
  • Network Resilience: System continues operating even when nodes join or leave
  • Path MTU Discovery: Automatically determines optimal packet sizes between nodes
  • Real-time Monitoring: Continuous polling with configurable intervals
  • Web Dashboard: Beautiful HTML interface for network visualization
  • Secure Communication: All inter-node communication uses HTTPS with self-signed certificates

πŸš€ Quick Start

Using Docker Compose (Recommended)

  1. Clone and build the system:

    git clone https://github.com/seahow-uk/nodeprobe.git
    cd nodeprobe
    docker-compose up --build
  2. Access the dashboards:

  3. Monitor the logs:

    docker-compose logs -f

Manual Docker Build

# Build the image
docker build -t nodeprobe .

# Run a single node
docker run -d \
  --name nodeprobe-node \
  -p 8443:443 \
  -v nodeprobe_data:/app/data \
  -v nodeprobe_certs:/app/certs \
  nodeprobe

Local Development

# Install dependencies
go mod download

# Run locally (requires Go 1.21+)
go run ./cmd/nodeprobe

πŸ“ Project Structure

nodeprobe/
β”œβ”€β”€ cmd/
β”‚   └── nodeprobe/           # Main application entry point
β”‚       └── main.go
β”œβ”€β”€ internal/
β”‚   β”œβ”€β”€ app/                 # Application services
β”‚   β”‚   β”œβ”€β”€ node_service.go
β”‚   β”‚   β”œβ”€β”€ polling_service.go
β”‚   β”‚   β”œβ”€β”€ reporting_service.go
β”‚   β”‚   └── web_server.go
β”‚   β”œβ”€β”€ domain/              # Core business logic
β”‚   β”‚   β”œβ”€β”€ models.go
β”‚   β”‚   └── interfaces.go
β”‚   └── pkg/                 # Infrastructure packages
β”‚       β”œβ”€β”€ config/          # Configuration management
β”‚       β”œβ”€β”€ http/            # HTTP client
β”‚       β”œβ”€β”€ sqlite/          # Database repository
β”‚       └── tls/             # TLS certificate management
β”œβ”€β”€ configs/                 # Node configurations
β”‚   β”œβ”€β”€ node1/
β”‚   β”œβ”€β”€ node2/
β”‚   β”œβ”€β”€ node3/
β”‚   └── node4/
β”œβ”€β”€ web/                     # Static web assets
β”œβ”€β”€ scripts/                 # Utility scripts
β”œβ”€β”€ Dockerfile
β”œβ”€β”€ docker-compose.yml
β”œβ”€β”€ go.mod
β”œβ”€β”€ go.sum
└── README.md

πŸ”§ Configuration

Seed Configuration (seed.json)

{
  "nodes": [
    {
      "fqdn": "node1.example.com",
      "ip": "192.168.1.100"
    },
    {
      "fqdn": "node2.example.com",
      "ip": "192.168.1.101"
    }
  ]
}

Reporting Server Configuration (reportingserver.json)

{
  "server_fqdn": "reporting.example.com",
  "server_ip": "192.168.1.10"
}

Environment Variables

NODE_ENV=production
DATA_DIR=/app/data
CERT_DIR=/app/certs

🌐 API Endpoints

Node Information

  • GET /nodeinfo - Returns node details and known peers
  • GET /health - Health check endpoint

Network Reporting

  • POST /report - Accepts network snapshots from other nodes

Web Interface

  • GET /dashboard - HTML dashboard for network visualization
  • GET / - Redirects to dashboard

πŸ“Š Monitoring and Observability

Dashboard Features

  • Network Topology: Visual representation of all discovered nodes
  • Real-time Statistics: Success rates, response times, node counts
  • Historical Data: 24-hour polling history and trends
  • Node Status: Active/inactive status with last seen timestamps
  • Path MTU Information: Network path characteristics

Health Checks

Each node provides health endpoints for monitoring:

curl -k https://localhost:8443/health

Response:

{
  "status": "healthy",
  "timestamp": "2024-01-15T10:30:00Z",
  "node_id": "uuid-here",
  "node_fqdn": "nodeprobe-1",
  "node_ip": "192.168.65.10",
  "known_nodes": 3
}

πŸ”’ Security

TLS/HTTPS

  • All communication uses HTTPS with automatically generated self-signed certificates
  • Certificates include all local network interfaces and hostnames
  • Automatic certificate renewal when approaching expiration

Network Security

  • Self-signed certificates are accepted for peer-to-peer communication
  • No external dependencies or internet access required
  • Configurable timeouts and rate limiting

Container Security

  • Runs as non-root user inside containers
  • Minimal attack surface with Alpine Linux base
  • Read-only configuration mounts

πŸ”„ Network Behavior

Discovery Process

  1. Bootstrap: Nodes start with seed configuration
  2. Peer Discovery: Each node shares its known peers with others
  3. Continuous Polling: Regular health checks maintain network view
  4. Dynamic Updates: New nodes are automatically discovered and integrated

Polling Strategy

  • Round-robin: Nodes are polled in rotation
  • Configurable Interval: Default 30-second polling interval
  • Timeout Handling: Failed polls mark nodes as inactive
  • Path MTU Discovery: Performed on first contact with each node

Data Management

  • Local Storage: Each node maintains its own SQLite database
  • Size Limits: Automatic cleanup when database exceeds 10MB
  • Retention: Configurable data retention policies

πŸ› οΈ Development

Building from Source

# Clone repository
git clone <repository-url>
cd nodeprobe

# Install dependencies
go mod download

# Build binary
go build -o nodeprobe ./cmd/nodeprobe

# Run tests
go test ./...

Adding New Features

  1. Domain Layer: Add new models and interfaces in internal/domain/
  2. Application Layer: Implement business logic in internal/app/
  3. Infrastructure: Add supporting code in internal/pkg/
  4. Testing: Include comprehensive tests for all new functionality

Code Organization

The project follows Clean Architecture principles:

  • Domain: Core business logic and interfaces
  • Application: Use cases and application services
  • Infrastructure: External concerns (database, HTTP, etc.)

πŸ› Troubleshooting

Common Issues

Nodes not discovering each other:

  • Check seed.json configuration
  • Verify network connectivity between containers
  • Ensure HTTPS certificates are generated correctly

High memory usage:

  • Check database size and cleanup frequency
  • Monitor polling interval and number of nodes
  • Review log retention settings

Certificate errors:

  • Verify certificate generation in logs
  • Check file permissions in cert directory
  • Ensure proper hostname resolution

Debugging

View logs

docker-compose logs -f nodeprobe-1

Access container

docker exec -it nodeprobe-1 sh

Check database

sqlite3 /app/data/nodeprobe.db ".tables"

Testing Health Checks

Each node exposes a health endpoint at https://node-fqdn:port/health

Test using: curl -k https://localhost:8443/health (for node 1)

The Docker Compose file already includes health checks that run every 30 seconds

Testing Node Information

Check node details at https://node-fqdn:port/nodeinfo

Example: curl -k https://localhost:8443/nodeinfo

Testing Dashboard Access

Access the web dashboard at https://node-fqdn:port/dashboard

Example: https://localhost:8443/dashboard

Testing Monitoring Points

Watch the logs:

docker logs nodeprobe-1 (and other nodes)

Check data persistence in the mounted volumes

Monitor the SQLite database in

/app/data/nodeprobe.db

Testing System Load

Test the system under load using tools like Apache Bench or JMeter

Focus on the main endpoints: /health, /nodeinfo, /dashboard

Testing Security Features

Verify TLS certificates in /app/certs

πŸ“ˆ Performance Considerations

Scalability

  • Node Limit: Tested with up to 100 nodes
  • Polling Overhead: O(n) where n is number of nodes
  • Database Size: Automatic cleanup maintains performance
  • Memory Usage: ~50MB per node under normal load

Optimization

  • Polling Interval: Adjust based on network size and requirements
  • Database Cleanup: Configure retention based on storage constraints
  • Network Timeouts: Tune for network latency characteristics

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors