Top like program monitor for NATS.
Go Shell Makefile
Latest commit 1c2a692 Aug 24, 2016 @wallyqs wallyqs Bump version

readme.md

nats-top

MIT LicenseBuild StatusGitHub release

nats-top is a top-like tool for monitoring NATS servers.

$ nats-top

NATS server version 0.7.3 (uptime: 3m34s)
Server:
  Load: CPU:  58.3%  Memory: 8.6M  Slow Consumers: 0
  In:   Msgs: 568.7K  Bytes: 1.7M  Msgs/Sec: 13129.0  Bytes/Sec: 38.5K
  Out:  Msgs: 1.6M  Bytes: 4.7M  Msgs/Sec: 131290.9  Bytes/Sec: 384.6K    

Connections: 10
  HOST                 CID    NAME        SUBS    PENDING     MSGS_TO   MSGS_FROM   BYTES_TO    BYTES_FROM  LANG     VERSION  UPTIME   LAST ACTIVITY
  127.0.0.1:57487      13     example     1       12.0K       161.6K    0           484.7K      0           go       1.1.7    17s      2016-02-09 00:13:24.753062715 -0800 PST
  127.0.0.1:57488      14     example     1       11.9K       161.6K    0           484.7K      0           go       1.1.7    17s      2016-02-09 00:13:24.753040168 -0800 PST
  127.0.0.1:57489      15     example     1       12.1K       161.6K    0           484.7K      0           go       1.1.7    17s      2016-02-09 00:13:24.753069442 -0800 PST
  127.0.0.1:57490      16     example     1       12.0K       161.6K    0           484.7K      0           go       1.1.7    17s      2016-02-09 00:13:24.753057413 -0800 PST
  127.0.0.1:57491      17     example     1       12.1K       161.6K    0           484.7K      0           go       1.1.7    17s      2016-02-09 00:13:24.75307264 -0800 PST 
  127.0.0.1:57492      18     example     1       12.1K       161.6K    0           484.7K      0           go       1.1.7    17s      2016-02-09 00:13:24.753066213 -0800 PST
  127.0.0.1:57493      19     example     1       12.0K       161.6K    0           484.7K      0           go       1.1.7    17s      2016-02-09 00:13:24.753075802 -0800 PST
  127.0.0.1:57494      20     example     1       12.2K       161.6K    0           484.7K      0           go       1.1.7    17s      2016-02-09 00:13:24.753052178 -0800 PST
  127.0.0.1:57495      21     example     1       12.1K       161.6K    0           484.7K      0           go       1.1.7    17s      2016-02-09 00:13:24.753048615 -0800 PST
  127.0.0.1:57496      22     example     1       12.0K       161.6K    0           484.7K      0           go       1.1.7    17s      2016-02-09 00:13:24.753016783 -0800 PST

Install

Can be installed via go get:

go get github.com/nats-io/nats-top

and releases of the binary are also available

Usage

usage: nats-top [-s server] [-m http_port] [-ms https_port] [-n num_connections] [-d delay_secs] [-sort by]
                [-cert FILE] [-key FILE ][-cacert FILE] [-k]
  • -m http_port, -ms https_port

    Monitoring http and https ports from the NATS server.

  • -n num_connections

    Limit the connections requested to the server (default: 1024)

  • -d delay_in_secs

    Screen refresh interval (default: 1 second).

  • -sort by

    Field to use for sorting the connections.

  • -cert, -key, -cacert

    Client certificate, key and RootCA for monitoring via https.

  • -k

    Configure to skip verification of certificate.

Commands

While in top view, it is possible to use the following commands:

  • o [option]

    Set primary sort key to [option]:

    Keyname may be one of: {cid, subs, msgs_to, msgs_from, bytes_to, bytes_from, idle, last}

    This can be set in the command line too, e.g. nats-top -sort bytes_to

  • n [limit]

    Set sample size of connections to request from the server.

    This can be set in the command line as well: nats-top -n 1 Note that if used in conjunction with sort, the server would respect both options enabling queries like connection with largest number of subscriptions: nats-top -n 1 -sort subs

  • s

    Toggle displaying connection subscriptions.

  • d

    Toggle activating DNS address lookup for clients.

  • ?

    Show help message with options.

  • q

    Quit nats-top.

Demo

nats-top