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

TypeDescription
walkRandom walk with optional drift and clamping (default)
cosSinusoidal oscillation between --min and --max
linearSteady ramp from start to end value
sawtoothRamp-then-reset pattern
squareBinary high/low switching
logLogarithmic growth
expExponential growth
geoGPS track simulation (latitude/longitude random walk)

Output sinks

SinkNotes
stdoutDefault
webhookHTTP POST with optional bearer token
natsNATS pub/sub, per-device subject templates
mqttMQTT with TLS/mTLS support
kafkaKafka topics with SASL/PLAIN auth
fileRotating file output (size or age-based)
influxdbInfluxDB v2 write API
otlpOpenTelemetry metrics (gRPC or HTTP)
prometheusPull-based metrics endpoint
http-serverLocal 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.