tpt-netmon

Rust

A modern, strongly-typed network management protocol and MIB compiler — replaces legacy SNMP/ASN.1 with type-safe Rust clients and Prometheus/OTLP exporters.

0 stars0 forks0 watchers

Languages

Rust98.7%PowerShell0.5%Shell0.5%Dockerfile0.2%
README

tpt-netmon

Modern, strongly-typed network management for SNMP and telemetry MIBs.

tpt-netmon is a schema-first network management protocol and MIB compiler. SNMP has powered the world's routers and switches for 30 years, but it relies on archaic ASN.1 SMI text MIBs and opaque numeric OIDs (e.g. 1.3.6.1.2.1.1.5). tpt-netmon replaces this with a modern schema language that compiles device state trees into type-safe Rust clients and Prometheus exporters.

Dual-licensed under MIT or Apache-2.0.

Vision

.ttpt-net Schema ──▶ tpt-netmon-compiler ──▶ Rust Client / Prometheus Exporter
Legacy SNMP Device ─▶ tpt-netmon-snmp-proxy ─▶ Typed Telemetry Stream
  • Schema-First Networking: Define device capabilities in a .tpt-net schema instead of legacy ASN.1 SMI MIBs.
  • Type-Safe Queries: router.interfaces.eth0.errors instead of string OID lookups.
  • Protocol Agnostic: SNMPv2c/v3 for legacy gear, modern gRPC/HTTP2 for native tpt-netmon agents.
  • Observability Native: Auto-generate OpenTelemetry metrics and Prometheus endpoints from the schema.

Workspace layout

CratePhaseResponsibility
tpt-netmon-schema1.tpt-net schema language: lexer, parser, AST, validation
tpt-netmon-compiler2Code generation: schema AST → typed Rust
tpt-netmon-snmp-core3Pure-Rust SNMPv2c wire protocol (BER/ASN.1, USM, VACM)
tpt-netmon-exporter8Prometheus / OTLP exposition bridge derived from schemas
tpt-netmon-snmp-proxy5Legacy device bridge: map SNMP walks into typed trees
tpt-netmon-cli9The tpt-netmon command-line tool

Quick start

# Build the workspace
cargo build --workspace

# Compile a schema into a typed Rust client
cargo run -p tpt-netmon-cli -- compile mibs/

# Walk a legacy SNMP device
cargo run -p tpt-netmon-cli -- walk 192.168.1.1

# Walk a device and map raw OIDs into typed, schema-defined JSON
cargo run -p tpt-netmon-cli -- walk 192.168.1.1 --schema mibs/interfaces.tpt-net

# Export typed state as Prometheus metrics
cargo run -p tpt-netmon-cli -- export --prometheus --schema mibs/interfaces.tpt-net

Example schema (mibs/interfaces.tpt-net)

module interfaces {
  table ifTable {
    index: ifIndex (integer);
    column ifDescr (string);
    column ifSpeed (gauge32);
    column ifInOctets (counter64);
    column ifOutErrors (counter64);
  }
}

Acceptance criteria

  1. Import and translate ≥95% of standard IETF MIBs (RFC1213, IF-MIB).
  2. Zero-copy parsing of SNMP GET/SET/BULK PDUs.
  3. Generated Prometheus exporters pass promtool check metrics.

Status

This repository is under active development. See todo.md for the phased roadmap.