Monitoring

Monitoring NATS

To monitor the NATS messaging system, nats-server provides a lightweight HTTP server on a dedicated monitoring port. The monitoring server provides several endpoints, providing statistics and other information about the following:

All endpoints return a JSON object.

The NATS monitoring endpoints support JSONP and CORS, making it easy to create single page monitoring web applications. Part of the NATS ecosystem is a tool called nats-top that visualizes data from these endpoints on the command line.

See

Warning: nats-server does not have authentication/authorization for the monitoring endpoint. When you plan to open your nats-server to the internet make sure to not expose the monitoring port as well. By default monitoring binds to every interface 0.0.0.0 so consider setting monitoring to localhost or have appropriate firewall rules.

In other words don’t do what https://demo.nats.io:8222/ does! It is done on purpose to simplify the examples below.

Enabling monitoring from the command line

To enable the monitoring server, start the NATS server with the monitoring flag -m and the monitoring port, or turn it on in the configuration file.

  1. -m, --http_port PORT HTTP PORT for monitoring
  2. -ms,--https_port PORT Use HTTPS PORT for monitoring

Example:

  1. nats-server -m 8222
  1. [4528] 2019/06/01 20:09:58.572939 [INF] Starting nats-server version 2.0.0
  2. [4528] 2019/06/01 20:09:58.573007 [INF] Starting http monitor on port 8222
  3. [4528] 2019/06/01 20:09:58.573071 [INF] Listening for client connections on 0.0.0.0:4222
  4. [4528] 2019/06/01 20:09:58.573090 [INF] nats-server is ready</td>

To test, run nats-server -m 8222, then go to http://localhost:8222/

Enable monitoring from the configuration file

You can also enable monitoring using the configuration file as follows:

  1. http_port: 8222

Binding to localhost as well:

  1. http: localhost:8222

For example, to monitor this server locally, the endpoint would be http://localhost:8222/varz. It reports various general statistics.

Monitoring Endpoints

The following sections describe each supported monitoring endpoint: varz, connz, routez, subsz, gatewayz, leafz, accountz, and jsz. There are not any required arguments, however use of arguments can let you tailor monitoring to your environment and tooling.

General Information

The /varz endpoint returns general information about the server state and configuration.

Endpoint: http://server:port/varz

Result Return Code
Success 200 (OK)
Error 400 (Bad Request)

Arguments

N/A

Example

https://demo.nats.io:8222/varz

Response

  1. {
  2. "server_id": "NACDVKFBUW4C4XA24OOT6L4MDP56MW76J5RJDFXG7HLABSB46DCMWCOW",
  3. "version": "2.0.0",
  4. "proto": 1,
  5. "go": "go1.12",
  6. "host": "0.0.0.0",
  7. "port": 4222,
  8. "max_connections": 65536,
  9. "ping_interval": 120000000000,
  10. "ping_max": 2,
  11. "http_host": "0.0.0.0",
  12. "http_port": 8222,
  13. "https_port": 0,
  14. "auth_timeout": 1,
  15. "max_control_line": 4096,
  16. "max_payload": 1048576,
  17. "max_pending": 67108864,
  18. "cluster": {},
  19. "gateway": {},
  20. "leaf": {},
  21. "tls_timeout": 0.5,
  22. "write_deadline": 2000000000,
  23. "start": "2019-06-24T14:24:43.928582-07:00",
  24. "now": "2019-06-24T14:24:46.894852-07:00",
  25. "uptime": "2s",
  26. "mem": 9617408,
  27. "cores": 4,
  28. "gomaxprocs": 4,
  29. "cpu": 0,
  30. "connections": 0,
  31. "total_connections": 0,
  32. "routes": 0,
  33. "remotes": 0,
  34. "leafnodes": 0,
  35. "in_msgs": 0,
  36. "out_msgs": 0,
  37. "in_bytes": 0,
  38. "out_bytes": 0,
  39. "slow_consumers": 0,
  40. "subscriptions": 0,
  41. "http_req_stats": {
  42. "/": 0,
  43. "/connz": 0,
  44. "/gatewayz": 0,
  45. "/routez": 0,
  46. "/subsz": 0,
  47. "/varz": 1
  48. },
  49. "config_load_time": "2019-06-24T14:24:43.928582-07:00"
  50. }

Connection Information

The /connz endpoint reports more detailed information on current and recently closed connections. It uses a paging mechanism which defaults to 1024 connections.

Endpoint: http://server:port/connz

Result Return Code
Success 200 (OK)
Error 400 (Bad Request)

Arguments

Argument Values Description
sort (see sort options) Sorts the results. Default is connection ID.
auth true, 1, false, 0 Include username. Default is false.
subs true, 1, false, 0 or detail Include subscriptions. Default is false. When set to detail a list with more detailed subscription information will be returned.
offset number > 0 Pagination offset. Default is 0.
limit number > 0 Number of results to return. Default is 1024.
cid number, valid id Return a connection by it’s id
state open, *closed, any Return connections of particular state. Default is open.
mqtt_client string Filter the connection with this MQTT client ID.

The server will default to holding the last 10,000 closed connections.

Sort Options

Option Sort by
cid Connection ID
start Connection start time, same as CID
subs Number of subscriptions
pending Amount of data in bytes waiting to be sent to client
msgs_to Number of messages sent
msgs_from Number of messages received
bytes_to Number of bytes sent
bytes_from Number of bytes received
last Last activity
idle Amount of inactivity
uptime Lifetime of the connection
stop Stop time for a closed connection
reason Reason for a closed connection

Examples

Get up to 1024 connections: https://demo.nats.io:8222/connz

Control limit and offset: https://demo.nats.io:8222/connz?limit=16&offset=128.

Get closed connection information: https://demo.nats.io:8222/connz?state=closed.

You can also report detailed subscription information on a per connection basis using subs=1. For example: https://demo.nats.io:8222/connz?limit=1&offset=1&subs=1.

Response

  1. {
  2. "server_id": "NACDVKFBUW4C4XA24OOT6L4MDP56MW76J5RJDFXG7HLABSB46DCMWCOW",
  3. "now": "2019-06-24T14:28:16.520365-07:00",
  4. "num_connections": 2,
  5. "total": 2,
  6. "offset": 0,
  7. "limit": 1024,
  8. "connections": [
  9. {
  10. "cid": 5,
  11. "kind": "Client",
  12. "type": "nats",
  13. "ip": "127.0.0.1",
  14. "port": 62714,
  15. "start": "2021-09-09T23:16:43.040862Z",
  16. "last_activity": "2021-09-09T23:16:43.042364Z",
  17. "rtt": "95µs",
  18. "uptime": "5s",
  19. "idle": "5s",
  20. "pending_bytes": 0,
  21. "in_msgs": 0,
  22. "out_msgs": 0,
  23. "in_bytes": 0,
  24. "out_bytes": 0,
  25. "subscriptions": 1,
  26. "name": "NATS Benchmark",
  27. "lang": "go",
  28. "version": "1.12.1"
  29. },
  30. {
  31. "cid": 6,
  32. "kind": "Client",
  33. "type": "nats",
  34. "ip": "127.0.0.1",
  35. "port": 62715,
  36. "start": "2021-09-09T23:16:43.042557Z",
  37. "last_activity": "2021-09-09T23:16:43.042811Z",
  38. "rtt": "100µs",
  39. "uptime": "5s",
  40. "idle": "5s",
  41. "pending_bytes": 0,
  42. "in_msgs": 0,
  43. "out_msgs": 0,
  44. "in_bytes": 0,
  45. "out_bytes": 0,
  46. "subscriptions": 1,
  47. "name": "NATS Benchmark",
  48. "lang": "go",
  49. "version": "1.12.1"
  50. },
  51. {
  52. "cid": 7,
  53. "kind": "Client",
  54. "type": "mqtt",
  55. "ip": "::1",
  56. "port": 62718,
  57. "start": "2021-09-09T23:16:45.391459Z",
  58. "last_activity": "2021-09-09T23:16:45.395869Z",
  59. "rtt": "0s",
  60. "uptime": "2s",
  61. "idle": "2s",
  62. "pending_bytes": 0,
  63. "in_msgs": 0,
  64. "out_msgs": 0,
  65. "in_bytes": 0,
  66. "out_bytes": 0,
  67. "subscriptions": 2,
  68. "mqtt_client": "mqtt_sub"
  69. }
  70. ]
  71. }

Route Information

The /routez endpoint reports information on active routes for a cluster. Routes are expected to be low, so there is no paging mechanism with this endpoint.

Endpoint: http://server:port/routez

Result Return Code
Success 200 (OK)
Error 400 (Bad Request)

Arguments

Argument Values Description
subs true, 1, false, 0 or detail Include subscriptions. Default is false. When set to detail a list with more detailed subscription information will be returned.

As noted above, the routez endpoint does support the subs argument from the /connz endpoint. For example: https://demo.nats.io:8222/routez?subs=1

Example

Response

  1. {
  2. "server_id": "NACDVKFBUW4C4XA24OOT6L4MDP56MW76J5RJDFXG7HLABSB46DCMWCOW",
  3. "now": "2019-06-24T14:29:16.046656-07:00",
  4. "num_routes": 1,
  5. "routes": [
  6. {
  7. "rid": 1,
  8. "remote_id": "de475c0041418afc799bccf0fdd61b47",
  9. "did_solicit": true,
  10. "ip": "127.0.0.1",
  11. "port": 61791,
  12. "pending_size": 0,
  13. "in_msgs": 0,
  14. "out_msgs": 0,
  15. "in_bytes": 0,
  16. "out_bytes": 0,
  17. "subscriptions": 0
  18. }
  19. ]
  20. }

Gateway Information

The /gatewayz endpoint reports information about gateways used to create a NATS supercluster. Like routes, the number of gateways are expected to be low, so there is no paging mechanism with this endpoint.

Endpoint: http://server:port/gatewayz

Result Return Code
Success 200 (OK)
Error 400 (Bad Request)

Arguments

Argument Values Description
accs true, 1, false, 0 Include account information. Default is false.
gw_name string Return only remote gateways with this name.
acc_name string Limit the list of accounts to this account name.

Examples

Response

  1. {
  2. "server_id": "NANVBOU62MDUWTXWRQ5KH3PSMYNCHCEUHQV3TW3YH7WZLS7FMJE6END6",
  3. "now": "2019-07-24T18:02:55.597398-06:00",
  4. "name": "region1",
  5. "host": "2601:283:4601:1350:1895:efda:2010:95a1",
  6. "port": 4501,
  7. "outbound_gateways": {
  8. "region2": {
  9. "configured": true,
  10. "connection": {
  11. "cid": 7,
  12. "ip": "127.0.0.1",
  13. "port": 5500,
  14. "start": "2019-07-24T18:02:48.765621-06:00",
  15. "last_activity": "2019-07-24T18:02:48.765621-06:00",
  16. "uptime": "6s",
  17. "idle": "6s",
  18. "pending_bytes": 0,
  19. "in_msgs": 0,
  20. "out_msgs": 0,
  21. "in_bytes": 0,
  22. "out_bytes": 0,
  23. "subscriptions": 0,
  24. "name": "NCXBIYWT7MV7OAQTCR4QTKBN3X3HDFGSFWTURTCQ22ZZB6NKKJPO7MN4"
  25. }
  26. },
  27. "region3": {
  28. "configured": true,
  29. "connection": {
  30. "cid": 5,
  31. "ip": "::1",
  32. "port": 6500,
  33. "start": "2019-07-24T18:02:48.764685-06:00",
  34. "last_activity": "2019-07-24T18:02:48.764685-06:00",
  35. "uptime": "6s",
  36. "idle": "6s",
  37. "pending_bytes": 0,
  38. "in_msgs": 0,
  39. "out_msgs": 0,
  40. "in_bytes": 0,
  41. "out_bytes": 0,
  42. "subscriptions": 0,
  43. "name": "NCVS7Q65WX3FGIL2YQRLI77CE6MQRWO2Y453HYVLNMBMTVLOKMPW7R6K"
  44. }
  45. }
  46. },
  47. "inbound_gateways": {
  48. "region2": [
  49. {
  50. "configured": false,
  51. "connection": {
  52. "cid": 9,
  53. "ip": "::1",
  54. "port": 52029,
  55. "start": "2019-07-24T18:02:48.76677-06:00",
  56. "last_activity": "2019-07-24T18:02:48.767096-06:00",
  57. "uptime": "6s",
  58. "idle": "6s",
  59. "pending_bytes": 0,
  60. "in_msgs": 0,
  61. "out_msgs": 0,
  62. "in_bytes": 0,
  63. "out_bytes": 0,
  64. "subscriptions": 0,
  65. "name": "NCXBIYWT7MV7OAQTCR4QTKBN3X3HDFGSFWTURTCQ22ZZB6NKKJPO7MN4"
  66. }
  67. }
  68. ],
  69. "region3": [
  70. {
  71. "configured": false,
  72. "connection": {
  73. "cid": 4,
  74. "ip": "::1",
  75. "port": 52025,
  76. "start": "2019-07-24T18:02:48.764577-06:00",
  77. "last_activity": "2019-07-24T18:02:48.764994-06:00",
  78. "uptime": "6s",
  79. "idle": "6s",
  80. "pending_bytes": 0,
  81. "in_msgs": 0,
  82. "out_msgs": 0,
  83. "in_bytes": 0,
  84. "out_bytes": 0,
  85. "subscriptions": 0,
  86. "name": "NCVS7Q65WX3FGIL2YQRLI77CE6MQRWO2Y453HYVLNMBMTVLOKMPW7R6K"
  87. }
  88. },
  89. {
  90. "configured": false,
  91. "connection": {
  92. "cid": 8,
  93. "ip": "127.0.0.1",
  94. "port": 52026,
  95. "start": "2019-07-24T18:02:48.766173-06:00",
  96. "last_activity": "2019-07-24T18:02:48.766999-06:00",
  97. "uptime": "6s",
  98. "idle": "6s",
  99. "pending_bytes": 0,
  100. "in_msgs": 0,
  101. "out_msgs": 0,
  102. "in_bytes": 0,
  103. "out_bytes": 0,
  104. "subscriptions": 0,
  105. "name": "NCKCYK5LE3VVGOJQ66F65KA27UFPCLBPX4N4YOPOXO3KHGMW24USPCKN"
  106. }
  107. }
  108. ]
  109. }
  110. }

Leaf Node Information

The /leafz endpoint reports detailed information about the leaf node connections.

Endpoint: http://server:port/leafz

Result Return Code
Success 200 (OK)
Error 400 (Bad Request)

Arguments

Argument Values Description
subs true, 1, false, 0 Include internal subscriptions. Default is false.

As noted above, the leafz endpoint does support the subs argument from the /connz endpoint. For example: https://demo.nats.io:8222/leafz?subs=1

Example

Response

  1. {
  2. "server_id": "NC2FJCRMPBE5RI5OSRN7TKUCWQONCKNXHKJXCJIDVSAZ6727M7MQFVT3",
  3. "now": "2019-08-27T09:07:05.841132-06:00",
  4. "leafnodes": 1,
  5. "leafs": [
  6. {
  7. "account": "$G",
  8. "ip": "127.0.0.1",
  9. "port": 6223,
  10. "rtt": "200µs",
  11. "in_msgs": 0,
  12. "out_msgs": 10000,
  13. "in_bytes": 0,
  14. "out_bytes": 1280000,
  15. "subscriptions": 1,
  16. "subscriptions_list": [
  17. "foo"
  18. ]
  19. }
  20. ]
  21. }

Subscription Routing Information

The /subsz endpoint reports detailed information about the current subscriptions and the routing data structure. It is not normally used.

Endpoint: http://server:port/subsz

Result Return Code
Success 200 (OK)
Error 400 (Bad Request)

Arguments

Argument Values Description
subs true, 1, false, 0 Include subscriptions. Default is false.
offset integer > 0 Pagination offset. Default is 0.
limit integer > 0 Number of results to return. Default is 1024.
test subject Test whether a subsciption exists.

Example

Response

  1. {
  2. "num_subscriptions": 2,
  3. "num_cache": 0,
  4. "num_inserts": 2,
  5. "num_removes": 0,
  6. "num_matches": 0,
  7. "cache_hit_rate": 0,
  8. "max_fanout": 0,
  9. "avg_fanout": 0
  10. }

Account Information

The /accountz endpoint reports information on a server’s active accounts. The default behavior is to return a list of all accounts known to the server.

Endpoint: http://server:port/accountz

Result Return Code
Success 200 (OK)
Error 400 (Bad Request)
Argument Value Description
acc account name Include metrics for the specified account. Default is empty. When not set, a list of all accounts is included.

Example

Response

Default behavior:

  1. {
  2. "server_id": "NAB2EEQ3DLS2BHU4K2YMXMPIOOOAOFOAQAC5NQRIEUI4BHZKFBI4ZU4A",
  3. "now": "2021-02-08T17:31:29.551146-05:00",
  4. "system_account": "AAAXAUVSGK7TCRHFIRAS4SYXVJ76EWDMNXZM6ARFGXP7BASNDGLKU7A5",
  5. "accounts": [
  6. "AAAXAUVSGK7TCRHFIRAS4SYXVJ76EWDMNXZM6ARFGXP7BASNDGLKU7A5",
  7. "$G"
  8. ]
  9. }

Retrieve specific account:

  1. {
  2. "server_id": "NAB2EEQ3DLS2BHU4K2YMXMPIOOOAOFOAQAC5NQRIEUI4BHZKFBI4ZU4A",
  3. "now": "2021-02-08T17:37:55.80856-05:00",
  4. "system_account": "AAAXAUVSGK7TCRHFIRAS4SYXVJ76EWDMNXZM6ARFGXP7BASNDGLKU7A5",
  5. "account_detail": {
  6. "account_name": "AAAXAUVSGK7TCRHFIRAS4SYXVJ76EWDMNXZM6ARFGXP7BASNDGLKU7A5",
  7. "update_time": "2021-02-08T17:31:22.390334-05:00",
  8. "is_system": true,
  9. "expired": false,
  10. "complete": true,
  11. "jetstream_enabled": false,
  12. "leafnode_connections": 0,
  13. "client_connections": 0,
  14. "subscriptions": 42,
  15. "exports": [
  16. {
  17. "subject": "$SYS.DEBUG.SUBSCRIBERS",
  18. "type": "service",
  19. "response_type": "Singleton"
  20. }
  21. ],
  22. "jwt": "eyJ0eXAiOiJqd3QiLCJhbGciOiJlZDI1NTE5In0.eyJqdGkiOiJVVlU2VEpXRU8zS0hYWTZVMkgzM0RCVklET1A3U05DTkJPMlM0M1dPNUM2T1RTTDNVSUxBIiwiaWF0IjoxNjAzNDczNzg4LCJpc3MiOiJPQlU1TzVGSjMyNFVEUFJCSVZSR0Y3Q05FT0hHTFBTN0VZUEJUVlFaS1NCSElJWklCNkhENjZKRiIsIm5hbWUiOiJTWVMiLCJzdWIiOiJBQUFYQVVWU0dLN1RDUkhGSVJBUzRTWVhWSjc2RVdETU5YWk02QVJGR1hQN0JBU05ER0xLVTdBNSIsInR5cGUiOiJhY2NvdW50IiwibmF0cyI6eyJsaW1pdHMiOnsic3VicyI6LTEsImNvbm4iOi0xLCJsZWFmIjotMSwiaW1wb3J0cyI6LTEsImV4cG9ydHMiOi0xLCJkYXRhIjotMSwicGF5bG9hZCI6LTEsIndpbGRjYXJkcyI6dHJ1ZX19fQ.CeGo16i5oD0b1uBJ8UdGmLH-l9dL8yNqXHggkAt2T5c88fM7k4G08wLguMAnlvzrdlYvdZvOx_5tHLuDZmGgCg",
  23. "issuer_key": "OBU5O5FJ324UDPRBIVRGF7CNEOHGLPS7EYPBTVQZKSBHIIZIB6HD66JF",
  24. "name_tag": "SYS",
  25. "decoded_jwt": {
  26. "jti": "UVU6TJWEO3KHXY6U2H33DBVIDOP7SNCNBO2S43WO5C6OTSL3UILA",
  27. "iat": 1603473788,
  28. "iss": "OBU5O5FJ324UDPRBIVRGF7CNEOHGLPS7EYPBTVQZKSBHIIZIB6HD66JF",
  29. "name": "SYS",
  30. "sub": "AAAXAUVSGK7TCRHFIRAS4SYXVJ76EWDMNXZM6ARFGXP7BASNDGLKU7A5",
  31. "nats": {
  32. "limits": {
  33. "subs": -1,
  34. "data": -1,
  35. "payload": -1,
  36. "imports": -1,
  37. "exports": -1,
  38. "wildcards": true,
  39. "conn": -1,
  40. "leaf": -1
  41. },
  42. "default_permissions": {
  43. "pub": {},
  44. "sub": {}
  45. },
  46. "type": "account",
  47. "version": 1
  48. }
  49. },
  50. "sublist_stats": {
  51. "num_subscriptions": 42,
  52. "num_cache": 6,
  53. "num_inserts": 42,
  54. "num_removes": 0,
  55. "num_matches": 6,
  56. "cache_hit_rate": 0,
  57. "max_fanout": 1,
  58. "avg_fanout": 0.8333333333333334
  59. }
  60. }
  61. }

JetStream Information

The /jsz endpoint reports more detailed information on JetStream. For accounts, it uses a paging mechanism that defaults to 1024 connections.

Endpoint: http://server:port/jsz

Result Return Code
Success 200 (OK)
Error 400 (Bad Request)

Arguments

Argument Values Description
acc account name Include metrics for the specified account. Default is unset.
accounts true, 1, false, 0 Include account specific JetStream information. Default is false.
streams true, 1, false, 0 Include streams. When set, implies accounts=true. Default is false.
consumers true, 1, false, 0 Include consumer. When set, implies streams=true. Default is false.
config true, 1, false, 0 When stream or consumer are requested, include their respective configuration. Default is false.
leader-only true, 1, false, 0 Only the leader responds. Default is false.
offset number > 0 Pagination offset. Default is 0.
limit number > 0 Number of results to return. Default is 1024.

Examples

Get basic JetStream information: https://demo.nats.io:8222/jsz

Request accounts and control limit and offset: https://demo.nats.io:8222/jsz?accounts=true&limit=16&offset=128.

You can also report detailed consumer information on a per connection basis using consumer=true. For example: https://demo.nats.io:8222/jsz?consumers=true.

Response

  1. {
  2. "server_id": "NCVIDODSZ45C5OD67ZD7EJUIJPQDP6CM74SJX6TJIF2G7NLYS5LCVYHS",
  3. "now": "2021-02-08T19:08:30.555533-05:00",
  4. "config": {
  5. "max_memory": 10485760,
  6. "max_storage": 10485760,
  7. "store_dir": "/var/folders/9h/6g_c9l6n6bb8gp331d_9y0_w0000gn/T/srv_7500251552558"
  8. },
  9. "memory": 0,
  10. "storage": 66,
  11. "api": {
  12. "total": 5,
  13. "errors": 0
  14. },
  15. "total_streams": 1,
  16. "total_consumers": 1,
  17. "total_messages": 1,
  18. "total_message_bytes": 33,
  19. "meta_cluster": {
  20. "name": "cluster_name",
  21. "replicas": [
  22. {
  23. "name": "server_5500",
  24. "current": false,
  25. "active": 2932926000
  26. }
  27. ]
  28. },
  29. "account_details": [
  30. {
  31. "name": "BCC_TO_HAVE_ONE_EXTRA",
  32. "id": "BCC_TO_HAVE_ONE_EXTRA",
  33. "memory": 0,
  34. "storage": 0,
  35. "api": {
  36. "total": 0,
  37. "errors": 0
  38. }
  39. },
  40. {
  41. "name": "ACC",
  42. "id": "ACC",
  43. "memory": 0,
  44. "storage": 66,
  45. "api": {
  46. "total": 5,
  47. "errors": 0
  48. },
  49. "stream_detail": [
  50. {
  51. "name": "my-stream-replicated",
  52. "cluster": {
  53. "name": "cluster_name",
  54. "replicas": [
  55. {
  56. "name": "server_5500",
  57. "current": false,
  58. "active": 2931517000
  59. }
  60. ]
  61. },
  62. "state": {
  63. "messages": 1,
  64. "bytes": 33,
  65. "first_seq": 1,
  66. "first_ts": "2021-02-09T00:08:27.623735Z",
  67. "last_seq": 1,
  68. "last_ts": "2021-02-09T00:08:27.623735Z",
  69. "consumer_count": 1
  70. },
  71. "consumer_detail": [
  72. {
  73. "stream_name": "my-stream-replicated",
  74. "name": "my-consumer-replicated",
  75. "created": "2021-02-09T00:08:27.427631Z",
  76. "delivered": {
  77. "consumer_seq": 0,
  78. "stream_seq": 0
  79. },
  80. "ack_floor": {
  81. "consumer_seq": 0,
  82. "stream_seq": 0
  83. },
  84. "num_ack_pending": 0,
  85. "num_redelivered": 0,
  86. "num_waiting": 0,
  87. "num_pending": 1,
  88. "cluster": {
  89. "name": "cluster_name",
  90. "replicas": [
  91. {
  92. "name": "server_5500",
  93. "current": false,
  94. "active": 2933232000
  95. }
  96. ]
  97. }
  98. }
  99. ]
  100. }
  101. ]
  102. }
  103. ]
  104. }

Creating Monitoring Applications

NATS monitoring endpoints support JSONP and CORS. You can easily create single page web applications for monitoring. To do this you simply pass the callback query parameter to any endpoint.

For example:

  1. https://demo.nats.io:8222/connz?callback=cb

Here is a JQuery example implementation:

  1. $.getJSON('https://demo.nats.io:8222/connz?callback=?', function(data) {
  2. console.log(data);
  3. });

Monitoring Tools

In addition to writing custom monitoring tools, you can monitor nats-server in Prometheus. The Prometheus NATS Exporter allows you to configure the metrics you want to observe and store in Prometheus. There’s a sample Grafana dashboard that you can use to visualize the server metrics.