Monitoring the NATS Server
The NATS server exposes a read-only HTTP endpoint on 127.0.0.1:8222. It answers the questions that matter: is the broker up, is TLS on, and is anything backing up. Nothing can be changed through it and no message contents are exposed. You must be signed in to the machine to reach it. See NATS Ports and Firewall Requirements.
Is Messaging Healthy?
1. Is the broker responding? This is the same probe JAMS uses before it starts listening.
Invoke-RestMethod http://127.0.0.1:8222/healthz
status: ok means the server and JetStream are up. Anything else, including a connection failure, means the JAMS services that depend on it are not working either.
2. Is TLS on, and are the JAMS services connected?
Invoke-RestMethod http://127.0.0.1:8222/varz |
Select-Object server_id, version, port, tls_required, tls_verify, connections, in_msgs, out_msgs
(Invoke-RestMethod "http://127.0.0.1:8222/connz").connections |
Format-Table name, uptime, pending_bytes, in_msgs, out_msgs
tls_required and tls_verify should both be True. The connections should include JAMS NATS Sender and JAMS NATS Listener.
nats server info and nats server report do not work against a JAMS NATS server. They query through a system account, and the JAMS configuration defines none. They fail with ensure the account used has system privileges and appropriate permissions, which is expected. Use this endpoint for server version, TLS settings, and connections, and the CLI for JetStream state. See Using the NATS Admin CLI.
3. Is anything backing up? This is the closest thing to checking queue depth under MSMQ.
$js = Invoke-RestMethod "http://127.0.0.1:8222/jsz?streams=1&consumers=1"
$js.account_details.stream_detail |
Select-Object name, @{n='Messages';e={$_.state.messages}}, @{n='Bytes';e={$_.state.bytes}}
On a healthy system JAMS_RELIABLE sits at or near zero messages. A message is removed once the Scheduler acknowledges it, so a sustained count means messages are arriving faster than they are processed, or are not being processed at all.
For per-consumer detail, use the NATS Admin CLI.
What Each Endpoint Shows
| Endpoint | Shows |
|---|---|
/healthz | A single up or down answer. |
/varz | Server version, ports, TLS settings, uptime, message totals, slow-consumer counts. |
/connz | Connected clients by name, with per-connection message and pending-byte counts. |
/jsz?streams=1&consumers=1 | JetStream state: streams, message counts, bytes on disk, consumer backlogs. |
/subsz | Active subscriptions. Confirms the Scheduler is subscribed to jams.transient.>. |
Append ?help=1 to any of them for the query options, or open http://127.0.0.1:8222/ in a browser on the machine.
Disk
Reliable messages are stored under C:\ProgramData\JAMS\NATS.
"{0:N1} MB" -f ((Get-ChildItem "C:\ProgramData\JAMS\NATS" -Recurse -File |
Measure-Object Length -Sum).Sum / 1MB)
The stream is capped at 1 GiB. On a working system the folder stays small. Growth toward the cap always means work is not being consumed. Investigate the Scheduler rather than raising the cap.
When JAMS_RELIABLE reaches 1 GiB it rejects new messages rather than discarding unprocessed ones. Senders retry and then report the failure, so a full stream surfaces as errors in the JAMS logs. Treat sustained growth as an incident.
Exclude the folder from real-time antivirus scanning. Backing it up is of limited value: it holds only messages not yet processed, and the JAMS database is the system of record.
JAMS-Side Diagnostics
The Scheduler keeps the messaging diagnostics it had under MSMQ:
| Diagnostic | Reports |
|---|---|
RequestsPerSecond performance counter | Reliable messages received per second. |
RequestPerformance trace | Time each message spent waiting and being processed. |
Logs
| Log | Location | Look here for |
|---|---|---|
| NATS server log | ...\Scheduler\NATS\nats-server.log | Startup, the port bound, TLS status, connection and authorization errors |
| JAMS Scheduler log | ...\Scheduler\JAMSScheduler.log | Message handling, redelivery and duplicate-skip messages, MSMQ drain results |
DBUpdate.log | ...\Scheduler\DBUpdate.log | Certificate creation, NATS configuration generation, service restarts during setup |
$log = "C:\Program Files\MVPSI\JAMS\Scheduler\NATS\nats-server.log"
# Which port was bound, and is TLS on?
Select-String $log -Pattern "Listening for client connections|TLS required|Server is ready"
# Anything rejected?
Select-String $log -Pattern "authorization|TLS handshake|certificate|error" | Select-Object -Last 20
The NATS log rolls at 10,000,000 bytes. JAMS does not prune it, so include it in whatever cleanup you apply to the other JAMS logs.
The Simplest Check
Submit a Job and confirm it runs and completes. That exercises the reliable path in both directions and the transient path that updates the Monitor view.