How mgumz/mtr-exporter works
mtr-exporter is a scheduled network-probe exporter: CLI or jobs-file definitions become scheduled mtr executions, whose JSON reports are retained and served as Prometheus metrics. The graph includes job parsing and reload, scheduling/timeshifts, report decoding, metric exposition, and documented HTTP endpoints. Source excerpts establish the core calls; the README supplies the endpoint and Prometheus-consumer relationships. Other details of unsampled handlers and file watching are not inferred.
Main entry points: main.go Exporter runtime · job.go Probe job · jobs.go Job collection · parse.go Job parser
Components 20
CLI and HTTP
- Exporter runtime
cmd/mtr-exporter/main.go - HTTP endpoints
cmd/mtr-exporter/main.go - Health page
cmd/mtr-exporter/page_health.go - Info page
cmd/mtr-exporter/page_index.go
Job management
- Jobs file
pkg/job/file.go - Job parser
pkg/job/parse.go - Jobs watcher
pkg/job/watch_file.go - Job collection
pkg/job/jobs.go - Probe job
pkg/job/job.go
Scheduling
- Cron scheduling
pkg/job/cron.go - Timeshift schedules
pkg/timeshift/timeshift.go - Random delay
pkg/timeshift/random_delay.go - Random deviation
pkg/timeshift/random_deviation.go
Probe and metrics
- mtr process
pkg/job/job.go - JSON report model
pkg/mtr/mtr.go - Metrics collector
pkg/job/collector.go - Prometheus exposition
pkg/job/prometheus.go - Hop metrics
pkg/mtr/prometheus.go
Other components
- Operator
- Prometheus scraper
Connections 25
- Operator → Exporter runtime: configures
README.md - Exporter runtime → Job collection: builds jobs
cmd/mtr-exporter/main.go - Exporter runtime → Jobs watcher: starts watcher
cmd/mtr-exporter/main.go - Exporter runtime → HTTP endpoints: registers routes
cmd/mtr-exporter/main.go - HTTP endpoints → Health page: serves
cmd/mtr-exporter/main.go - HTTP endpoints → Info page: serves
cmd/mtr-exporter/main.go - Jobs file → Job parser: parsed by
README.md - Jobs watcher → Jobs file: watches
README.md - Jobs watcher → Job parser: reloads via
- Job parser → Probe job: creates
pkg/job/parse.go - Exporter runtime → Job parser: parses file
cmd/mtr-exporter/main.go - Job collection → Metrics collector: registers jobs
pkg/job/jobs.go - Job collection → Timeshift schedules: builds schedule
pkg/job/jobs.go - Job collection → Cron scheduling: schedules jobs
pkg/job/jobs.go - Cron scheduling → Probe job: runs job
- Probe job → mtr process: executes
pkg/job/job.go - Probe job → JSON report model: decodes output
pkg/job/job.go - Probe job → Metrics collector: updates report
- Timeshift schedules → Random delay: constructs
- Timeshift schedules → Random deviation: constructs
pkg/timeshift/timeshift.go - HTTP endpoints → Metrics collector: serves metrics
cmd/mtr-exporter/main.go - Metrics collector → Prometheus exposition: formats metrics
pkg/job/prometheus.go - Prometheus exposition → JSON report model: reads report
pkg/job/prometheus.go - Prometheus exposition → Hop metrics: writes hop metrics
pkg/job/prometheus.go - Prometheus scraper → HTTP endpoints: scrapes /metrics
README.md