nats-top
nats-top is a top-like tool for monitoring nats-server servers.
The nats-top tool provides a dynamic real-time view of a NATS server. nats-top can display a variety of system summary information about the NATS server, such as subscription, pending bytes, number of messages, and more, in real time. For example:
Installation
nats-top can be installed using go install
. For example:
With newer versions of Go, you will be required to use go install github.com/nats-io/nats-top@latest
.
NOTE: You may have to run the above command as user sudo
depending on your setup. If you receive an error that you cannot install nats-top because your $GOPATH is not set, when in fact it is set, use command sudo -E go get github.com/nats-io/nats-top
to install nats-top. The -E
flag tells sudo to preserve the current user's environment.
Usage
Once installed, nats-top can be run with the command nats-top
and optional arguments.
Options
Optional arguments inclde the following:
Commands
While in nats-top view, you can use the following commands.
option
Use the o<option>
command to set the primary sort key to the <option>
value. The option value can be one of the following: cid
, subs
, pending
, msgs_to
, msgs_from
, bytes_to
, bytes_from
, lang
, version
.
You can also set the sort option on the command line using the -sort
flag. For example: nats-top -sort bytes_to
.
limit
Use the n<limit>
command to set the sample size of connections to request from the server.
You can also set this on the command line using the -n num_connections
flag. For example: nats-top -n 1
.
Note that if n<limit>
is used in conjunction with -sort
, the server will respect both options allowing queries such as the following: Query for the connection with largest number of subscriptions: nats-top -n 1 -sort subs
.
s, ? and q Commands
Use the s
command to toggle displaying connection subscriptions.
Use the ?
command to show help message with options.
Use the q
command to quit nats-top.
Tutorial
For a walkthrough with nats-top
check out the tutorial.
最后更新于