HUB
Sign inSign up

flintnet/agent

By flintnet

•Updated 6 months ago

Network monitoring agent

Image
0

2.0K

flintnet/agent repository overview

⁠Flintnet

Fast, sharp network intelligence for MSPs and SMBs.

Flintnet is a self-hosted network monitoring platform built for network administrators who need real-time visibility without sending their data to the cloud. It combines a high-performance C++ agent with a Flutter web UI, giving you live traffic flows, device inventory, ARP security detection, anomaly alerting, and network topology — all running on your own infrastructure.


⁠Architecture

Flintnet consists of two components: a C++ backend agent and a Flutter web frontend. They communicate via a REST API and a persistent SSE stream. All data remains on your infrastructure.

┌─────────────────────────────────────────────────────────────┐
│                        Flutter UI                           │
│          Dashboard · Devices · Security · Topology          │
└────────────────────────┬────────────────────────────────────┘
                         │  REST API + SSE
┌────────────────────────▼────────────────────────────────────┐
│                      C++ Agent                              │
│                                                             │
│  AF_PACKET capture → Flow tracker → Anomaly detector        │
│  SNMP poller → ARP walker → Security detector               │
│  LLDP/CDP poller → Topology registry                        │
│  Event bus → Alert store · Email alerter · SSE push         │
│  REST API (cpp-httplib) · InfluxDB metrics pipeline         │
└────────────────────────┬────────────────────────────────────┘
                         │
┌────────────────────────▼────────────────────────────────────┐
│                     InfluxDB 1.8                             │
│           Flows · SNMP metrics · Anomaly records            │
└─────────────────────────────────────────────────────────────┘

⁠Agent — src/

The agent is written in C++20 and runs as a multi-threaded process on a Linux host. It requires NET_RAW and NET_ADMIN capabilities for packet capture.

⁠Core subsystems

Packet capture (parser/)

Uses AF_PACKET sockets for zero-copy packet capture across one or more network interfaces. Packets are parsed into flow records keyed by source IP, destination IP, source port, destination port, and protocol. Flow statistics (byte count, packet count, EWMA baseline) are tracked per flow and written to InfluxDB.

Anomaly detection (parser/)

Each flow maintains an Exponentially Weighted Moving Average (EWMA) of its byte volume. When the current measurement deviates significantly above the baseline, an anomaly event is published to the event bus. The EWMA adapts over time as traffic patterns evolve.

Device discovery (discovery/)

CIDR-based discovery scans the configured subnet at startup and on a periodic schedule. Discovered devices are stored in the device registry and persisted to /var/lib/flintnet/devices.json.

SNMP polling (snmp/)

SNMPv2c polling retrieves sysDescr, sysObjectID, interface byte counters (ifInOctets, ifOutOctets), and optionally CPU/memory and routing protocol state from SNMP-reachable devices. Per-interface utilisation percentages are calculated and published via SSE. SNMP traps are received on a dedicated listener thread.

ARP walking and security detection (arp/)

The ARP table is walked periodically via ipNetToMedia MIB. Each entry is tracked in the ARP registry with MAC address, manufacturer (resolved from OUI), first seen, last seen, and IP history. The following security events are detected and published to the event bus:

  • rogue_device — a MAC address not previously seen on the network
  • arp_spoof_detected — a single MAC claiming multiple IP addresses
  • arp_spoof_detected — a single IP address claiming multiple MAC addresses
  • duplicate_ips — two devices claiming the same IP address

Network topology (snmp/)

LLDP and CDP neighbour data is polled from managed switches and routers. Neighbour system names are resolved to IP addresses by cross-referencing the device registry. The topology is exposed via the REST API for rendering in the Flutter UI.

Event bus (api/)

A publish/subscribe event bus connects all agent subsystems. Producers (ARP walker, anomaly detector, capture pipeline) publish JSON events. Consumers (alert store, email alerter, SSE push, SSE stream) subscribe via a Subscription object backed by a condition variable queue. Subscriptions are lifetime-coupled — the bus automatically prunes disconnected subscribers.

Alert store (notifier/)

A per-device ring buffer (20 entries, keyed by MAC address) stores recent security events. The alert store subscribes to the event bus and is consumed by the /devices/:ip REST endpoint to populate the device detail screen's security alert log.

Email alerting (notifier/)

SMTP email notifications are dispatched via libcurl for all security and anomaly events. A per-device per-event-type 5-minute cooldown prevents alert flooding. SMTP configuration is provided via environment variables.

REST API (api/)

A cpp-httplib HTTP server exposes the following endpoints:

EndpointDescription
GET /versionAgent version string
GET /statsPacket capture statistics
GET /flowsCurrent flow table
GET /anomaliesDetected traffic anomalies
GET /devicesDiscovered device inventory
GET /devices/:ipPer-device detail — ARP entries, IP history, alerts
GET /topologyNetwork topology node/edge data
GET /streamSSE endpoint for real-time event push

All endpoints support Bearer token authentication via FLINTNET_API_TOKEN.

InfluxDB pipeline (storage/)

Flow metrics, SNMP interface utilisation, and anomaly records are written to InfluxDB 1.8 for time-series storage. The pipeline uses a background thread and an MPSC ring buffer to decouple writes from the capture hot path.

⁠Thread model
Thread nameResponsibility
flintnet-capAF_PACKET packet capture (one per interface)
flintnet-pipeFlow processing and anomaly detection pipeline
flintnet-storInfluxDB write pipeline
flintnet-pollSNMP polling and ARP walking
flintnet-trapSNMP trap listener
flintnet-pushSSE event push to connected clients
flintnet-apiHTTP server worker threads (cpp-httplib thread pool)
topology-pollLLDP/CDP topology polling
flintnet-emailSMTP email alerter
flintnet-alrtAlert store event bus subscriber
⁠Key dependencies
LibraryPurpose
libpcap / AF_PACKETPacket capture
net-snmpSNMP polling and trap reception
cpp-httplibEmbedded HTTP server
RapidJSONJSON serialisation
libcurlSMTP email delivery and HTTP client
influxdb-cxxInfluxDB write client
plogStructured logging

⁠Flutter UI — ui/

The Flutter web UI communicates with the agent via REST and a persistent SSE connection. It runs in Chrome or Edge and is served by nginx in the Docker deployment.

⁠Screens

Login screen — connects to the agent at a configurable URL with an optional Bearer token. Credentials are saved to localStorage and restored on page load so the user is not required to log in again on refresh. A logout button in the nav sidebar clears the saved session.

Dashboard — real-time traffic statistics, active flow table, and detected anomalies. Updates live via the SSE connection.

Devices screen — a card grid of all discovered devices. Each card shows the device IP, SNMP reachability status, device type, sysDescr, and per-interface utilisation bars (colour-coded green/amber/red). Utilisation bars update in real time via SSE. Clicking a card navigates to the device detail screen.

Device detail screen — per-device drill-down showing device info, ARP entries with IP history, live interface utilisation, and recent security alerts.

Anomalies screen — list of flows where traffic has deviated significantly above the EWMA baseline.

Security screen — live feed of security events published to the SSE stream.

Topology screen — network graph rendered from LLDP/CDP neighbour data using the graphview package. Nodes are labelled with device IP addresses. Supports zoom and pan via InteractiveViewer. Nodes with active security or anomaly alerts are highlighted in red.

⁠Services
ServiceResponsibility
ApiServiceREST API client — all HTTP calls to the agent
SseServicePersistent SSE connection with automatic reconnection
ConfigServiceSingleton holding base URL, token, and localStorage I/O
TopologyServiceFetches and parses topology edge data
⁠Key dependencies
PackagePurpose
httpHTTP client for REST API calls
graphviewNetwork topology graph rendering
fl_chartCharts and data visualisation

⁠Deployment

Flintnet is deployed via Docker Compose. Three services run on the host network:

ServiceDescriptionPort
flintnet-agentC++ monitoring agent3000
flintnet-uiFlutter web UI served by nginx80
influxdbInfluxDB 1.8 time-series database8086

network_mode: host is required for the agent to access raw network sockets. The agent container runs with NET_RAW, NET_ADMIN, and NET_BIND_SERVICE capabilities.

⁠Quick start
curl -fsSL https://flintnet.io/install.sh | bash
cd ~/flintnet
nano .env                        # set FLINTNET_CIDR at minimum
docker compose up -d --build

Open http://<your-host-ip> in Chrome or Edge.


⁠Configuration

All configuration is via environment variables in .env. See .env.example for the full reference.

VariableRequiredDescription
FLINTNET_CIDRYesSubnet to monitor, e.g. 192.168.1.0/24
FLINTNET_SNMP_COMMUNITYYesSNMPv2c community string
FLINTNET_API_TOKENNoBearer token for REST API authentication
FLINTNET_LOG_LEVELNoLog verbosity — debug, info, warning
FLINTNET_SMTP_HOSTNoSMTP server for email alerting
FLINTNET_ALERT_EMAILNoRecipient address for alert emails
INFLUXDB_DBNoInfluxDB database name (default: flintnet)

⁠License

See LICENSE⁠ for terms. Flintnet is a commercial self-hosted product — see Terms & Conditions⁠ for full usage terms.

Tag summary
Recent tags
Content type
Image
Digest
sha256:c71a323fb…
Size
9.8 MB
Last updated
6 months ago
docker pull flintnet/agent:latest