SG SealGrid Athena Docs

Agent Server Migration

Agent Server Migration moves already-enrolled agents from one Athena server to another — for example when you stand up a replacement server, rename a server's URL, or split a fleet across a second server. You pick the agents, give the new server's URL, and the server sends each connected agent a migration instruction over the connection it already holds. There are two modes: Mint replaces an agent's home server in place, and Paste adds a second server alongside the first. Every migration is Admin-only and written to the audit log.

This is about pointing an existing agent at a different server. To get the agent onto a fresh host in the first place, see Agent Enrollment; to keep an enrolled agent's binary up to date, see Agent Binaries & Updates.

The two modes#

Every migration request carries a mode that decides where the destination token comes from and what the agent does with its on-disk server list:

ModeToken sourceWhat the agent doesTypical use
Mint The server mints a fresh short-lived registration token for you. Replaces the source server entry's URL and token in place — the agent ends up talking to the new URL only. Same logical server whose URL is changing.
Paste You supply a token that was minted on the destination server. Adds a new server entry alongside the existing one — the agent ends up connected to both servers. Cross-server migration; running an agent against a second server.

Paste is the default, because migrating to a different server is the more common operational case; Mint serves the narrower same-server URL-change scenario. In Mint mode the server generates the token itself through the normal registration-token machinery, with a MaxUsages large enough for the batch and the TTL you choose. In Paste mode you first create a registration token on the destination server, then hand it to the migration on the source server.

The migration request#

A migration is started with POST api/agent-migration/start (Admin-only). The body names the target agents and the new URL, plus mode-specific fields:

# Paste mode: move two agents to a second server using a token minted there
POST api/agent-migration/start
{
  "agentIds": ["a1…", "b2…"],
  "newUrl": "https://athena-b:8444",
  "mode": 0,
  "token": "<token-minted-on-athena-b>",
  "newServerName": "secondary",
  "timeoutSeconds": 60
}
FieldMeaning
agentIdsAgents to migrate. At least one is required.
newUrlThe destination server URL, including scheme and port (e.g. https://host:8444). Must be an absolute HTTPS URL — anything else is rejected.
modeToken mode on the wire: 0 = Paste (default), 1 = Mint.
validityHoursMint only. TTL of the minted token — must be 1, 2, or 4. Must be omitted in Paste mode.
tokenPaste only. The registration token from the destination server (at least 16 characters). Must be omitted in Mint mode.
newServerNamePaste only. Name for the new server entry on the agent (also becomes a data sub-directory). Max 50 characters, no path-invalid characters. Must be omitted in Mint mode.
timeoutSecondsBudget for the agent's connect-and-register attempt. Clamped to 10–300 seconds server-side. Default 60.
sourceServerNameName of the server entry the request applies to. Leave empty to let the server resolve it from its own Server:Name configuration.

Validation rules#

The server enforces a set of cross-field rules before dispatching anything; a request that breaks any of them is rejected with 400 and an explanatory message, and no agent is contacted:

The new URL must be HTTPS

Beyond the field rules above, the server independently parses newUrl and requires an absolute URL with the https scheme and a host. A non-HTTPS or malformed URL fails the migration for every agent in the batch.

Starting a migration in the UI#

In the web console, agent migration lives under Settings → Agent → Migration. There you choose Mint or Paste, enter the new server URL, fill in the mode-specific fields (validity hours for Mint; the pasted token and new server name for Paste), set the timeout, and select the agents to migrate. After you start, the same panel shows the dispatch result and recent migration history, updating in real time as each agent reports progress.

What happens after dispatch#

The server processes the batch and then tracks each agent independently:

  1. It validates the request, clamps the timeout to 10–300 seconds, and resolves the token — minting one in Mint mode, or using the token you pasted in Paste mode.
  2. For each agent it writes a migration-history record (status Pending) and sends the agent a migration message — the migration ID, source server name, new URL, token, timeout, mode, and (for Paste) the new server name — over the agent's existing connection.
  3. The agent attempts to connect and register at the new URL. In Mint mode it replaces its source server entry; in Paste mode it adds a new one. It reports progress back, which advances the history record's status.
  4. Each dispatch is written to the audit log, whether it succeeded or failed.

The response summarises the batch: successCount, failedCount, a per-agent results map, and a migrationIds map linking each agent to its history record. An agent that is not currently connected cannot be reached, so its history row is marked Failed with "Agent not connected" and it is counted as a failure — reconnect the agent (or wait for it) and start the migration again.

Migration status & history#

Every migration creates a history record you can review per agent or fleet-wide. Each record tracks the agent and hostname, the source server name, the fromUrltoUrl, who initiated it, timestamps, an error message on failure, and a status:

StatusMeaning
PendingMigration recorded, not yet started.
ConnectingThe agent has acknowledged and is attempting to connect and register at the new URL.
PromotedThe agent successfully registered on the new URL (replaced the source entry in Mint mode, or added the new entry in Paste mode).
FailedThe migration did not complete — for example a timeout, a registration error, a server-name collision, or the agent being disconnected. The agent's on-disk state is left unchanged.

Read history with GET api/agent-migration/history, optionally filtered by agentId, with a limit (default 50). History reads are available to Operator or Admin; only the terminal statuses (Promoted, Failed) stamp a completion time.

Roles#

ActionRequired role
Start a migrationAdmin
Read migration historyOperator or Admin

Callers without the required role receive 403; unauthenticated callers receive 401. See Roles & Permissions.

Auditing#

Migrating an agent's home server is treated as a high-risk action — it points the agent at a new control endpoint — so every dispatch is audited, successful or not. Each audit event records the agent and hostname, the source server name, the source and new URLs, who initiated it, and a token-source descriptor that lets a SIEM tell the two modes apart (minted server-side (TTL Nh) for Mint, or an operator-provided token … adds new ServerEntry '…' descriptor for Paste). See Audit & SIEM.

REST API#

Method & pathPurpose
POST api/agent-migration/startStart a migration for a set of agents (Mint or Paste). Admin.
GET api/agent-migration/historyMigration history (optional agentId, limit default 50). Operator or Admin.

PowerShell#

The Athena module wraps both endpoints:

CmdletPurpose
Start-AthenaAgentMigrationStart a migration. Choose -Mint (with -ValidityHours 1/2/4) or -Paste (with -Token and -NewServerName); plus -AgentId (accepts the pipeline), -NewUrl, optional -TimeoutSeconds (10–300, default 60) and -SourceServerName. Admin.
Get-AthenaAgentMigrationHistoryRead migration history, optionally for one -AgentId, with -Limit (1–500, default 50). Operator or Admin.
# Mint mode: replace the URL for one agent in place, minting a 1-hour token
Start-AthenaAgentMigration -Mint -AgentId $agentId -NewUrl "https://athena-2:8444" -ValidityHours 1

# Paste mode: add a second server to every online agent using a token minted there
Get-AthenaAgent -Online | Start-AthenaAgentMigration -Paste -NewUrl "https://athena-b:8444" -Token $tokenFromB -NewServerName "secondary"

# Review what happened
Get-AthenaAgentMigrationHistory -Limit 20

See the PowerShell Module reference for full cmdlet details.

Air-gapped by design

Migration happens entirely between your own servers. The instruction is delivered over the agent's existing connection, and the agent connects to a URL you supply on the same isolated network — nothing reaches out to the internet. See Air-Gapped Operation.