# Drop-in: enable the embedded NATS server monitoring HTTP endpoint so a local # metrics scraper can read /varz, /connz and /jsz for server-level metrics # (msgs/s, connections, KV bucket msgs, RAFT leader per stream, restarts). # # ADDITIVE and minimal: it only sets one environment variable; the base unit # (membershipd-cluster.service) is otherwise unchanged. # # UNIBUS_NATS_MONITOR is DECOUPLED from UNIBUS_NATS_DEBUG: it opens the monitoring # endpoint WITHOUT enabling the verbose nats-server debug log, so no room subjects # or routing metadata are written to journald (keeps the hardened posture, issue # 0007). Do NOT use UNIBUS_NATS_DEBUG in production just to get the endpoint. # # The endpoint binds 127.0.0.1:8222 ONLY — the binary hardcodes the loopback bind, # so it is never reachable from the network and needs no auth. The scraper runs on # the same host and reads it over loopback. # # Requires the 0.11.0+ membershipd binary (the one that honors UNIBUS_NATS_MONITOR). # Install on a node: # sudo mkdir -p /etc/systemd/system/membershipd-cluster.service.d # sudo cp nats-monitor.conf /etc/systemd/system/membershipd-cluster.service.d/ # sudo systemctl daemon-reload && sudo systemctl restart membershipd-cluster # # Restarting a node restarts its JetStream RAFT member, so roll ONE node at a time # and wait for R3 reconvergence (followers 2/2) before touching the next. See the # "NATS server metrics" section of this directory's README for the full runbook. [Service] Environment=UNIBUS_NATS_MONITOR=1