Monitoring
To monitor the NATS Streaming system, a lightweight HTTP server is used on a dedicated monitoring port. The monitoring server provides several endpoints, all returning a JSON object.
Enabling from the command line
To enable the monitoring server, start the NATS Streaming Server with the monitoring flag -m (or -ms) and specify the monitoring port.
Monitoring options
To enable monitoring via the configuration file, use http: "host:port"
or https: "host:port"
. There is no explicit configuration flag for the monitoring interface.
For example, after running this:
you should see that the NATS Streaming server starts with the HTTP monitoring port enabled:
You can then point your browser (or curl) to http://localhost:8222/streaming
Enabling from the configuration file
To start via the configuration file you can define the monitoring port as follows:
Then use the -sc
flag to customize the NATS Streaming configuration:
Confirm that the monitoring endpoint is enabled by sending a request:
Monitoring a NATS Streaming channel with Grafana and Prometheus
Here you'll find examples demonstrating how to use Prometheus query expressions to monitor NATS streaming channels.
Pending Messages from Channel Foo
Messages Per Sec Delivered on Channel Foo
In this case, 3
is the size of the quorum of NATS Streaming Server nodes. In case of a single instance backed by a relational database we would set it to 1
:
Msgs/Sec vs Pending on Channel
Example of combining the rate of messages with the pending count to detect whether processing is getting behind:
最后更新于