Design a System to Capture and Surface the State of Networking Devices
Problem Statement
Design a scalable and reliable system that can collect, store, and surface the current and historical state of networking devices (e.g., routers, switches, firewalls, load balancers, etc.) across a large distributed infrastructure.
The system should periodically capture configuration, performance metrics, and health data from devices, detect changes or anomalies, and make this information available to network engineers and monitoring tools via APIs, dashboards, and alerting mechanisms.
🎯 Core Requirements
1. Data Collection
2. Data Storage & Processing
3. Visualization & APIs
4. Scalability & Reliability
5. Non-Functional Requirements
⚙️ Core Functional Components
ComponentDescription
Device Discovery Service
Periodically scans the network to detect and register devices.
Telemetry Collector
Polls or subscribes to device metrics via SNMP, gNMI, or APIs.
Ingestion Pipeline
Streams incoming data to processing and storage layers.
State Processor
Compares new state vs previous snapshot to detect changes.
Storage Layer
Persists both real-time and historical device state data.
Alerting Engine
Generates alerts for threshold breaches or offline devices.
API Gateway / Dashboard
Exposes data to end-users, UIs, and external systems.
Config Change Tracker
Tracks configuration diffs and versioning for each device.
🧱 High-Level Data Model
Device
1
2Device {
3 device_id: UUID
4 hostname: string
5 ip_address: string
6 location: string
7 vendor: string
8 type: string
9 status: enum { UP, DOWN, DEGRADED }
10 last_seen: timestamp
11}DeviceState
1
2DeviceState {
3 device_id: UUID
4 timestamp: datetime
5 cpu_usage: float
6 memory_usage: float
7 interface_status: map<string, string>
8 errors: int
9 config_version: string
10}ConfigVersion
1
2ConfigVersion {
3 device_id: UUID
4 version_id: UUID
5 config_snapshot: text
6 captured_at: datetime
7 diff_with_previous: text
8}Alert
1
2Alert {
3 alert_id: UUID
4 device_id: UUID
5 alert_type: enum { DOWN, HIGH_CPU, CONFIG_CHANGE }
6 severity: enum { LOW, MEDIUM, HIGH, CRITICAL }
7 message: string
8 timestamp: datetime
9 resolved: boolean
10}🧩 High-Level Architecture
1
2 +----------------------+
3 | API Gateway |
4 +----------+------------+
5 |
6 +-----------------------------------+
7 | Control Plane |
8 +-----------------------------------+
9 | Device Discovery | Config Tracker|
10 +-----------------------------------+
11 |
12 +-----------------------------------+
13 | Data Plane (Ingestion) |
14 +-----------------------------------+
15 | Telemetry Collector | SNMP Poller |
16 | Streaming Ingestor | gNMI Agent |
17 +-----------------------------------+
18 |
19 +------------------------------+
20 | Message Queue (Kafka) |
21 +------------------------------+
22 |
23 +-----------------------------------+
24 | Processing Layer |
25 +-----------------------------------+
26 | State Processor | Alert Engine |
27 | Change Detector | Dedup Service |
28 +-----------------------------------+
29 |
30 +-----------------------------------------------+
31 | Storage Layer |
32 +-----------------------------------------------+
33 | Time-Series DB (InfluxDB/Prometheus TSDB) |
34 | Metadata DB (PostgreSQL/Cassandra) |
35 | Config Store (S3 / Blob) |
36 +-----------------------------------------------+
37 |
38 +-----------------------------------+
39 | Visualization Layer |
40 +-----------------------------------+
41 | Dashboard / APIs / Grafana |
42 +-----------------------------------+🧠 Key Design Considerations
1. Data Ingestion
2. State Computation
3. Storage Design
Use:
4. Alerting
5. Scaling Strategy
6. Reliability
📈 Example Flow
1. Device Polling
1
2Telemetry Collector → polls router → receives metrics (CPU=85%, mem=70%)2. Ingestion
1
2Collector → pushes metrics to Kafka topic: device_telemetry3. Processing
1
2State Processor → compares with previous state → detects CPU threshold breach
3→ publishes event DEVICE_ALERT to Kafka4. Alert
1
2Alert Engine → consumes DEVICE_ALERT → creates alert → sends notification5. Visualization
1
2User queries dashboard → sees device state, config diff, alert history🧱 Storage Choices
Data TypeSuggested StorageReason
Device metadata
PostgreSQL / MySQL
Strong consistency
Telemetry metrics
Time-series DB (Prometheus, InfluxDB)
Optimized for time queries
Config snapshots
S3 / Blob storage
Large, infrequent objects
Alerts
Cassandra / DynamoDB
Fast writes, high availability
Caching
Redis
Reduce DB load
Queue
Kafka / Kinesis
Decoupled event pipeline
⚙️ Key APIs
APIDescription
GET /devices
List all devices with current status
GET /devices/{id}/state
Fetch latest state snapshot
GET /devices/{id}/history
Fetch time-series data for metrics
GET /devices/{id}/config/{version}
Retrieve specific config version
GET /alerts
List active or historical alerts
POST /alerts/acknowledge
Acknowledge and resolve alerts
🚀 Scalability Enhancements
✅ Goal:
Design a real-time, scalable, and resilient network state tracking system that captures device telemetry and configuration, stores historical data, detects anomalies, and surfaces insights to network operators through APIs and dashboards.