1
0
mirror of https://github.com/taigrr/nats.docs synced 2025-01-18 04:03:23 -08:00

Merge pull request #35 from nats-io/monitoring-updates

Updates to monitoring section
This commit is contained in:
Ginger Collison 2019-06-24 16:48:03 -05:00 committed by GitHub
commit 683f1f7b8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,7 +4,7 @@ To monitor the NATS messaging system, `nats-server` provides a lightweight HTTP
The NATS monitoring endpoints support JSONP and CORS, making it easy to create single page monitoring web applications. The NATS monitoring endpoints support JSONP and CORS, making it easy to create single page monitoring web applications.
## Enabling monitoring ### 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](configuration.md#configuration-properties). 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](configuration.md#configuration-properties).
@ -23,6 +23,14 @@ $ nats-server -m 8222
To test, run `nats-server -m 8222`, then go to <a href="http://localhost:8222/" target="_blank">http://localhost:8222/</a> To test, run `nats-server -m 8222`, then go to <a href="http://localhost:8222/" target="_blank">http://localhost:8222/</a>
### Enable monitoring from the configuration file
You can also enable monitoring using the configuration file as follows:
```yaml
http_port: 8222
```
## Monitoring endpoints ## Monitoring endpoints
The following sections describe each supported monitoring endpoint: `varz`, `connz`, `routez`, and `subsz`. The following sections describe each supported monitoring endpoint: `varz`, `connz`, `routez`, and `subsz`.
@ -33,34 +41,52 @@ The endpoint <a href="http://localhost:822/varz" target="_blank">http://localhos
```json ```json
{ {
"server_id": "ec933edcd2bd86bcf71d555fc8b4fb2c", "server_id": "NACDVKFBUW4C4XA24OOT6L4MDP56MW76J5RJDFXG7HLABSB46DCMWCOW",
"version": "0.6.6", "version": "2.0.0",
"go": "go1.5.0", "proto": 1,
"go": "go1.12",
"host": "0.0.0.0", "host": "0.0.0.0",
"port": 4222, "port": 4222,
"auth_required": false,
"ssl_required": false,
"max_payload": 1048576,
"max_connections": 65536, "max_connections": 65536,
"ping_interval": 120000000000, "ping_interval": 120000000000,
"ping_max": 2, "ping_max": 2,
"http_host": "0.0.0.0",
"http_port": 8222, "http_port": 8222,
"ssl_timeout": 0.5, "https_port": 0,
"max_control_line": 1024, "auth_timeout": 1,
"start": "2015-07-14T13:29:26.426805508-07:00", "max_control_line": 4096,
"now": "2015-07-14T13:30:59.349179963-07:00", "max_payload": 1048576,
"uptime": "1m33s", "max_pending": 67108864,
"mem": 8445952, "cluster": {},
"gateway": {},
"leaf": {},
"tls_timeout": 0.5,
"write_deadline": 2000000000,
"start": "2019-06-24T14:24:43.928582-07:00",
"now": "2019-06-24T14:24:46.894852-07:00",
"uptime": "2s",
"mem": 9617408,
"cores": 4, "cores": 4,
"cpu": 0, "cpu": 0,
"connections": 39, "connections": 0,
"total_connections": 0,
"routes": 0, "routes": 0,
"remotes": 0, "remotes": 0,
"in_msgs": 100000, "in_msgs": 0,
"out_msgs": 100000, "out_msgs": 0,
"in_bytes": 1600000, "in_bytes": 0,
"out_bytes": 1600000, "out_bytes": 0,
"slow_consumers": 0 "slow_consumers": 0,
"subscriptions": 0,
"http_req_stats": {
"/": 0,
"/connz": 0,
"/gatewayz": 0,
"/routez": 0,
"/subsz": 0,
"/varz": 1
},
"config_load_time": "2019-06-24T14:24:43.928582-07:00"
} }
``` ```
@ -74,41 +100,55 @@ You can also report detailed subscription information on a per connection basis
```json ```json
{ {
"now": "2015-07-14T13:30:59.349179963-07:00", "server_id": "NACDVKFBUW4C4XA24OOT6L4MDP56MW76J5RJDFXG7HLABSB46DCMWCOW",
"now": "2019-06-24T14:28:16.520365-07:00",
"num_connections": 2, "num_connections": 2,
"total": 2,
"offset": 0, "offset": 0,
"limit": 1024, "limit": 1024,
"connections": [ "connections": [
{ {
"cid": 571, "cid": 1,
"ip": "127.0.0.1", "ip": "127.0.0.1",
"port": 61572, "port": 49764,
"pending_size": 0, "start": "2019-06-24T14:27:25.94611-07:00",
"last_activity": "2019-06-24T14:27:25.954046-07:00",
"rtt": "275µs",
"uptime": "50s",
"idle": "50s",
"pending_bytes": 0,
"in_msgs": 0, "in_msgs": 0,
"out_msgs": 0, "out_msgs": 0,
"in_bytes": 0, "in_bytes": 0,
"out_bytes": 0, "out_bytes": 0,
"subscriptions": 1, "subscriptions": 1,
"name": "NATS Sample Subscriber",
"lang": "go", "lang": "go",
"version": "1.0.9", "version": "1.8.1",
"subscriptions_list": [ "subscriptions_list": [
"hello.world" "hello.world"
] ]
}, },
{ {
"cid": 574, "cid": 2,
"ip": "127.0.0.1", "ip": "127.0.0.1",
"port": 61577, "port": 49767,
"pending_size": 0, "start": "2019-06-24T14:27:43.403923-07:00",
"last_activity": "2019-06-24T14:27:43.406568-07:00",
"rtt": "96µs",
"uptime": "33s",
"idle": "33s",
"pending_bytes": 0,
"in_msgs": 0, "in_msgs": 0,
"out_msgs": 0, "out_msgs": 0,
"in_bytes": 0, "in_bytes": 0,
"out_bytes": 0, "out_bytes": 0,
"subscriptions": 1, "subscriptions": 1,
"lang": "ruby", "name": "NATS Sample Subscriber",
"version": "0.5.0", "lang": "go",
"version": "1.8.1",
"subscriptions_list": [ "subscriptions_list": [
"hello.world" "foo.bar"
] ]
} }
] ]
@ -123,7 +163,8 @@ The `routez` endpoint does support the `subs` argument from the `/connz` endpoin
```json ```json
{ {
"now": "2015-07-14T13:30:59.349179963-07:00", "server_id": "NACDVKFBUW4C4XA24OOT6L4MDP56MW76J5RJDFXG7HLABSB46DCMWCOW",
"now": "2019-06-24T14:29:16.046656-07:00",
"num_routes": 1, "num_routes": 1,
"routes": [ "routes": [
{ {
@ -149,15 +190,14 @@ The endpoint <a href="http://localhost:8222/subz" target="_blank">http://localho
```json ```json
{ {
"num_subscriptions": 3, "num_subscriptions": 2,
"num_cache": 0, "num_cache": 0,
"num_inserts": 572, "num_inserts": 2,
"num_removes": 569, "num_removes": 0,
"num_matches": 200000, "num_matches": 0,
"cache_hit_rate": 0.99999, "cache_hit_rate": 0,
"max_fanout": 0, "max_fanout": 0,
"avg_fanout": 0, "avg_fanout": 0
"stats_time": "2015-07-14T12:55:25.564818051-07:00"
} }
``` ```