Since 0.2.0 release of the NATS Prometheus Exporter, it is possible to have the exporter poll metrics from the NATS Streaming Server monitoring port:
$ docker run natsio/prometheus-nats-exporter:latest -h
...
-channelz
Get streaming channel metrics.
-serverz
Get streaming server metrics.
...
Once enabled, the exporter will make available the following metrics:
# Per Channel metrics
nss_chan_bytes_total
nss_chan_last_seq
nss_chan_msgs_total
nss_chan_subs_last_sent
nss_chan_subs_max_inflight
nss_chan_subs_pending_count
# Server Totals
nss_server_bytes_total
nss_server_channels
nss_server_clients
nss_server_msgs_total
nss_server_subscriptions
And example dashboard can be found here:
sum(rate(nss_chan_msgs_total{channel="foo"}[5m])) by (channel) / 3
With this query you an find the rate of messages being delivered on
the channel foo
. Note that in this case we are using 3
since that
is the size of the cluster.
sum(rate(nss_chan_msgs_total{channel="foo"}[5m])) by (channel) / 3
sum(nss_chan_subs_pending_count{channel="foo"}) by (channel) / 3
You could combine queries from nss_chan_msgs_total
and
nss_chan_subs_pending_count
to compare the rate of messages with the
pending count to detect whether processing is getting behind: