genx
genx is a CLI tool for generating time-series data as JSON. Built for testing dashboards, messaging pipelines, and IoT simulators.
docker run ghcr.io/lucj/genx --type cos --min 18 --max 26 --duration 1h --step 15m{"device":"device","timestamp":1715000000,"value":26.00}
{"device":"device","timestamp":1715054400,"value":22.00}Curve types
| Type | Description |
|---|---|
walk | Random walk with optional drift and clamping (default) |
cos | Sinusoidal oscillation between --min and --max |
linear | Steady ramp from start to end value |
sawtooth | Ramp-then-reset pattern |
square | Binary high/low switching |
log | Logarithmic growth |
exp | Exponential growth |
geo | GPS track simulation (latitude/longitude random walk) |
Output sinks
| Sink | Notes |
|---|---|
stdout | Default |
webhook | HTTP POST with optional bearer token |
nats | NATS pub/sub, per-device subject templates |
mqtt | MQTT with TLS/mTLS support |
kafka | Kafka topics with SASL/PLAIN auth |
file | Rotating file output (size or age-based) |
influxdb | InfluxDB v2 write API |
otlp | OpenTelemetry metrics (gRPC or HTTP) |
prometheus | Pull-based metrics endpoint |
http-server | Local HTTP poll endpoint |
Output formats
json (default), csv, cloudevents (CloudEvents 1.0 envelope), and InfluxDB line protocol.
Key features
Fleet mode: simulate multiple devices at once with --devices. Add --spread for per-device value offsets so devices don’t emit identical values.
Noise and anomalies: inject random jitter (--noise), spikes/drops (--anomaly-rate), or skipped points (--dropout-rate) to test alerting and anomaly-detection pipelines.
Realtime vs batch: realtime mode (default) paces output to the wall clock. Batch mode generates the full dataset instantly.
Count mode: emit exactly N points with --count instead of a duration.
Replay mode: reprocess previously recorded JSON-lines files through any sink.
Historical anchoring: use --from with an ISO 8601 date or Unix timestamp to align generated data to real calendar dates.
Multi-field payloads: define multiple named fields in a YAML config, each following its own curve:
fields:
temperature: { type: cos, min: 18, max: 26 }
humidity: { type: cos, min: 40, max: 80 }
pressure: { type: linear, first: 1010, last: 1015 }Scenario mode: chain phases sequentially with per-phase overrides. Timestamps and geo position stay continuous across phases.
Custom payload templates: use Go template syntax to control output shape: {{.Device}}, {{.Timestamp}}, {{.Value}}, {{.Fields.name}}, etc.
YAML config: any flag can be set in a YAML file. Generate a commented template with --generate-config. CLI flags always take precedence.
Validation: dry-run with genx validate --config config.yaml to check point counts and phase breakdown without connecting to any sink.
Source
Available on GitHub with binaries on the releases page.