Guides

Marzban node monitoring: what breaks and how to check

The Marzban panel controls each marzban-node over a REST API on port 62050 with mutual TLS, and talks to the node's Xray through its gRPC API on port 62051. A node shows as connected when those two calls work, which does not mean users can reach the node's inbounds. Monitor a Marzban fleet in three layers: node status from the panel API, a real connection through each node's inbounds from outside, and the subscription endpoint. Plan around the project's state too, because the last Marzban release is v0.8.4, from January 2025.

Tahir Mehmood11 min read

I read the source for this post rather than the docs, because the docs lag behind the code in a few places. Everything is checked against Marzban v0.8.4 and marzban-node v0.5.2, the latest tagged releases of Gozargah/Marzban and Gozargah/Marzban-node.

Is Marzban still maintained?

Development has slowed, and there has been no release for almost two years. These are the facts from GitHub as of 1 November 2026:

  • The latest Marzban release on the releases page is v0.8.4, published 9 January 2025. v0.8.0 to v0.8.4 all came out that same week.
  • The latest marzban-node release is v0.5.2, published 22 March 2025. The install scripts repository was last changed in March 2025.
  • The dev branch received a burst of commits in June 2026, and a branch that rewrites the dashboard has commits as recent as 1 November 2026. None of this has reached a release.

So the code is not abandoned, but fixes do not ship. In practice that means three things. Pin the versions you run, so a fresh install matches the rest of the fleet. Test a new Xray-core release on one node before you roll it out, because nobody upstream tests that combination for you. And do not wait for a release to fix a bug that hurts you today.

When you search "marzban latest version", the answer today is v0.8.4 for the panel and v0.5.2 for the node.

How does the Marzban panel talk to a node?

The panel pushes the whole Xray config to each node and then controls the node's Xray remotely. A node is a Docker container (gozargah/marzban-node, host networking, data in /var/lib/marzban-node) with two ports:

Port Default What uses it
SERVICE_PORT 62050 the node's control API: connect, start, stop, restart, logs
XRAY_API_PORT 62051 the node's Xray gRPC API: add and remove users, read traffic stats

The control API runs in one of two modes, set with SERVICE_PROTOCOL. REST is the default in marzban-node 0.5.x. Older docs still say rpyc, which was the default before December 2024. In REST mode the node uses mutual TLS:

  • The node makes its own self-signed certificate (ssl_cert.pem, ssl_key.pem) the first time it starts.
  • It trusts exactly one client certificate: the panel's, which you copy from Node settings, Show Certificate in the dashboard into the file that SSL_CLIENT_CERT_FILE points to. The install script uses /var/lib/marzban-node/cert.pem.
  • When the panel connects, it fetches the node's certificate and pins it for that session.

A node connection then goes like this:

  1. The panel calls /connect and gets a session ID.
  2. It calls /start with the full Xray config. The node starts its own Xray binary and waits up to 3 seconds for the line Xray <version> started in the log.
  3. The node adds an API inbound on 62051, protected with its own certificate, and a routing rule that accepts API calls only from the IP address that connected to the control API.
  4. The panel then manages users through the Xray API.

Every 10 seconds (JOB_CORE_HEALTH_CHECK_INTERVAL), the panel checks each connected node: is Xray started, and does a stats call through the Xray API answer within 2 seconds. If either fails, it restarts that node's Xray. If the node is not connected, it tries to connect again.

Look at what that health check covers: the control API and the Xray API, both on ports only the panel uses. It never touches an inbound port.

What do the node statuses mean?

Each node has one of four statuses, plus a message and an xray_version:

Status Meaning
connected the panel holds a session and the last health check passed
connecting a connection attempt is in progress, for example right after the panel starts
error the last connect or restart failed; message holds the error text
disabled an admin turned the node off; the health check skips it

The message field is the most useful one in the whole panel for node problems. When Xray fails to start on the node, it holds a pair like (503, '<last Xray log line>'). When the panel cannot reach the node, it holds the Python error text, such as a refused connection, a timeout or an SSL error.

How do I check node status from a script?

Ask the panel's API for the node list and report the result to a heartbeat. You need a token first. Marzban issues one from POST /api/admin/token with a form login:

#!/usr/bin/env bash
# Ping a heartbeat when every enabled Marzban node is connected, report /fail when one is not.
set -uo pipefail
PANEL="${PANEL:-https://vpn.yourdomain.com:8000}"

token=$(curl -fsS -m 10 -X POST "$PANEL/api/admin/token" \
  --data-urlencode "username=$MARZBAN_USER" \
  --data-urlencode "password=$MARZBAN_PASS" | jq -er .access_token) || exit 1

bad=$(curl -fsS -m 10 -H "Authorization: Bearer $token" "$PANEL/api/nodes" |
  jq -r '.[] | select(.status | IN("connected", "disabled") | not)
         | "\(.name) \(.status) \(.message // "")"') || exit 1

if [ -n "$bad" ]; then
  echo "$bad"
  curl -fsS -m 10 --retry 3 -o /dev/null "$HEARTBEAT_URL/fail"
else
  curl -fsS -m 10 --retry 3 -o /dev/null "$HEARTBEAT_URL"
fi

Run it every minute from cron on a machine that is not the panel. If the panel is down or the login fails, the script exits without calling the heartbeat, and the heartbeat alerts when its period runs out. The /fail suffix reports an immediate failure. Healthchecks.io and TunnelHQ heartbeats both accept it.

Three things in Marzban matter for this script:

  • Login notifications. Marzban sends a Telegram or Discord message for every successful admin login, unless the client IP is in LOGIN_NOTIFY_WHITE_LIST. Add the checker's IP there, or you get a login alert every minute.
  • Sudo access. GET /api/nodes is open to sudo admins only. Create a separate sudo admin for the script, so you can change its password without touching yours, and keep its credentials in a file only the cron user can read.
  • Token lifetime. Tokens expire after JWT_ACCESS_TOKEN_EXPIRE_MINUTES (1440 by default). The script logs in on every run, so it never holds an old token. Do not set that value to 0 just to keep one token forever: it applies to every admin.

You need this script because Marzban itself does not alert on nodes. Its Telegram and Discord reports cover users and logins, and its webhook only sends user events (user_created, user_updated, user_deleted, user_limited, user_expired, user_disabled, user_enabled). A node can sit in error for days and nobody is told.

Why does a node show error?

These are the causes I check, roughly in order of how often I see them:

  1. The node host or container is down. marzban-node status and marzban-node logs on the node show it. The message is a connection error or timeout.
  2. Ports 62050 or 62051 are closed between the panel and the node. Open them only to the panel's IP, and remember that the inbound ports need a separate rule open to everyone.
  3. The panel certificate changed. The client certificate lives in the panel's database. A panel reinstalled with a fresh database has a new one, and every node still trusts the old one. The TLS handshake fails and message shows an SSL error. Copy the new certificate from Node settings into each node's cert file and restart the node.
  4. REST mode without a client certificate. The node logs SSL_CLIENT_CERT_FILE is required for rest service. and exits, and Docker restarts it over and over.
  5. Two panels control the same node. A node takes orders from one panel at a time. When a second panel connects, the node logs New connection from <ip>, Core control access was taken away from previous client. and stops Xray. The first panel's next call gets Session ID mismatch., it reconnects, and the two panels take the node from each other again and again. This happens when a test panel is pointed at production nodes. The supported way to share a node is a separate node container per panel, each with its own ports and certificate.
  6. Xray on the node is older than the config. The node runs its own Xray binary, and the panel builds one config for every node. If you add a transport or option that the node's Xray does not know, the start fails and message holds Xray's error line. Compare xray_version across nodes, and update the node's core with marzban-node core-update, which places the binary in /var/lib/marzban-node/xray-core/.

Why can a connected node still fail users?

Because connected only covers the two management ports. Everything users touch is outside the health check:

  • Inbound ports blocked. A firewall rule allows 62050 and 62051 but not 443 or 8443. The node is connected and useless.
  • TLS certificates on nodes. The panel reads each inbound's certificateFile and keyFile on the panel host and sends their contents inside the config. A certificate renewed on the node itself changes nothing. A certificate renewed on the panel reaches the nodes only when the panel next restarts them, for example after a config change or a node reconnect. So the panel can hold a fresh certificate while nodes still serve the expired one.
  • The INBOUNDS setting. Since marzban-node 0.5.0, a node can run only some inbounds (INBOUNDS="VLESS TCP REALITY, VMESS TCP NO TLS"). But Add this node as a new host for every inbound creates a host entry for every inbound. Users then get links to inbounds that node does not run, and those links always fail. Remove the host entries that do not apply.
  • REALITY and TLS settings that work on one node but not another, for example a REALITY target that is reachable from one country but not from another.
  • The node's IP is blocked in the users' country. The panel cannot see that from where it sits.

The panel host also runs a full Xray core with the same inbounds. Treat it as one more node when you test.

How do I test each node's inbounds from outside?

Use a monitoring user's subscription: it already lists one link per inbound per host. When you add a node with the new-host option, its host remark is <node name> ({USERNAME}) [{PROTOCOL} - {TRANSPORT}], so every link name says which node and which inbound it belongs to.

  1. Create a user called monitor with no expiry and no data limit, with every inbound you serve enabled.
  2. Fetch its subscription with the /v2ray suffix. That forces the base64 link list whatever user agent you send.
  3. Decode it, and test each link with a real handshake from a host outside your network.
SUB='https://vpn.yourdomain.com:8000/sub/your-monitor-token/v2ray'
curl -fsS "$SUB" | base64 -d | grep -c '://'

That count should equal your inbounds times your hosts. To list each link's protocol and name, VMess included, use the subdecode.py script from How to decode a V2Ray subscription link. For the testing loop itself, the approach in 3x-ui monitoring works here too: run each link with Xray or sing-box and fetch a URL through it. A failure on one node's links and success on the others points at that node. A failure on one inbound across every node points at the config.

How do I check the Marzban subscription endpoint?

Request it like a client and check three things: the status, the headers, and the link count.

SUB='https://vpn.yourdomain.com:8000/sub/your-monitor-token/'
curl -sS -D - -o /dev/null "$SUB"

A healthy response is 200 with these headers: subscription-userinfo, profile-update-interval (from SUB_UPDATE_INTERVAL, 12 hours by default), profile-title (base64 encoded), support-url, profile-web-page-url and content-disposition. Things to know when it is not healthy:

  • 404 means the token is not valid now. Marzban returns the same 404 for an unknown token, a token issued before the user was re-created, and a token issued before the subscription was revoked. If your monitor user's link starts failing with 404, check whether someone revoked it.
  • HTML instead of links. Any request with Accept: text/html gets the info page. Do not send that header from a check.
  • Relative links in the dashboard. If XRAY_SUBSCRIPTION_URL_PREFIX is empty, the subscription URL Marzban builds is only a path (/sub/<token>). Set it to your public https:// address.
  • /sub/<token>/info returns the user as JSON, including status, expiry and used traffic. It is handy for checking that the monitor user is still active.

How do I update or uninstall Marzban and its nodes?

The install scripts add two commands, marzban on the panel and marzban-node on each node:

Task Panel Node
status and logs marzban status, marzban logs marzban-node status, marzban-node logs
update the app marzban update marzban-node update
change the Xray version marzban core-update marzban-node core-update
back up marzban backup, or marzban backup-service for a schedule nothing to back up but the cert file
remove marzban uninstall marzban-node uninstall

The panel's files live in /opt/marzban (including .env) and its data in /var/lib/marzban. Back up both before an update or an uninstall. The backup service zips them and sends them to your Telegram bot, and can run every hour.

The latest Docker image is only built when a version tag is pushed, so with no new release, marzban update brings you the same v0.8.4 image. Changing Xray versions is the update that actually changes behaviour, so do it one node at a time and run the outside check after each.

A monitoring plan for a Marzban fleet

What How How often Alert when
Node status /api/nodes script with a heartbeat 1 minute any enabled node not connected, or no answer
Every inbound on every node real connection through the monitor user's links, from outside 1 to 5 minutes the same link fails twice in a row
Subscription endpoint status, headers, link count 5 to 15 minutes not 200, missing headers, fewer links
Certificates openssl s_client against each node's TLS inbounds daily less than 14 days left
Xray versions xray_version from /api/nodes after every change nodes differ from each other
Backups heartbeat after marzban backup daily heartbeat missed

Full disclosure: TunnelHQ covers the second and third rows. Give it the monitor user's subscription URL and it adds every link behind it, keeps the list in sync as nodes come and go, and completes the real protocol handshake with each one from outside, opening an incident when a node's inbounds stop answering. Its heartbeats (part of Uptime) fit the first and last rows. Every plan has a 14-day free trial.