NATS / JetStream Integration
Monitor NATS and JetStream with stream metrics, consumer lag, message delivery rates, and server health — via the built-in monitoring HTTP API and Prometheus exporter.
How It Works
Enable Monitoring in Config
Add a http_port (or https_port) to your nats-server.conf to enable the built-in HTTP monitoring endpoint. This exposes /varz, /connz, /routez, /jsz, and /healthz endpoints for NATS and JetStream metrics.
Deploy the Prometheus Exporter
Run the nats-surveyor or prometheus-nats-exporter alongside your NATS server. It polls the NATS monitoring HTTP API and translates the JSON responses into Prometheus-format metrics.
Configure TigerOps Scrape
Add a scrape job to the TigerOps Collector pointing at the NATS exporter port. For JetStream clusters, deploy the exporter to each server and configure scrape targets for all server URLs.
Streams, Consumers & Health Flow
Within minutes TigerOps dashboards show JetStream stream message counts, consumer sequence lag, message delivery rates, server memory usage, and connection counts per NATS cluster.
What You Get Out of the Box
JetStream Stream Metrics
Stream message count, byte count, consumer count, subject count, and last sequence number. Stream limits (max_msgs, max_bytes, max_age) vs current usage help detect streams approaching their capacity.
Consumer Lag Monitoring
Num pending (unacked) messages, num acked floor, consumer sequence vs stream sequence lag, and redelivery counts per JetStream consumer. High consumer lag triggers alerts before message expiry.
Message Delivery Rates
Messages published per second, messages delivered per second, and messages acknowledged per second across all streams and subjects. Delivery rate drops indicate consumer processing failures.
Server Connection Health
Active connections, slow consumers, max pending per connection, and subscription count. Slow consumer disconnect events are forwarded to TigerOps as events with the client IP and subscription details.
Cluster & Route Metrics
Route connection count, cluster leader state, election counts, and Raft log commit lag for NATS JetStream clusters. Leadership changes and election timeouts are surfaced as timeline events.
Resource Utilization
Server CPU usage, memory usage, go routine count, and file descriptor count from the /varz endpoint. Memory growth trends in long-running NATS servers are detected and alerted before OOM occurs.
Enable Monitoring
Two config lines to enable the monitoring endpoint and start collecting NATS metrics.
# nats-server.conf — enable HTTP monitoring
port: 4222
http_port: 8222 # Monitoring HTTP endpoint
jetstream: enabled # Enable JetStream
jetstream {
store_dir: /data/jetstream
max_memory_store: 4GB
max_file_store: 100GB
}
# Verify monitoring is working
curl -s http://localhost:8222/varz | jq '.connections, .subscriptions'
curl -s http://localhost:8222/jsz | jq '.streams, .consumers'
# Run the NATS Prometheus exporter
docker run -p 7777:7777 natsio/prometheus-nats-exporter:latest -varz http://nats-server:8222 -connz http://nats-server:8222 -jsz http://nats-server:8222
# TigerOps Collector config (otel-collector.yaml)
receivers:
prometheus:
config:
scrape_configs:
- job_name: nats
scrape_interval: 15s
static_configs:
- targets: [nats-exporter:7777]
exporters:
otlphttp:
endpoint: https://ingest.tigerops.io/v1/metrics
headers:
Authorization: "Bearer ${TIGEROPS_API_KEY}"
service:
pipelines:
metrics:
receivers: [prometheus]
exporters: [otlphttp]
# Key JetStream alert metrics
# gnatsd_jetstream_stream_info_num_msgs → stream message count
# gnatsd_jetstream_consumer_num_pending → consumer lag
# gnatsd_jetstream_consumer_num_redelivered → redelivery rate spikeCommon Questions
Which NATS versions are supported?
NATS Server 2.8+ with JetStream is fully supported. NATS Server 2.2+ (without JetStream) is supported for core NATS metrics. The monitoring HTTP API has been stable across these versions.
Do I need JetStream enabled to use TigerOps with NATS?
No. Core NATS metrics (connections, subscriptions, message rates) are available without JetStream. JetStream-specific metrics (streams, consumers, consumer lag) require JetStream to be enabled in your NATS server config.
How does TigerOps monitor NATS leaf nodes?
Leaf node connection counts, message rates, and status are included in the /leafz monitoring endpoint. Point the NATS exporter at each leaf node's monitoring port to include leaf node metrics in TigerOps dashboards.
Can TigerOps alert on JetStream consumer lag specifically?
Yes. Use the jetstream_consumer_num_pending metric with a consumer name label filter. Create threshold alerts for individual consumers that are critical to your message processing pipeline.
Does TigerOps support NATS NGS (Global Synadia Network)?
NATS NGS accounts expose the same monitoring HTTP API as self-hosted NATS. Point the exporter at your NGS account monitoring URL. NGS-specific metrics including account usage and quota limits are supported.
Full NATS Observability via the Monitoring API
JetStream stream metrics, consumer lag, message rates, and server health — two config lines to enable.