Skip to content

Servers

A server is a Linux machine that runs the TunnelHQ agent. Every 30 seconds the agent reports the server’s CPU, memory, disk, network, and load. On a VPN server it also reports the users per protocol and per country, and the state of the VPN services it watches. Web servers, databases, and other services are reported too.

Servers have their own section, Servers in the sidebar. Servers are in beta, marked Beta in the sidebar and beside the page’s title, and free during the beta. TunnelHQ links each server to the tunnels and Uptime checks that test it, and alerts you when a server stops reporting, a service stops, or a limit you set is crossed.

  1. Go to Servers and click Add server. You can give the server a name and a group now, or later on its page. Keep the agent up to date automatically is ticked by default. Tick Count no online users on this server for a server under a no-log policy; see Counting online users.

  2. Copy the install command and run it on the server as root. It looks like this:

    Terminal window
    curl -fsSL https://app.tunnelhq.com/agent/install.sh | sh -s -- --key thqa_… --name 'web-1' --group 'Production' --auto-update
  3. The server shows up in TunnelHQ within a minute. Until its first report it reads Connecting, and the box turns live in place when it arrives.

A workspace can have up to 100 servers with the agent, counted across all its projects. A server you remove doesn’t count. Past that, TunnelHQ refuses a new server, and nothing is installed: “This workspace already has 100 servers with the agent, the most for now. Remove one you no longer use to add another.”

The installer needs:

  • Linux that boots with systemd. It doesn’t run in a container or a chroot.
  • An x86-64 or ARM (arm64) processor.
  • Root. If you’re signed in as another user, run sudo -i first, then the same command.
  • curl or wget, and sha256sum.

It downloads the agent, checks it against its SHA-256 checksum, and registers the server with TunnelHQ. If any step fails, nothing is installed.

Option What it does
--name A name for the server, up to 150 characters.
--group A group for the server, up to 100 characters.
--logs Lets TunnelHQ ask for the services’ error and state log lines, cleaned on the server first. Without it, the agent sends no log lines at all.
--auto-update TunnelHQ updates the agent by itself, a day after each release. The copied command has it when Keep the agent up to date automatically is ticked.
--no-updates Leaves the updater out. The agent is then updated only by running the install command again.
--no-users Counts no online users on this server, whatever the project’s setting. It’s kept on the server: running the installer again keeps it, and TunnelHQ can never turn it back on. Needs agent 1.14.0; with an older agent build, nothing is installed.
--count-users Counts online users again, after an earlier --no-users. Needs agent 1.14.0.

A name or group keeps letters, digits, spaces, and . _ - ( ), and is used only when the server has none in TunnelHQ yet.

The command holds your project’s install key, which starts with thqa_. It can only add servers to the project, and the same command works on every server. Each server then gets its own token, which can only report for that server.

A new install key stops the command people already copied. Servers already installed keep reporting. Make one from the link in the Add a server dialog, with thq hosts install --rotate, or through the API. It needs a role that can edit the project.

A server’s System tab shows its agent’s version. When a newer release is out, Update agent appears beside it. The Servers list says how many agents are older, with Update all.

Updates, on the same tab, chooses how the server’s agent updates: Automatically, a day after each release, or By hand, from this page. New servers follow the project’s default, Update agents automatically under Integrations, Server agent, which is on.

How an update stays safe:

  • The agent never writes its own program file. It leaves a request, and a separate updater, started by systemd, does the work.
  • The updater downloads the release and checks TunnelHQ’s signature against the key built into the agent already on the server. It takes only a newer release.
  • It tries the new agent once, swaps it in while keeping the old one, and puts the old one back if the new agent doesn’t stay up.
  • Automatic updates start a day after a release.

A server installed before agent updates came has no updater yet, and its Updates row says so. Run the install command on it once more, and it updates from TunnelHQ after that. A server installed with --no-updates is updated by running the install command again. Running the install command again always keeps the server’s place in TunnelHQ, with its name, group, links, and history.

Updating an agent, or switching a server’s automatic updates, needs a role that can edit monitors. Changing the project’s default needs a role that can edit the project.

To remove a server from TunnelHQ, open it and choose Remove server. Its agent is cut off at its next report, and its history goes. Removing needs a role that can delete monitors.

The agent stays installed on the machine until you remove it there. The command is on the server’s System tab:

Terminal window
systemctl disable --now tunnelhq-agent; systemctl disable --now tunnelhq-agent-update.path 2>/dev/null; rm -rf /usr/local/bin/tunnelhq-agent /usr/local/bin/tunnelhq-agent.prev /usr/local/bin/tunnelhq-agent.new /etc/tunnelhq-agent /var/lib/tunnelhq-agent /etc/systemd/system/tunnelhq-agent.service /etc/systemd/system/tunnelhq-agent-update.path /etc/systemd/system/tunnelhq-agent-update.service; systemctl daemon-reload

The agent only reads. Its code never changes your VPN, firewall, kernel, or swap. TunnelHQ can ask it to run named checks that read, such as the services that failed, the ports the server listens on, the firewall’s rules, or the processes using the most memory. AI SRE uses them when it looks into an outage, and when something needs fixing, it gives you the command to run. What a check of logs, VPN settings, or process lists read is shown only to roles that can edit monitors, because a process’s command line can hold a password.

Before anything leaves the server, the agent removes:

  • IP addresses, except the server’s own and networks that cover more than one address.
  • Email addresses and web addresses.
  • User names, and WireGuard and AmneziaWG public keys.
  • Keys, passwords, tokens, and private key blocks.
  • A country’s user count, when the country has fewer than 11 users.

The installer also locks the agent’s service down with systemd. The agent runs with /etc, /usr, and /var read-only except its own state folder, the kernel’s settings read-only, no module loading, no new privileges, and no setuid. It keeps CAP_NET_ADMIN, which reading WireGuard, conntrack, and iptables needs; the agent’s code never writes a firewall rule.

Log lines about a single connection are counted, and only their common shapes are sent, with every digit masked. Report fields TunnelHQ doesn’t keep are dropped when the report arrives, and check results are kept for 30 days.

When a server counts no online users, the agent reads no address, looks nothing up by country, and sends no user fields at all. An agent from before this setting keeps counting on the server, and TunnelHQ discards what it sends, until you update it; the server’s page says which of the two it is.

The full list of what the agent sends, and what TunnelHQ keeps, comes from the agent build itself. It’s at app.tunnelhq.com/agent/what-leaves, with no sign-in.

Status Means
Online The last report is at most 60 seconds old.
Stale The last report is 60 to 90 seconds old.
Offline No report for more than 90 seconds (three missed reports), or the server never reported.
Connecting Installed in the last 3 minutes, with no report yet.

A server that never reported doesn’t alert: it has no normal state to compare with.

A VPN server counts its online users, by protocol and by country, unless you switch it off. Switch it off for a no-log policy:

  • For every server of the project: Count online users, under Integrations, Server agent. It’s on by default. Switching it off, or back on, needs a role that can edit the project, and switching it back on asks first.
  • For one server: install it with --no-users, or tick Count no online users on this server in the Add server box. That’s set on the server itself, so the project’s setting can’t turn it back on, and running the install command again keeps it. It needs agent 1.14.0.

While a server counts no users, no address is read or looked up, and nothing about users leaves the server. Its users read Not counted, never 0, on the Servers list, its page, its By country table, and a tunnel’s Server tab. Its Users chart, its country table, and the Users from a country alert stop for it, and the alert shows as off with the reason. Counts from before stay in its history.

An agent from before this setting keeps counting on the server until it’s updated, and TunnelHQ discards what it sends. The server’s page says so.

Open a server to see it in full. It has four tabs:

  • Overview: its readings now, with charts.
  • Events: its incidents of the last 30 days. Open incident opens an incident’s own page. See Server incidents.
  • Alerts: its alert settings.
  • System: the operating system, kernel, processor, memory, uptime, addresses, agent version, the uninstall command, and the certificate its OpenConnect service serves.

Readings are kept every 5 minutes for 7 days. Press J and K to move between servers in the list’s order.

Under the server’s name are its address, its operating system, and the cloud it runs on, such as AWS, t3.small, eu-central-1a. The agent reads it from the cloud’s own instance metadata service on AWS, Google Cloud, Azure, DigitalOcean, Hetzner Cloud, and Oracle Cloud: the provider, the machine type, the region, and the zone. DigitalOcean and Hetzner Cloud give no machine type. TunnelHQ never keeps an account, project, or instance ID.

A server on another host, or with an older agent, has no cloud line.

On a VPN server’s Overview, By country lists each country’s users over the last 7 days, its users now, and its blocks of the last 90 days. A block is a time the server’s users from one country were gone while its VPN services ran: 30 or more before, under 11 after. Blocks are kept whether the server’s country alert is on or off.

A country with fewer than 11 users counts under Other, and a stretch under 11 is hatched on its line. No count under 11 is ever shown, so no one can be picked out. Other is rounded to the nearest 5, and the server’s total and its users by protocol are rounded with it, so no subtraction gives back a small country’s count.

When the agent can’t read the users, for example when OpenConnect’s occtl refuses it, the server reads Users unknown, never 0. Agent 1.14.5 counts AmneziaWG users as their own protocol, apart from WireGuard; on a server running AmneziaWG, run the install command once more.

A server with no VPN services, such as a web or app server, has no users by country and no blocks. A server that runs a VPN service but isn’t a VPN server, such as a hosting server with OpenVPN installed, can be marked so with vpn: false in the API, or thq hosts update --vpn off. Its page has no By country, and the API says “This server runs no VPN services, so it has no users by country and no blocks.”

When a server’s OpenConnect service serves a certificate, the System tab has a Certificate group: what serves it, when it expires, the names it covers, and whether the file on disk matches. The agent reads it every hour. View details opens the full certificate:

  • Its common name, who issued it, when it’s valid from and until, its serial number, key, and TLS version, and when TunnelHQ first saw it.
  • The names it covers, and its chain of trust.
  • Seven checks, each passing, failing, or not known:
Check Passes when
Within its validity period Today is between its valid from and valid until dates.
Covers the tunnel’s address Every linked tunnel or check that uses a name is covered by one of the certificate’s names.
Issued by a trusted authority The chain leads to an authority the server trusts.
Complete chain The server sends every certificate between its own and the authority.
Modern TLS version It’s served over TLS 1.2 or 1.3.
Strong signature and key An RSA key of 2048 bits or more, an ECDSA key of P-224 or more, or an Ed25519 key, and no SHA-1 or MD5 signature.
File on disk The certificate file on the server is the one OpenConnect serves, not a renewed one waiting for a reload.

The agent fetches nothing from the internet, so there’s no revocation check.

You can rename a server, put it in a group, and give it up to 10 tags. Each tag is 1 to 32 letters, digits, spaces, dots, dashes, or underscores. A server with VPN services gets the vpn tag by itself.

A tunnel or check links to a server by itself when it points at one of the server’s public addresses, or when its host name is the server’s hostname. Where TunnelHQ looks:

Monitor What it points at
Tunnel Its server address.
Website and keyword checks The host in the URL.
Ping and port checks The host.
DNS checks The DNS server it asks.
Heartbeats The address its calls come from, when it’s one server’s public address and no other server’s. The first such call links it; the link moves to another server after 3 calls in a row from there.

A host name is looked up, so a link follows an address change. Private addresses are ignored, because many servers share them, so a monitor aimed at one is linked by hand. A monitor can link to several servers.

Link a monitor by hand when TunnelHQ can’t tell from the address, for example behind a load balancer or a CDN. Unlinking keeps a monitor away from a server even when its address matches. A server’s Linked column says how each one was linked: by hand, by address, by hostname, or by its calls.

What TunnelHQ is sure of, it links by itself. What it only thinks, it suggests: N suggestions · Review, beside Add server, opens them grouped by kind, and they show on a server’s page, a tunnel’s Server tab, and at the end of an install too. Each one says why, with the facts behind its (i).

Suggestion Accept Turn down
The same machine installed twice: an old copy of a newer server Remove old copy: the newer one takes what it lacks of the old one’s name, group, alert settings, tags, links made by hand, and choices to keep monitors apart, and the old one is removed with its history. Only while the newer one reports and the old one has been quiet a day Keep both
A tunnel or check added twice: same address and settings, run from the same locations at the same interval, alerting the same channels Delete copy Keep both
A tunnel or check linked to no server tests an address next to exactly one server’s Link Not the same
A tunnel, check, or heartbeat linked to no server has exactly one server’s name in its own Link Not the same
A heartbeat whose calls come from an address several servers share Link the servers it runs on Neither

A suggestion you turn down doesn’t come back. Any decision but a removal can be undone for an hour. Each kind but a shared heartbeat has one action for all of it in Review, such as Link all 4 by address or Delete all 2 copies. Linking needs a role that can edit monitors, and a removal one that can delete them. You see suggestions only about monitors you can see.

A linked tunnel lets TunnelHQ tell a server that’s down from a test that no longer matches it. When the tunnel’s test fails while the server’s users stay connected, the tunnel reads Degraded on the server’s page, with Test fails, users fine and Update config or Sync subscription under it. See When our test fails, not the server.

Alert Default Setting Opens when Closes when
Stopped reporting On, after 90 seconds 90 to 3,600 seconds No report for that long, from a server that reported before It reports again for 5 minutes
Service stopped On, after 60 seconds 30 to 3,600 seconds A watched VPN service went from active to inactive, and stayed inactive that long It’s active again for 5 minutes
CPU, memory, disk Off until you add one Above a percent (1 to 100) for 60 to 3,600 seconds, 300 by default Every report for that long is above the level It’s at or below the level for 5 minutes
Users from a country Off On or off A country’s 30 or more users drop under 11 while the VPN services run and users from other countries stay Every server it names has 11 or more users from that country again, in two 5-minute readings in a row
Certificate On, 14 days 7, 14, 21, or 30 days, or off The certificate the server’s OpenConnect service serves has fewer days left. Needs agent 1.7.0. A renewed certificate with enough days left is served for 5 minutes
Its internet keeps breaking Off, 3 times in an hour Once in an hour, 3 times in an hour, or 3 times in a day The server couldn’t reach the internet that often. Needs agent 1.11.0. Fewer breaks than that in the hour or the day, for 5 minutes
A reading you watch None until you add one Up to 10 per server. See Watches. Users, traffic, CPU, memory, or disk above or below your value for that long, or users falling by your percent The reading is back on the right side of the value for 5 minutes

Changing a server’s alerts needs a role that can edit monitors. On the Alerts tab, the certificate alert is Certificate expires soon, shown for a server whose OpenConnect service serves a certificate. The internet alert is Its internet keeps breaking. A server with an older agent says “Needs agent 1.11.0 or newer to see its internet”.

A full outage is already Stopped reporting: the agent can’t report without internet. This alert is for the short breaks in between, which look like a server going down again and again.

On every report, the agent tries three addresses on the internet. A break is a run of 5-minute readings in which it couldn’t reach at least one of them. Breaks during a Stopped reporting alert that went out aren’t counted again. The message gives the times, how long the longest break lasted, and that this is usually the hosting provider’s network.

A watch is an alert of your own on one reading. On the Alerts tab, choose Add an alert on a reading. To say it in a sentence instead, choose Or describe it to AI SRE, and AI SRE offers the same rule. The form takes:

Field Takes
Reading Users, Traffic (Mbps, in and out together), CPU, Memory, or Disk
When Above, Below, or for users Falls by
Value Users or Mbps from 0 to 1,000,000, or a percent from 1 to 100. For Falls by, a percent from 10 to 100.
For (minutes) How long it holds before it alerts, 1 to 60 minutes, 10 by default. For Falls by it’s Within (minutes), the window the fall happens in.
Until Its last day. Empty means always.
Send to All alert channels, or Channels I tick

A watch is checked on every report, without AI. Falls by alerts at once when users drop by that percent from the most they had within the window, counted only from 10 users or more. It stays open until users are back above the line they fell through.

A watch past its last day, switched off, or removed closes what it had open quietly, with no Resolved message.

Channels I tick sends it to those channels only, and a webhook channel can be one of them. All alert channels sends it where the server’s other alerts go: see Where messages go.

One message for servers that fail together

Section titled “One message for servers that fail together”

Servers that fail for the same reason at the same time share one message, and one Resolved message goes when every server it named is back:

  • Stopped reporting groups the project’s servers. The message waits until their linked tunnels and checks have run, between 1 and 5 minutes, so it can say what they show: “Its 6 tunnels still pass, so the server is up and its agent stopped”, or “Its 6 tunnels fail too, so the server or its network is down.”
  • Service stopped waits a minute and groups the servers where the same service stopped.
  • Certificate groups every server serving the same certificate, with one message and one Resolved for all of them. The message gives the expiry date and the names the certificate covers. When the file on disk was renewed but OpenConnect still serves the old one, it says to run systemctl reload ocserv.
  • CPU, memory, disk, Its internet keeps breaking, and each watch are one alert per server.
  • Users from a country is one alert per project and country. It waits 5 minutes, so servers that lose the same country a little later are in the same message. A server that loses it after the message went joins without another message, and the Resolved waits for it too.

Apart from users from a country, a server that fails later opens its own message, so the times a message gives are true of every server it names.

This alert is for a VPN server blocked in one country. It opens only when the drop is unusual for that server:

  • The country averaged at least 30 users over the hour before, and is now under 11 in the last two 5-minute readings.
  • Every watched VPN service is still running, and users from other countries are steady.
  • Its linked tunnels don’t all fail. When they do, the server is down, not blocked, and the tunnels’ alert says so.
  • It’s not a quiet hour: when the country had fewer than 30 users at the same time last week, there’s no alert.
  • With neither last week’s numbers nor another server with users from the country to compare with, there’s no alert.

When every server with users from the country loses them at once, TunnelHQ looks at their hosting providers, taken from the Hosting provider of their linked tunnels:

  • At two or more providers, it’s a shutdown, not a block. It’s kept in each server’s blocks and told to nobody.
  • At one provider, or when the providers aren’t known, the alert says that a block can’t be told from a shutdown.

The alert opens when a server that lost the country has the alert on. Every server of the project that lost it then joins the incident, so the message and the incident name them all. Each drop is kept in the server’s blocks whether its alert is on or off.

To the alert channels of the server’s linked tunnels and checks, or to every active channel in the project when none are linked. Server alerts never go to webhook channels, except a watch that names its channels. TunnelHQ restarting pages nobody, and when almost every server stops reporting at once, TunnelHQ treats it as its own problem and waits.

Each server alert is a server incident, with an ID like hin_12. Servers that fail for the same reason at the same time share one incident, as they share one message.

A server’s incidents are on its Events tab, and on the Incidents page under All incidents or Servers. Each one has its own page. It shows its servers and whether each is back, and a timeline: when servers joined it, where its messages went, who acknowledged it, notes, and how it closed.

For users from a country gone, the page also shows each server’s users before and when they left, the servers that still have users from that country, what your tunnels’ tests saw, the hosting providers, and last week’s users at this hour.

What you can do on it:

  • Acknowledge shows the team that you have it, with an optional note. An incident is acknowledged once.
  • A note for the team goes on its timeline, while it’s open or after. A note can be up to 2,000 characters.
  • Resolve is only for users from a country gone. It closes the incident and changes nothing on the servers. Their blocks stay in each server’s history until the users come back, and no Resolved message goes out.

Every other server incident closes by itself once the server is back. Acknowledging, adding a note, and resolving need a role that can edit monitors.

Everything the Servers pages do also works without them:

  • REST API: the /hosts routes. Servers are hosts in the API, with IDs like hst_7, because /servers already means monitors. A server incident has its own routes: get one, acknowledge it, add a note, and resolve it. A server’s blocks are at GET /hosts/:id/blocks.
  • CLI: thq hosts, and thq incidents for a hin_ ID. See Manage servers.
  • MCP server: 23 tools, from list_hosts to update_host_agent, with get_host_incident, acknowledge_host_incident, add_host_incident_note, resolve_host_incident, list_host_blocks, get_host_settings, set_host_settings, and the suggestion tools. See Tools. A signed-in assistant gets a one-hour install command of its own, which adds at most the servers it was made for; it can’t remove a server, remove a suggested copy, or change Count online users, which need an API key. With a key, set_host_settings can switch counting off, never back on.

Counting online users is /hosts/settings, thq hosts settings --count-users, and set_host_settings. Suggestions are /hosts/suggestions, thq hosts suggestions, and list_host_suggestions.

Watches and the internet alert are watches and internet in a server’s alert settings, --watch, --unwatch, and --internet on thq hosts alerts, and watches, internet_enabled, and internet_every on set_host_alerts. Over the API and MCP, a watch’s channels are channel numbers, such as 3 for chn_3.