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

Merge pull request #36 from nats-io/streaming-mon-updates

NATS Streaming monitoring updates
This commit is contained in:
Ginger Collison 2019-06-25 09:02:34 -05:00 committed by GitHub
commit c5ab0b50ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 63 additions and 28 deletions

View File

@ -175,7 +175,6 @@
* [Embedding NATS Streaming Server](developer/streaming/embedding.md) * [Embedding NATS Streaming Server](developer/streaming/embedding.md)
* [Docker Swarm](nats_streaming/swarm.md) * [Docker Swarm](nats_streaming/swarm.md)
* [Monitoring](nats_streaming/monitoring/monitoring.md) * [Monitoring](nats_streaming/monitoring/monitoring.md)
* [Enabling](nats_streaming/monitoring/enabling.md)
* [Endpoints](nats_streaming/monitoring/endpoints.md) * [Endpoints](nats_streaming/monitoring/endpoints.md)
## NATS Protocol ## NATS Protocol

View File

@ -1,4 +1,4 @@
## 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, including [varz](#/varz), [connz](#/connz), [routez](#/routez), and [subsz](#/subz). All endpoints return a JSON object. To monitor the NATS messaging system, `nats-server` provides a lightweight HTTP server on a dedicated monitoring port. The monitoring server provides several endpoints, including [varz](#/varz), [connz](#/connz), [routez](#/routez), and [subsz](#/subz). All endpoints return a JSON object.

View File

@ -1,24 +0,0 @@
### Enabling
To enable the monitoring server, start the NATS Streaming Server with the monitoring flag -m (or -ms) and specify the monitoring port.
Monitoring options
```
-m, --http_port PORT HTTP PORT for monitoring
-ms,--https_port PORT Use HTTPS PORT for monitoring (requires TLS cert and key)
```
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:
```
nats-streaming-server -m 8222
```
you should see that the NATS Streaming server starts with the HTTP monitoring port enabled:
```
(...)
[53359] 2017/12/18 17:44:31.594407 [INF] Starting http monitor on 0.0.0.0:8222
[53359] 2017/12/18 17:44:31.594462 [INF] Listening for client connections on 0.0.0.0:4222
(...)
```
You can then point your browser (or curl) to [http://localhost:8222/streaming](http://localhost:8222/streaming)

View File

@ -1,3 +1,63 @@
## Monitoring ## Monitoring NATS Streaming
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
```
-m, --http_port PORT HTTP PORT for monitoring
-ms,--https_port PORT Use HTTPS PORT for monitoring (requires TLS cert and key)
```
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:
```
nats-streaming-server -m 8222
```
you should see that the NATS Streaming server starts with the HTTP monitoring port enabled:
```bash
[19339] 2019/06/24 15:02:38.251091 [INF] STREAM: Starting nats-streaming-server[test-cluster] version 0.15.1
[19339] 2019/06/24 15:02:38.251238 [INF] STREAM: ServerID: 0Z2HXClEM6BPsGaKcoHg5N
[19339] 2019/06/24 15:02:38.251243 [INF] STREAM: Go version: go1.12
[19339] 2019/06/24 15:02:38.251862 [INF] Starting nats-server version 2.0.0
[19339] 2019/06/24 15:02:38.251873 [INF] Git commit [not set]
[19339] 2019/06/24 15:02:38.252173 [INF] Starting http monitor on 0.0.0.0:8222
[19339] 2019/06/24 15:02:38.252248 [INF] Listening for client connections on 0.0.0.0:4222
(...)
```
You can then point your browser (or curl) to [http://localhost:8222/streaming](http://localhost:8222/streaming)
### Enabling from the configuration file
To start via the configuration file you can define the monitoring port as follows:
```conf
http_port = 8222
```
Then use the `-sc` flag to customize the NATS Streaming configuration:
```bash
nats-streaming-server -sc nats-streaming.conf -ns nats://demo.nats.io:4222 -SDV
```
Confirm that the monitoring endpoint is enabled by sending a request:
```bash
curl 127.0.0.1:8222/streaming/channelsz
{
"cluster_id": "test-cluster",
"server_id": "dXUsNRef1z25NpcFmZhBNj",
"now": "2019-06-24T15:18:37.388938-07:00",
"offset": 0,
"limit": 1024,
"count": 0,
"total": 0
}
```
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.