How sflow-rt/prometheus works
Project Type and Purpose
• This is an open‐source exporter application (plugin) for the sFlow-RT real-time analytics engine.
• Purpose: collect flow metrics via sFlow, transform them to Prometheus format, and expose them for Prometheus to scrape.
File Structure
• Top-level files:
• LICENSE – licensing information
• README.md – project overview and installation instructions
• api.yml – API definition (exposed endpoints, metric descriptions)
• scripts/
• export.js – main exporter script that plugs into sFlow-RT
• No separate frontend/backend folders—this is a standalone plugin module loaded by sFlow-RT.
README for Insights
• Describes installation: uses sflow-rt/get-app.sh to deploy the exporter
• References a blog post on flow metrics with Prometheus and Grafana → implies integration points with Prometheus and Grafana
a. Main Components
• Network Devices (routers, switches) sending sFlow data
• sFlow-RT Engine – core analytics server
• Prometheus Exporter (export.js + api.yml) loaded into sFlow-RT
• Prometheus Server – scrapes metrics
• (Optionally) Grafana – visualizes metrics
b. Relationships & Interactions
1. Network Devices → sFlow-RT Engine (streams sFlow datagrams)
2. sFlow-RT Engine processes flows and passes metrics to the Exporter script
3. Exporter script formats metrics per api.yml and exposes an HTTP endpoint
4. Prometheus Server periodically scrapes the Exporter’s HTTP endpoint
5. (Optional) Grafana pulls metrics from Prometheus for dashboards
c. Architectural Patterns & Principles
• Plugin architecture: export.js is a dynamic app loaded into sFlow-RT
• Producer-consumer flow: sFlow data producers → RT processor → metrics consumer (Prometheus)
• Configuration-driven: api.yml defines exposed metrics, enabling easy extension
d. Key Technologies & Libraries
• JavaScript plugin engine (within sFlow-RT)
• sFlow-RT REST API for defining metrics and endpoints
• Prometheus exposition format (text-based HTTP interface)
• Shell script (get-app.sh) for deployment
Detailed Component Breakdown (optional blocks with
• sFlow-RT Engine:
– Flow collector module
– JavaScript app loader
• Exporter App:
– Metric definitions (api.yml)
– HTTP exposition interface
• Prometheus:
– Scrape configuration
– Time series storage
• Grafana:
– Data source configuration
– Dashboards