Central management point for a fleet of Yuneta nodes. Nodes dial in to the
control center (the agents are the clients). Operators then reach any connected
node through the control center. C_CONTROLCENTER is a server: it never
dials out.
Nodes dial in to __input_side__; operators reach __top_side__. A
command-agent rides back down the connection the node opened — which is
how an operator reaches a node it could never dial directly.
How a node connects to a control center¶
A node connects only when it has an owner. The primary
yuneta_agent declares an outbound client service named
controlcenter (gclass C_IEVENT_CLI, chain
C_IEVENT_CLI → C_IOGATE → C_CHANNEL → C_PROT_TCP4H → C_TCP, TLS). That service
is autostart:false and is started only when node_owner ≠ "none". An
empty owner is forced to "none", so by default a node does not dial out.
To enrol a node, set its node_owner (and, if not using the default control
center, its __output_url__).
How the remote URL is built¶
The agent assembles the control-center URL from config variables:
tcps://(^^__sys_machine__^^).(^^__node_owner__^^).(^^__output_url__^^)that is, tcps://<machine>.<node_owner>.<output_url> where:
| Variable | Source | Example |
|---|---|---|
__sys_machine__ | uname machine | x86_64 |
__node_owner__ | the node’s node_owner | artgins |
__output_url__ | "global": {"controlcenter.__json_config_variables__"} of the agent’s main.c, which its json file can override (7.30.5+) | yunetacontrol.com:1988 |
→ tcps://x86_64.artgins.yunetacontrol.com:1988 (TLS, default port 1988).
The secondary yuneta_agent22 dials its own endpoint,
default yunetacontrol.ovh:1989 (port 1989), and additionally exposes
remote PTY consoles that the control center drives with write-tty.
The agents trust only the control center’s own certificate,
/yuneta/agent/certs/controlcenter.crt, installed with the agent, checked
against the name yuneta_agent.yuneta.io. Its key stays on the control
center’s machine, which serves it on 1988 and 1989 -- the crypto of those
listeners in its realm config:
"crypto": {
"ssl_certificate": "/yuneta/store/certs/controlcenter.crt",
"ssl_certificate_key": "/yuneta/store/certs/private/controlcenter.key"
}Up to 7.30.3 the agents dialled 1994 / 1995 and trusted
yuneta_agent.crt, the certificate every agent serves on 1993. A control
center keeps a listener on 1994 and 1995, with that certificate, for the
agents of before.
Each node’s key (7.30.10+)¶
Each agent shows who it is with its own pair: the client certificate of its link, made on each node. The control center pins every node uuid to the key that an operator accepted. Without that, anybody with the agents’ shared token can connect claiming the uuid of any node, and receive that node’s commands.
1 — the listeners of the agents ask for the certificate. The crypto of
1988 and 1989 adds "ssl_verify_mode": "request". A C_TCP_S in that mode asks
the client for its certificate and takes it as it comes: the certificate is
self-signed, so its chain is neither verified nor reported, and the control
center pins its key. Leave the listener of the agents of before (1994) as it
is.
"crypto": {
"ssl_certificate": "/yuneta/store/certs/controlcenter.crt",
"ssl_certificate_key": "/yuneta/store/certs/private/controlcenter.key",
"ssl_verify_mode": "request"
}2 — the nodes topic. The control center keeps one record per node
uuid. Each record holds:
state:pending,acceptedorrefused.spki_sha256: the accepted key.presented_spki: the key that the last session written in the record presented. For apendingorrefusednode this is any key, or empty when the session presented none. For anacceptednode it is the other key (or empty) that its last session presented, and it is empty when that session presented the accepted key.accept-nodeempties it. Withenforce_node_keys, a refused open writes nothing, so the field keeps the value of the last open that was let in.hostnameandpeername: the node’s host name and address, as its agent gave them. For anacceptednode only a session that logged in by its key writes them: the hostname names the node, so a session of a token cannot rename it.first_seen,last_seen,decided_byanddecided_at. An agent that opens a session again with the same hostname, address and key writes nothing, unlesslast_seenis an hour old: a link that comes and goes does not add a record each time. The port of the address is no change: it is new at every connection (in 7.30.15 every open from a new port wrote the record).
An open that the control center REFUSES writes nothing in nodes (7.30.16+).
A node never seen that presents a key is kept in memory instead, as a node
that knocks (list-nodes shows it knocking, see below). In 7.30.15 a
refused open created or renamed the record of a node that is not accepted,
so whoever held the token was able to take the hostname of a node without a key.
When an agent opens its session, the control center checks it as follows:
| The agent presents | The node is | Result |
|---|---|---|
| a key | never seen | recorded pending, WARNING “A node to accept”. With enforce_node_keys refused, and not recorded: kept knocking, WARNING “A node knocking” (the first time, then every knocking_warning_period while it goes on knocking, with knocks: it asks an operator for accept-node) |
| its accepted key | accepted | let in |
| another key | accepted | refused if enforce_node_keys. Since 7.31.26 the key is kept in memory: list-nodes shows it in its own row with the state other-key, a WARNING “An accepted node knocking with another key” says it (the first time, then every knocking_warning_period), and the agent is told “This node is accepted with another key”. See A node reinstalled below |
| no key | accepted | WARNING, and refused if enforce_node_keys |
| anything | refused | refused if enforce_node_keys |
| no key | not accepted | let in while allow_nodes_without_key (an agent before 7.30.10) |
When the control center refuses an agent, it logs a WARNING (“Agent refused: its node key is not the one accepted”) and drops the agent’s channel. The agent reconnects on its own schedule.
The identity card of every session is checked when it opens, also of a
session of a token and with enforce_node_keys off. The control center
refuses the session with a WARNING (“Agent refused: its identity card is not
valid”, the reason in refusal) and drops it in these cases:
Its
idor itshostis not a string, or is longer than a node uuid (63) or a host name (64).Its
yuno_versionor thepretty_nameof itsosis present and is not a string. A longer text is accepted, and the control center reads its first 64 bytes, cut at a UTF-8 boundary. A node whose os has a long name is still a node.
For example, a card {"id": 7, ...} gives refusal: its id is not a string. In
7.30.15 such a session was let in, and every command that looked for an agent
after it logged an ERROR with a stack.
| Attribute | Default | Meaning |
|---|---|---|
enforce_node_keys | false | Refuse the agents whose key is not the accepted one. Off: the keys are only recorded. |
allow_nodes_without_key | true | Let in a node that presents no key and has none accepted. |
max_knocking_nodes | 256 | The nodes knocking (a key not accepted, no token) kept in memory for list-nodes. A new one evicts the one that knocked least recently, a uuid that came with two keys last while those are half the table at most (7.31.16+, and 7.31.15 with no bound). |
max_evicted_knocks | 1024 | The uuids evicted from a full knocking table, kept in memory with the key that each one knocked with. If such a uuid knocks again with another key, the uuid has two keys: the control center does not keep the knock (a WARNING, “A uuid evicted from the knocking table has two keys under it”), and an open enrollment refuses both keys. When the table is full, a new eviction overwrites the oldest uuid. That is a flood: an open enrollment closes, and no enrollment opens for mark_evicted_quarantine seconds (a WARNING, “The tombstones of evicted knocks are full”). 0: none kept, and every eviction closes the enrollment so. |
mark_evicted_quarantine | 3600 | Seconds no enrollment opens after a flood of knocks evicted what keeps an enrollment from taking a uuid (a uuid of two keys, or a live tombstone overwritten). The open enrollment closes. 0: it closes, and a new one can open at once. Each cause gives one WARNING in a window of this length, or of knocking_warning_period when that is longer. |
knocking_warning_period | 600 | Seconds between the WARNINGs “A node knocking” of a node that goes on knocking (7.31.10+). 0: only the first. Not one per knock: anyone who reaches the port can knock. The same pace applies to the WARNING of a refused node, and to the refusals of an enrollment. |
The three are read-only at run time: set them in the kw of the
controlcenter service in its realm config, and restart it. For example, once
every node has its key accepted, refuse the agents of before and keep a
smaller table of the boxes that knock:
{
"name": "controlcenter",
"kw": {
"enforce_node_keys": true,
"allow_nodes_without_key": false,
"max_knocking_nodes": 64
}
}3 — accept the nodes (permission manage-nodes, and list-nodes asks
list-agents). Before you accept a node, compare the key it presented with the
key of its own pair. The node gives its key with no SSH: its install prints
it (7.31.12+), and yuneta-agent-cert key on the node prints it again:
# the install (deb/rpm) of the node prints
[postinst] This node for its control center: node_id=0f1e2d3c-4b5a-6978-8a9b-0c1d2e3f4a5b spki_sha256=6548740338383c0d2084eef451728d8c5f733e6db39c93d870123f0707a7a022
# on the node, at any time
/usr/libexec/yuneta/yuneta-agent-cert key
# through the control center: the column Key is the start of the key presented
list-nodes state=knocking
list-nodes state=knocking hostname=^board- # only those whose hostname starts with board-
# the start you compared with the node's key, at least 16 hex
accept-node node_id=0f1e2d3c-4b5a-6978-8a9b-0c1d2e3f4a5b presented=6548740338383c0d
# or, with the key given whole
accept-node node_id=0f1e2d3c-4b5a-6978-8a9b-0c1d2e3f4a5b spki_sha256=<the key the node gives>
refuse-node node_id=0f1e2d3c-4b5a-6978-8a9b-0c1d2e3f4a5b
delete-node node_id=0f1e2d3c-4b5a-6978-8a9b-0c1d2e3f4a5b # a machine that is gonedelete-node (7.31.22+, permission manage-nodes) deletes the record of a
node that is refused or pending and has no agent connected: a machine that
was wiped or switched off. What was decided about it goes with the record, so
if its agent ever returns it is a node never seen (pending, or knocking with
enforce_node_keys). To keep a machine out, leave it refused. An accepted node
is refused first, so no single command takes a node out of service and forgets
it. A uuid that only knocked (no record) is dropped from the table in memory:
delete-node node_id=11111111-0000-4000-8000-000000000001
# -> 0 "controlcenter^cc1: node '11111111-...' ('web-01', refused) deleted"
delete-node node_id=22222222-0000-4000-8000-000000000002
# -> -1 "controlcenter^cc1: node '22222222-...' is accepted: refuse it first (refuse-node)"Each control center (1996, 1997) keeps its own nodes: delete the node in
both.
accept-node pins the key you give in spki_sha256, or, with
presented=<start>, the key the node presented (the first key a knocking
uuid came with, or the last one presented to its record) when it starts with
the start you give: at least 16 lowercase hex, the ones you compared with the
key the node gives (7.31.13+). The control center never pins a key by itself
(except while you hold an enrollment open, below), because anyone who reaches the port can make a key and knock with the uuid of
a node, and the start ties the decision to the key you compared: if another
key knocks under the uuid between your list-nodes and your accept-node,
it does not start the same, and the control center refuses it with a WARNING
(“Node not accepted: the key it presents is not the one compared”).
presented= is also refused when the uuid knocked with more than one key,
when the node presented none, and together with spki_sha256. Each decision
is an INFO, “Node key decided”.
A node reinstalled (7.31.26+). A node that is installed again from
scratch keeps its uuid, because its hardware gives the uuid. But its
agent makes a new key pair, and the control center refuses the new key: the
node is accepted with the old one. The control center keeps the key that
arrives in memory, in the table of the knocks, and list-nodes shows it in a
row of its own, with the state other-key, next to the accepted row. The
comment of list-nodes gives the command to run. Read the key on the node,
compare its start, and accept it:
list-nodes uuid=^33333333
# "33333333-..." "box-a" "accepted" false ... "4c4c4c4c4c4c4c4c4"
# "33333333-..." "box-a" "other-key" false ... "a1a1a1a1a1a1a1a1a"
# comment: node '33333333-...' is accepted and its agent presents another key,
# 'a1a1a1a1a1a1a1a1...': if the node was reinstalled, compare it with the key
# the node gives (yuneta-agent-cert key) and run accept-node
# node_id=33333333-... presented=a1a1a1a1a1a1a1a1
# on the node
/usr/libexec/yuneta/yuneta-agent-cert key
accept-node node_id=33333333-0000-4000-8000-000000000003 presented=a1a1a1a1a1a1a1a1presented= pins the key that knocked only when it starts with the start
that you give, as for a new node. It is refused when the uuid knocked with
more than one other key: then give spki_sha256= the whole key read on the
node. It is refused too when no other key knocked (“presents no other key:
nothing to change”). A node that cannot reach the control center gets its
new key with spki_sha256= whole. The other-key row goes when the new key
is accepted, or when the node logs in again with its accepted key. An open
enrollment never changes the key of an accepted node. Each control center
(1996, 1997) keeps its own nodes: accept the key in both. Up to 7.31.25 the
control center did not show the key that arrived, and refused presented=
for an accepted node.
Open enrollment (7.31.15+). When many nodes must be accepted at once (a migration of the control center, a batch of new boxes), open an enrollment for some minutes instead of accepting each node. While it is open, the control center accepts BY ITSELF the key that the agent of a node with no key accepted presents at its login, and the agent logs in with it at once:
# 10 minutes, at most 20 nodes (the defaults); minutes 1-60, max_nodes 1-256
open-enrollment minutes=10 max_nodes=20
list-nodes # its comment says: enrollment OPEN by '<you>': 540 s left, 7 of 20 nodes accepted
close-enrollment # close it now; it answers the nodes it acceptedThe enrollment does NOT accept:
a node that is accepted with another key (that is taking the node).
a refused node.
a node let in with NO key (an agent of before 7.30.10, by
allow_nodes_without_key): such an agent never presents a key, so a key under its uuid is somebody else’s, and accepting it locks the real node out onceenforce_node_keysis on. A node of before that is upgraded to its own pair is accepted withaccept-node, its key read on it.a uuid that came with another key before (knocking, or in its record): which of the two is the node’s? A full knocking table evicts such a uuid last, while such uuids hold half the table at most, so a flood of uuids with two keys does not keep the nodes of one key out of the table. When such a uuid is evicted all the same (a flood of knocks), an open enrollment CLOSES and none opens for
mark_evicted_quarantineseconds (an hour by default), with a WARNING (“A uuid that came with two keys evicted from the knocking table”): a flood can keep the enrollment shut, never slip a key in.a uuid that a flood evicted from the knocking table, when it knocks again with another key. The evicted uuid keeps the key that it knocked with (
max_evicted_knocks, 1024 uuids). Another key makes the uuid disputed, as a uuid of two keys in the table. The enrollment then refuses both keys with “it knocked with another key”, and the control center keeps no knock of that uuid. The uuid that knocked first does not win. To accept the node, give the key read on it (accept-node node_id=<uuid> spki_sha256=<key>), or forget the uuid (delete-node node_id=<uuid>). An evicted uuid that knocks again with its own key only is accepted. Thus a batch of nodes larger than the table enrolls, and the enrollment stays open. If more thanmax_knocking_nodes+max_evicted_knocksknocks evict a kept key, the enrollment closes, and none opens formark_evicted_quarantineseconds. Up to 7.31.29, the flood erased the key, and the enrollment accepted another key under that uuid.a key that is accepted for another node (one key, one node).
Each of these is a WARNING (“Node not accepted by the enrollment”, the reason
in refusal), and the agent stays knocking. The control center logs it the
first time in each enrollment, and after that once every
knocking_warning_period, not at each knock. Up to 7.31.29 it logged one
WARNING at each knock, and two for a refused node.
The enrollment closes when its minutes are over, when it has accepted
max_nodes, with close-enrollment, or when the control center pauses. It
lives in memory only: a restart never opens it again. The opening is a
WARNING (“Node enrollment open”), each node accepted an INFO (“Node
accepted by the enrollment”, with its address and hostname, after “Node key
decided”), and the closing an INFO (“Node enrollment closed”, with why and
the nodes accepted). The record of a node accepted so says decided_by: enrollment:<who opened it>. Both commands need manage-nodes.
While it is open, ANYBODY who reaches the port with a uuid that has no key
accepted is accepted, so keep it open only for the minutes you need. Check
list-nodes after you close it: refuse with refuse-node a node you do not
know.
One key, one node. accept-node refuses a key that is accepted for
another node, with a WARNING (“Node not accepted: its key is accepted for
another node”):
accept-node node_id=0f1e2d3c-4b5a-6978-8a9b-0c1d2e3f4a5b spki_sha256=<the key accepted for 3c4d5e6f-...>
# -> -1 "controlcenter^cc: node '0f1e2d3c-...': its key is already accepted for node '3c4d5e6f-7a8b-4c0d-9e2f-3a4b5c6d7e8f'
# (a copy of that node? give the copy its own pair, and accept that key)"A copy of a node’s disk carries the node’s pair. Under its own uuid, the copy can then log in as both nodes. Make a new pair on the copy, and accept that key.
A decision holds for the sessions in course. The control center drops each session of the node that the decision does not let in any more, with an INFO (“A session of the node dropped: its key is not accepted now”):
accept-nodewith a new key drops a session that presents the old key.refuse-nodedrops every session of the node.
Without enforce_node_keys, only a session that logged in by its key
(agent:<uuid>, below) is dropped: a session of a token is let in with any
key then, as when it opens. Up to 7.30.14 a session stayed after its key was
revoked, until it reconnected, and refuse-node dropped one session of the
node, and only with enforce_node_keys.
The transition, with nobody cut off:
Deploy with
enforce_node_keysoff: every node that connects is recorded with its key.Accept each node after you compare its key.
Then set
"C_CONTROLCENTER.enforce_node_keys": truein the config.
The agent and the agent22 of a node reach two control centers (1996 and
1997), and each control center keeps its own nodes. Accept the node in both.
An accepted key is also the agent’s login (7.30.11+). The control center
authenticates an agent’s identity card itself (its mt_authenticate) when the
agent presents the key accepted for the node uuid of its card. The session is
agent:<node uuid> and reaches the service controlcenter only. No token is
asked for, so a node needs no controlcenter.jwt in its agent’s json. When an
agent presents a key that is not accepted and sends no token, the control
center refuses it. Because that agent is not authenticated, nothing of it goes
to the store. The control center keeps it in memory (at most
max_knocking_nodes, 256: a new one evicts the one that knocked least
recently, and the first key of a uuid is kept), logs a WARNING (“A node
knocking”) the first time and again every knocking_warning_period (600 s)
while it goes on knocking, with the count of its knocks, and list-nodes
shows it with the state knocking. What it says there (its hostname) is not authenticated: it is only a hint. A new box
therefore connects with nothing but its key, and an operator accepts it with
the key read on the box. accept-node creates the record of a node that has
none, whether it is knocking or not. When the key is
for an accepted node but is not the accepted key, the control center logs a
WARNING (“Agent not authenticated: its node key is not the one accepted”).
Everything else goes to C_AUTHZ as before: the operators, and the agents of
before with their token.
The card of an agent that presents a key is checked before anything of it is
kept, because its agent is not authenticated yet. The control center refuses
the card, with a WARNING (“Agent not authenticated: its identity card is not
valid”, and the reason in refusal), when:
its
idis not a string of 1 to 63 letters, digits and-(whatnode_uuid()gives).its
hostis not a string, or is longer than a host name (64).
Up to 7.30.14 a value that was not a string gave an ERROR with a stack, and the control center kept an id or a hostname of any length in memory.
The user the agents log in as¶
Since 7.30.11 an agent with an accepted key logs in by that key (see above), not as a user. The user below is for the agents that still present a token: those of before 7.30.10, and those not yet accepted.
An agent of before opens its session with a JWT of a user of the control
center’s C_AUTHZ. That session needs a role in the service controlcenter, and
nothing more: an agent runs no command on the control center, it only sends
answers and events. Give that user a role whose permission no command asks
for, never *:
{
"id": "agent",
"disabled": false,
"description": "A node's agent: its session with the controlcenter, and no command",
"realm_id": "(^^__realm_id__^^)",
"parent_role_id": "",
"service": "controlcenter",
"permission": "agent-session"
}Every command of an operator asks its own permission (list-agents,
command-agent, drop-agent, write-tty, the scenario permissions). So the
token of that user, which is on every node, opens an agent’s session and
nothing else: from the operators’ port it answers “No permission to
‘list-agents’ in service ‘controlcenter’”. A role with * there let anybody
who took the token from one node command every node.
That token is old and cannot be renewed on the nodes. With a
max_token_age (see Configuration), put
its user in Authz.token_age_exempt_users, or the agents of before cannot
log in.
Who asks: the operator assertion (7.30.9+)¶
When the control center forwards a command to an agent, it says who asks in
__username__. With operator_assertion_key it also signs an operator
assertion. The agent verifies the assertion and believes it, not the
__username__. The assertion is a JWT (ES256) in __operator_assertion__:
| Claim | Value |
|---|---|
iss | operator_assertion_issuer (controlcenter) |
sub | the operator: the user that C_IEVENT_SRV authenticated (an email, or a local yuneta), or the user who started a scenario run. The stop that a scenario’s max_run schedules is a run of the control center itself, so its sub is <role>^<name> of the control center (controlcenter^cc). The run’s comment names the user who started the scenario |
aud | the node uuid of that agent (the id of its identity card) |
iat, exp | now, and now + operator_assertion_lifetime (60 s) |
The control center adds an assertion to command-agent, stats-agent,
write-tty (7.32.5+) and every step of a scenario run. It adds one only for an agent whose identity
card says knows_operator_assertion (7.30.9+). If it gets one, an older agent hands the
unknown key to its command. A request with no user gets no assertion.
Up to 7.32.4 write-tty went with no assertion, and the agents ran it as
of their principal controlcenter. An agent of 7.32.5 asks the operator of
a write-tty for the permission open-console, so it refuses every key of
an older control center. Deploy the control center before the agents.
The operator’s login token never leaves the control center. An assertion is good on one node only, for a minute, and never at a login. A node that is taken can replay it nowhere.
The private key is a JWK of EC P-256. It stays on the control center’s
machine, mode 600, and its public half goes into the agents’ main.c
(Authz.assertion_jwks). The config of the controlcenter service:
{
"name": "controlcenter",
"kw": {
"operator_assertion_key": "/yuneta/store/certs/private/controlcenter-assertion.jwk"
}
}| Attribute | Default | Meaning |
|---|---|---|
operator_assertion_key | "" | File of the private key. Empty: the control center sends no assertion, and the agents run every request as their principal controlcenter. |
operator_assertion_issuer | controlcenter | The iss: the kid of the public key in the agents. |
operator_assertion_lifetime | 60 | Seconds an assertion lives. An agent refuses more than its max_assertion_lifetime (300). |
A key that cannot be used makes the control center log an ERROR, “The key of
the operator assertions is not usable: none is sent”. Examples are a file
that is not a private EC P-256 JWK, or a yuno whose C_AUTHZ did not set
libjwt’s allocators.
To make a key, write a P-256 private JWK with openssl and a few lines of
script:
openssl genpkey -algorithm EC -pkeyopt ec_paramgen_curve:P-256 -out k.pem
openssl pkey -in k.pem -text -noout # priv: d, pub: 04 || x || y (base64url each)Keep an offline copy of the key. Replacing the key means a new agent release with the new public half.
One node, one uuid¶
A node is known by its node uuid (the id of its agent’s identity card), and
command-agent, stats-agent and the scenarios reach a node by it. Two
agents with the same uuid are taken for one node: the first one found gets
the command. A copy of a node’s disk gives the same uuid, and so does a board
whose hardware gives every board of its model the same identifier. When an
agent opens its session with the uuid of an agent in session from another
host, the control center logs a WARNING (an ERROR from 7.30.3 to 7.30.14:
an agent can cause it):
Two agents with the same node uuid on other hosts: a copy of a node, give each its own uuid (yuneta-node-uuid)
uuid: 5e6f7a8b-9c0d-4e1f-8a2b-3c4d5e6f7a8b, hostname: board-b, hostname2: board-aThe same host is not reported: that is a node whose link came back before its
old session was seen to close. To give the copy its own uuid, see
node_uuid() (yuneta-node-uuid show / ensure /
set), then restart both agents and every yuno of the node.
A node is reached by its uuid¶
command-agent, stats-agent, write-tty and the scenarios name a node by
its uuid or by its hostname, in that order:
The uuid is the identity that the agent’s session was accepted for: by its key at the login, and against the node’s record in
nodeswhen the session opens.The hostname is only what the agent writes in its identity card. So it names:
an accepted node through its record in
nodes, also while the node is away. That record takes its hostname only from a session that logged in by the node’s key.any other node (pending, the agents before 7.30.10 with their token) through the card of an agent of it in session, and only while it is in session. Its record is written by any session of its uuid, a token’s included, so the record names nobody.
A
refusednode names nothing.
The uuid of an accepted node always names that node. When two sessions give
the uuid of an accepted node (with enforce_node_keys off, a session of a
token is let in with it), the session that logged in by the node’s key gets
what goes to the node. Any other name is
refused when two nodes give it as their hostname, or when it is the uuid of a
session and the hostname of another node: a session of a token whose card says
id: board-b does not take the commands of the node named board-b.
drop-agent names a node the same way, and drops every session of it. When
two agents of different nodes in session give one hostname, the control
center logs a WARNING (“Two agents of different nodes give one hostname:
reach them by their node uuid”):
command-agent agent_id=board-b cmd2agent=list-yunos
# -> -1 "controlcenter^cc: 'board-b' is the hostname of more than one node: give its node uuid"
command-agent agent_id=3c4d5e6f-7a8b-4c0d-9e2f-3a4b5c6d7e8f cmd2agent=list-yunos
# -> 0 "Command sent to 1 nodes"A name that two accepted nodes give stays refused while both records keep it,
also while one of the two nodes is away, until the node that took the other’s
name opens its session with its own. A name that a node without a key gives
is refused only while that session is open: when it goes, the name is the
other node’s again. For example, the node node-p (no key) is in session,
and a session of a token with another uuid gives node-p:
command-agent agent_id=node-p cmd2agent=list-yunos
# -> -1 "controlcenter^cc: 'node-p' is the hostname of more than one node: give its node uuid"
# ... the other session goes:
command-agent agent_id=node-p cmd2agent=list-yunos
# -> 0 "Command sent to 1 nodes"In 7.30.15 the records of the nodes without a key named them too: a session
of a token that gave the uuid of node-p with another hostname renamed its
record, and a session with a new uuid that gave node-p got its commands and
its console keys. A session that went away left its record, and the name was
two nodes’ for ever, until a refuse-node of the other uuid.
The uuid of a PENDING node that is away names no node: an accepted node that gives that uuid as its hostname gets what is sent to it. Protecting it lets any session of a token block the hostname of an accepted node for ever, with one record whose uuid is that hostname.
When accept-node accepts a node that was not accepted, its record keeps
a hostname and an address only if the key accepted wrote them: the last
session written in the record presented that key, or the node knocked with
it. Otherwise both are emptied. Any session of the uuid, a token’s included,
writes the record of a pending node. The node gets its name back at its
next login by its key. For example, node P presented its key once, and then
a session of a token claimed P’s uuid and gave board-b:
list-nodes # uuid-p pending hostname: board-b presented_spki: (empty)
accept-node node_id=uuid-p spki_sha256=<the key read on P>
list-nodes # uuid-p accepted hostname: (empty) peername: (empty)
command-agent agent_id=board-b cmd2agent=list-yunos
# -> 0 "Command sent to 1 nodes" (board-b: the node that has that name)In 7.30.16 and before, P was accepted with the name board-b. board-b
then named two nodes, and nothing was sent to board-b until P logged in by
its key. write-tty goes to ONE agent, and is refused without
agent_id (a WARNING, “write-tty without agent_id, nothing written”). Up to
7.30.14 the first agent whose uuid or hostname matched got the command, so an
agent was able to take the commands of another node by giving its hostname, or its
uuid as hostname. write-tty went to every agent that matched, to all of
them without agent_id. And drop-agent dropped every agent whose uuid or
hostname matched.
Reaching nodes through the control center (ycommand)¶
The control center exposes two gates (defined in its realm config, not in the
binary): __input_side__ where agents connect, and __top_side__ where
operators (web / ycommand) connect. In production there
are two control centers, one per agent plane: 1996 (the agents, fed on
1988, and on 1994 by agents before 7.30.4) and 1997 (agent22, fed on 1989,
and on 1995 before 7.30.4).
1 — point ycommand at the control center (role and service are both
controlcenter):
ycommand --url=wss://<cc-host>:1997 --yuno-role=controlcenter --yuno-service=controlcenter -c 'list-agents'or, through an agent that already holds the control-center connection, with the
passthrough form shipped in the controlcenter README:
ycommand -c 'command-yuno id=<cc> service=controlcenter command=list-agents'2 — list the connected nodes with list-agents (UUID, hostname, status).
Connected nodes are discovered live: the control center scans __input_side__
for C_IEVENT_SRV children in state ST_SESSION and reads each one’s
identity_card. A node is addressed by its UUID (identity_card.id) or
its hostname (see A node is reached by its uuid).
list-agents takes four filters. Each filter is a regular expression of
PCRE2 (the syntax of Perl, as grep -P reads it), searched anywhere in one
field of the agent’s card. ^ and $ anchor it. The fields are uuid
(identity_card.id), version (yuno_version), hostname and os (the
pretty_name of the os the agent says, 7.31.21+. An agent before says
none). An agent is listed when it matches every filter given. A filter that
is not a regular expression is refused (-1), and the answer says which.
The control center runs in one thread, and any user with the permission
list-agents writes the filters. So each filter runs with limits:
The pattern is 256 bytes at most, and its compiled code 1 KB at most. The filters an operator writes compile to a few hundred bytes. For example,
((a{100}){100}){100}is refused (“regular expression is too large”).A search runs first with a low limit of 100 frames at each start position. (A frame is a point where PCRE2 can go back and try again.) The filters an operator writes need 1 to 40 frames. A pattern like
.*web.*needs one or two frames for each byte of the field.If a search hits that limit, the control center runs it again one start position at a time, with 5000 frames for each position.
.*a.*b.*cneeds up to about 1000 frames on a field of 63 bytes. Before each position, the control center looks at the time of the command.The control center tries only the positions where a match can start, as one search does. A pattern that is anchored (
^web) starts at the start of the field only. A pattern that starts with.*starts at the start of the field or after an LF. A pattern whose first byte PCRE2 knows starts at that byte only:webat aw,(?i)webat awor aW.All the searches of one command take 50 ms. The time starts at the first search, so the time to read the store does not count. When the 50 ms are spent, no more nodes are judged, and the answer says so: “the filters spent the 50 ms of the command: N nodes not judged, not listed”. This text names no filter, because a long table can spend the time with cheap filters.
The limit is in frames: 100 at each of 65 positions for the first search, and 5000 for one position. The first search does not look at the time. The time of a frame is measured, not proven. The worst cases measured used the worst patterns found under 256 bytes and 1 KB of code, on fields of 64 bytes. Each figure is the median of 5 rounds of 8 runs, on one core of the dev machine. They are about 2 µs for a frame, 14 ms for a first search and 10 ms for one position. So the filters of a command take 50 ms plus 14 ms in the worst case measured. Single runs took up to twice that when the other cores of the machine were busy.
On 556 rows of 63 hex bytes, an ordinary filter takes 0.3 ms at most,
.*a.*b.*c1 ms and.*a.*b.*c.*d2 ms. Before the control center skipped the positions where no match can start, these two took 5 ms and 16 ms.Before this limit on the code, a pattern of 229 bytes with 16 KB of code kept every position under the limit, and one search took 2.9 s on a uuid. PCRE2 counts frames, not the work inside a frame. With 1 KB of code, the work inside a frame is small.
A filter that hits its own limit (5000 frames at one position, a depth of 5000, or 1 MB) matches nothing more in that command. The command still answers (0), and its comment names the filter: “hostname: too costly to match (match limit exceeded): it matched nothing from the first node that hit the limit; write a simpler one”.
A filter is compiled as bytes, without UTF: a UTF-8 text in the pattern matches the same bytes in the field, and
.matches one byte. A pattern cannot turn UTF on, and it cannot use\Cor a callout. It cannot use Unicode properties either:(*UCP)does not compile (“using UCP is disabled by the application”), and\w,\dand\bread ASCII only. Under(*UCP), each\breads the Unicode tables, and a first search took 23 ms.Some forms are refused (-1), and the answer names the form, for example “hostname=‘(web)-\1’ is refused: a filter cannot use a back-reference”. The refused forms are these:
A back-reference:
\1,\k<name>, or a condition on a group ((?(1)...)). A back-reference reads the field again without a frame, so the work inside one frame grows with the field. With back-references, one position took 23 ms.\G,(*COMMIT),(*SKIP)and(*NOTEMPTY_ATSTART). With them, the search one position at a time gives another answer than one search.A newline other than LF:
(*CR),(*CRLF),(*ANY),(*ANYCRLF)or(*NUL). The control center finds the start of a line after an LF only.
The control center finds
\Gand the verbs in the text of the pattern. So it also refuses them inside\Q...\E, a class or a comment.(*PRUNE)and(*THEN)are accepted, because they give the same answer one position at a time.
Up to 7.31.29 the filters were POSIX patterns of glibc’s regcomp(). Some
patterns took all the memory to compile ((a{32767}){32767}, a and 24
+). Others took an exponential time ((a??a??...)* with 40 groups, 123
bytes, takes days). The control center did not answer any agent while it
compiled them.
The version and the os of a card are read cut to their first 64 bytes, at a
UTF-8 boundary, for the filters and for the rows of list-agents.
expand=1 shows the card whole. The card of an agent22 of 7.32.6 or later
also says the origin of the runtime of the node, "source" or "package"
(see runtime_from).
ycommand -c 'list-agents hostname=^box-' # the nodes whose hostname starts with box-
ycommand -c 'list-agents version=^7\.31\. expand=1' # the agents of 7.31, their cards whole
ycommand -c 'list-agents uuid=^(11111111|22222222)-' # two nodes by the start of their uuid
ycommand -c 'list-agents os=^Rocky' # the nodes on Rocky Linux
ycommand -c 'list-agents hostname=^node-[0-9]{2}$' # a bounded repetition
ycommand -c 'list-agents hostname=^web|^db' # an anchor in each alternative
ycommand -c 'list-agents hostname=web-01('
# -> -1 "controlcenter^cc1: hostname='web-01(' is no regular expression: missing closing parenthesis (at byte 7)"
ycommand -c 'list-agents hostname=(a|aa)+[^a]'
# -> 0, comment "controlcenter^cc1: hostname: too costly to match (match limit exceeded): ..."
ycommand -c 'list-agents hostname=(web)-\1'
# -> -1 "controlcenter^cc1: hostname='(web)-\1' is refused: a filter cannot use a back-reference"
ycommand -c 'list-agents hostname=(*UCP)\bweb'
# -> -1 "controlcenter^cc1: hostname='(*UCP)\bweb' is no regular expression: using UCP is disabled by the application (at byte 6)"What a node IS (its os, cpu, memory, disks, network interfaces, uptime) is
answered by the info-machine of its agent’s yuno (agents 7.31.21+). The
control center’s own info-machine (7.31.23+, permission list-agents) asks
it: agent_id is a node uuid or a hostname, as in command-agent, and like
it the first answer is the dispatch, the node’s comes after (give ycommand
a -w):
ycommand -w 10 -c 'info-machine agent_id=box-b'
# the same, by hand:
ycommand -w 10 -c 'command-agent agent_id=box-b agent_service=__yuno__ cmd2agent=info-machine'3 — forward a command to one node with command-agent (a SDF_WILD_CMD):
ycommand -w 10 -c 'command-yuno id=<cc> service=controlcenter command=command-agent agent_id=<host-or-uuid> cmd2agent="list-yunos"'Parameters: agent_id (UUID or hostname), agent_service, and cmd2agent
(the command to run on the node, the exact key that the handler reads). The
control center routes the command to the one connected agent of that node
(gobj_command). The node’s agent then executes it, and can
itself target a specific yuno via its own command-yuno (command=… service=…).
command-agent answers AT ONCE, before the node does: the first answer is
the control center’s own, “Command sent to 1 nodes”. The node’s answer comes
later, as a second answer along the same route.
When no connected agent matches, the answer is -1 and says why (since
7.31.19. Before, it said only “Command sent to 0 nodes”). A node of the
store that is away is named with its hostname, its uuid, its state and when it
was last seen. A name that is no node says so. stats-agent answers the same:
-1 "controlcenter^cc1: node 'web-01' (11111111-0000-4000-8000-000000000001, accepted) is not connected, last seen 2026-11-18T23:36:02.0+0100"
-1 "controlcenter^cc1: node 'board-x' (uuid-x) is refused"
-1 "controlcenter^cc1: 'web-1' names no node connected: neither the uuid of a node nor the hostname of an accepted one"When the agent’s link is closing (the agent sent its Close, and the link is
still in session until the connection ends), the link refuses the request at
once and nothing is sent. The first answer is then the only one: -1 with the
link’s reason, which names the agent’s channel in the control center
(input-7 here). stats-agent answers the same way (“Stats sent to 0
nodes”):
-1 "controlcenter^cc1: service 'input-7' not in session: Command sent to 0 nodes"Up to 7.30.26 the control center dropped that refusal and answered “Command
sent to 1 nodes”: the operator waited for an answer that nobody sent. A
write-tty refused that way is answered with the link’s reason too
(EV_MT_COMMAND_ANSWER, -1). Up to 7.30.26 the keystrokes were lost with no
answer. A non-interactive ycommand exits --wait
seconds after an answer (-w, default 1), so it shows the node’s answer only
if it arrives in that time. Give it room, or stay interactive (-i):
ycommand -w 10 -c 'command-yuno id=<cc> service=controlcenter command=command-agent agent_id=<host-or-uuid> cmd2agent="list-yunos"'The agent answers its own requests with an event of its own, not with
EV_MT_COMMAND_ANSWER: read-file, running-keys and running-bin with
EV_READ_FILE, read-json with EV_READ_JSON, read-binary-file with
EV_READ_BINARY_FILE, edit-config, view-config, edit-yuno-config and
view-yuno-config with the event of the same name (EV_EDIT_CONFIG, ...).
The control center relays them to the client that asked, as it relays an
answer (ycommand takes the seven):
ycommand -w 10 -c 'command-yuno id=<cc> service=controlcenter command=command-agent agent_id=node-a cmd2agent="read-file filename=/yuneta/agent/yuneta_agent.json"'
# -> 0 "Command sent to 1 nodes", then the file (EV_READ_FILE)Up to 7.30.26 none of those events was public in the control center: the agent’s channel refused the frame (“Frame of an event that is not public, refused”, a WARNING), and the client had only “Command sent to 1 nodes”.
The agent writes the route of its answers, so the control center relays one
(those seven, and the EV_MT_COMMAND_ANSWER / EV_MT_STATS_ANSWER of a
command-agent / stats-agent) only to a web client that asked that
agent, in the connection it holds now: command-agent and stats-agent
remember, in the agent’s channel, the client’s channel and its connection,
and stamp the connection on the request (cc_connection). The answer must
return from that agent with that stamp.
An answer for a client that did not ask that agent, with another client’s
stamp or with none, is dropped with a WARNING that names the agent (one per
drops_warning_window, the rest counted):
"msg": "answer of an agent for a web client that did not ask that agent, dropped",
"event": "EV_READ_FILE", "agent": "<node uuid>", "agent_host": "node-a",
"client": "C_CHANNEL^input-3", "detail": "the client did not ask that agent"Up to 7.30.26 an accepted agent was able to send the seven to any web client of
the control center, naming its channel: two clients that had asked nothing got
them. ycommand takes one only as the answer of a request it made (one
answer per request, see the ycommand page) since then.
The same rule holds for what an agent streams: the events of a console
(EV_TTY_OPEN, EV_TTY_DATA, EV_TTY_CLOSE, asked by an open-console)
and the readings of a watch (EV_YUNO_STATS, asked by a watch-yuno-stats),
both sent through command-agent. Up to 7.30.26 they were relayed to any web
client the agent named, with no stamp: a forged console, forged stats and a
close reached clients that had asked nothing.
And a stream goes only for what the client asked that agent, not for
anything it asked it. command-agent remembers, in the agent’s channel and
before the agent answers, the console a client asks to open there (its name:
the name= of the line, else the name of the kw, as the agent’s parser
reads it) and a watch-yuno-stats it asks there:
an
EV_TTY_OPENgoes only for a console of that name the client asked that agent to open, and only then is its mirror recorded.an
EV_TTY_DATAorEV_TTY_CLOSEgoes only for a console of that name that this agent opened for the client (its mirror).an
EV_YUNO_STATSgoes only to a client that asked that agent for a watch.
The rest is dropped with the WARNING above, its detail saying which:
"msg": "answer of an agent for a web client that did not ask that agent, dropped",
"event": "EV_TTY_DATA", "agent": "<uuid of node-b>", "agent_host": "node-b",
"client": "C_CHANNEL^input-3",
"detail": "no console of that name opened through that agent for the client"A console is named by the client, not by the node (gui_agent names it
tty_<node>_<tab>), so up to 7.30.26 -- and with the stamp rule alone --
an agent the client had sent any command to (help, which gui_agent sends to
every node it shows) was able to write in another agent’s console and close it, and
plant the mirror of a console nobody opened, whose close dropped the client.
The legitimate ones are as before, from one tab:
command-agent agent_id=node-a cmd2agent="open-console name=tty_node-a_t1 cx=80 cy=24"
command-agent agent_id=node-b cmd2agent="open-console name=tty_node-b_t1 cx=80 cy=24"
# -> each console's output comes from its own agent; node-b's frames named
# tty_node-a_t1 are droppedWhen an agent’s channel closes the control center forgets what its clients
asked it. A client that keeps a watch renews it (gui_agent does every
watch_ttl/3), and a client with a console of that agent is dropped with it,
so both ask the new connection of the agent again. The drop is kept on
purpose: gui_agent reads an EV_TTY_CLOSE as the shell ended and closes
the terminal’s tab, while a drop makes it connect again and open each console
again by its name, which re-attaches to a console the agent kept. Since the
mirror is only of a console the client asked that agent to open, only an
agent the client opened a console on can end its connection that way, as its
restart does.
What the control center remembers of a console asked lives only while it can
be used. It forgets it when the agent refuses the open-console (an answer
with a negative result: the control center stamps the console’s name in the
client’s frame of the request, cc_console, and the answer carries it back),
when the console’s EV_TTY_CLOSE passes, when the client leaves, and when the
agent’s channel closes. Two requests are refused by the control center itself,
and nothing is sent to the agent:
a console name longer than
NAME_MAX(255) bytes: no agent opens one, a console is a gobj and its name a gobj name.a console asked of an agent by a client that already has 64 asked there and not closed (an agent opens 30 by default, its
max_consoles).
command-agent agent_id=node-b cmd2agent="open-console name=tty_node-b_t65"
-> -1 "<role^name of the control center>: too many consoles asked of that agent and not closed"Up to 7.30.26 each name a client asked was kept until the agent’s channel closed, refused ones too, with no bound: 2000 names of 30 KB, each refused by the agent, kept 57 MB in the control center after the client left.
A reading of a watch (EV_YUNO_STATS) reaches the client with the
monitor_node of its __md_iev__ that the client wrote in its watch of
that agent, not the one the agent echoes: gui_agent reads that key to
know whose reading it is, and up to 7.30.26 an agent the client watched was able to
paint its readings on the cards of another node. A client that wrote no
monitor_node gets none.
A link of the control center (its C_IEVENT_CLI to the agent of its node)
gets the answers of what it asked an agent, and never a stream: its peer, the
agent of the node, takes no console’s events nor readings from a yuno. Up to
7.30.26 any agent the link asked something was able to send it any. Now each
is dropped with the WARNING above and the detail “a stream for a link of
this control center: none is relayed to a link”.
A client that left before the answer (its channel closed) is not taken
for a client that did not ask: the answer is dropped with the INFO
“requester gone before its answer, answer dropped”, as in 7.30.26, and the
WARNING above, and its count, are only for an agent that routes to a client
that is there and did not ask it. Before the fix a closed channel had no
connection, the stamp check ran first, and an honest agent was logged as a
forger. The EV_TTY_OPEN of a console for a client that left records no
mirror either: up to the fix it recorded one with no connection, and when the
agent’s channel closed the control center dropped whoever held that client’s
channel then.
What waits to be sent to a web client is bounded too, in messages and in
bytes: when the control center relays an agent’s answer or stream to a client
whose transport holds client_max_tx_queue messages or more (default 8192,
because a console’s output is many small messages) or client_max_tx_bytes bytes or
more (default 32 MB, and an answer of an agent is one message of any size, up to
the 200 MB of max_pkt_size), the client is dropped, with ONE WARNING, and
nothing more is relayed to that connection. 0 turns either bound off. The
bytes are what the client’s C_TCP holds to send (cur_tx_bytes). With the
default, a client that does not read holds at most 32 MB plus the answer that
crossed the bound, a few slow clients fit in the 2 GB of the control center,
and the usual answers (a list, a log of some MB) are far below it:
"msg": "web client that does not take what is relayed to it, dropped",
"client": "C_CHANNEL^input-4", "peername": "10.0.0.9:50122", "event": "EV_READ_FILE",
"tx_queue": 1, "client_max_tx_queue": 8192,
"tx_bytes": 50331920, "client_max_tx_bytes": 33554432{
"global": {
"controlcenter.client_max_tx_queue": 16384,
"controlcenter.client_max_tx_bytes": 67108864
}
}Before the fix the bound counted messages only: sixteen answers of 24 MB to a client that read slower than the agent wrote took the control center from 15 to 408 MB, with no warning.
Up to 7.30.26 a browser that did not take its console’s output grew the control center with all of it. The agent’s own flow control (see the agent’s page, Consoles) paces a console to the link, not to each browser behind it.
Events pushed by a node, relayed to the web client¶
Some of what a node’s agent sends is not an answer but a stream, pushed along
the route of the request that opened it: the PTY of open-console
(EV_TTY_OPEN, EV_TTY_DATA, EV_TTY_CLOSE) and, since 7.25.13, the stats
of a watch-yuno-stats (EV_YUNO_STATS). The control center relays each of
them to the web client at the end of the route. It must KNOW the event: a
control center that receives one it does not know drops the agent’s
connection. And the client at the end must know it too: ycommand logs
“Event NOT DEFINED” on every reading. So the web client says it takes the
event, in its request:
{"agent_id": "node-a",
"cmd2agent": "watch-yuno-stats ids=7601,7501 period=2000",
"__relays__": ["EV_YUNO_STATS"]}command-agent removes the client’s __relays__ and, only if it named
EV_YUNO_STATS, writes its own __relays__: ["EV_YUNO_STATS"] in the kw it
forwards (the client’s other entries are not passed on). The agent refuses a
watch without it (“the client, or the control center in between, does not say
it takes EV_YUNO_STATS (relays), ask stats-yuno instead”), and the client
polls stats-yuno. Up to 7.25.20 the control center said it for every client,
so a ycommand watch through it got readings it was not able to handle.
Deploy order: gui_agent 0.29.7 or later first, or together with this
control center. An older gui_agent does not send __relays__ through the
control center: its Monitor is refused the watch and polls instead, the same
fallback it takes with an agent that refuses a direct watch.
Who gets what the agent sends back is the requester named in the control
center’s OWN hop of the route: the web client’s channel of __top_side__, or
the control center’s link to its own agent (agent_client, a C_IEVENT_CLI)
for a request made through the local agent (it is answered twice, see
above: -w gives the node’s answer time to arrive):
ycommand -w 10 -c 'command-yuno id=<cc> service=controlcenter command=command-agent agent_id=node-a cmd2agent="list-yunos"'That link is believed only for an agent it asked: the agent’s channel remembers the links whose requests it was sent, and forgets them when it closes. An agent that routes an answer to a link that never asked it is dropped with the same warning.
A route that names anything else is dropped with the warning “answer of an agent for no requester of this control center, dropped” (the PTY output with “PTY output of an agent for no requester of this control center, dropped”, once a minute). Up to 7.25.20 it fell back to a service named by the hop below, which the client writes, so the answers of a request through the local agent were sent to the control center itself and lost.
An event that only an agent sends, sent by a web client from __top_side__,
is dropped: “event of an agent not from the agents’ side, dropped”, at most
once a minute, with dropped= counting the ones since the last warning.
A stats reading for a web client that is gone (a closed tab) is expected -- the agent learns it only when the watch expires, not renewed -- and is counted, not logged per reading: one warning a minute at most,
yuno stats for a web client that is gone, dropped (the agent's watch expires) dropped=42Each capped warning (this one, the PTY of a client that is gone, PTY output
routed to nobody, agent events sent by a web client) says what it counted when
it speaks next. So the count left since the last one is said when its window
ends, or when the control center stops, with when:
stream for a web client that is gone, dropped when="its window ended" dropped=17The window is the attribute drops_warning_window, in milliseconds (default
60000: one warning a minute per kind). A new value applies at once to the
windows that are open, and a value under 1 is refused (logged, 60000 put
back). drops_timer_armed (read-only) says whether a count is waiting for its
window to end:
ycommand -c 'command-yuno id=<cc> service=__yuno__ command=write-attr gobj_name=controlcenter attribute=drops_warning_window value=10000'
ycommand -c 'command-yuno id=<cc> service=__yuno__ command=view-attrs gobj_name=controlcenter attribute=drops_timer_armed'Not when a connection closes. Otherwise a client that connects, sends one, and leaves, in a loop, gets one warning per loop.
A web client is its CONNECTION, not its channel name (since 7.25.15).
The channel a browser holds in __top_side__ (top-12) is taken by the next
client once it closes, so a stream still pushed for the tab that left can
reach whoever connected after it -- up to watch_ttl of another user’s node
data. Each connection gets a number when it opens, command-agent and
stats-agent stamp it on the request (cc_connection, in the first frame of
the ievent stack, which the agent gives back with its answer and keeps with a
watch or a console), and what returns -- the answer of a command or of a
stats, the PTY of open-console (EV_TTY_OPEN, EV_TTY_DATA,
EV_TTY_CLOSE), a relayed EV_YUNO_STATS, the answer of a run-scenario --
is delivered only while the channel still holds that connection. A stream
(EV_YUNO_STATS, EV_TTY_DATA) for another connection is dropped and counted
with the gone ones (reconnected=its channel holds another connection now in
the warning). An answer is dropped with a warning each (“answer for a web
client that is gone, dropped: its channel holds another connection now”).
When an agent’s connection closes, the client of each console mirrored
through it is dropped, once, and only if it is still the connection that
opened that console. Several consoles go through one agent’s connection. The
control center keeps their clients per console name, and a console opened
again by another client is that client’s -- the agent routes it the same way
(one route per console and control-center channel, refreshed by the re-open).
Up to 7.25.20 the control center kept one client per agent connection: the
last console opened, cleared by the close of any console. Up to 7.25.20 only
EV_YUNO_STATS and the run’s answer were checked: a slow answer, or a PTY
stream, of the client that left reached the next one.
These events are public because the agents send them, but only an agent can send them:
one that arrives from __top_side__ -- a web client sending it itself, with a
route of its own writing -- is dropped with a warning (“event of an agent
not from the agents’ side, dropped”). Up to 7.25.20 a client was able to push an
answer or console frames of its making to any other client’s channel.
Scenarios (TreeDB)¶
The control center’s treedb, treedb_controlcenter (schema_version 3),
keeps the scenarios of the fleet and the runs of their actions. It
holds neither the connected nodes (discovered live, above) nor the users (who
can use the control center is its authz store, C_AUTHZ).
scenarios
┌───────────────────────────┐
│* id │
│ description, group │
│ node, agent_url │
│ yunos, links │
│ actions, view │
│ runs {} │ ◀─┐
│ created_by/at │ │
│ updated_by/at │ │
└───────────────────────────┘ │
scenario_runs │
┌───────────────────────────┐ │
│* id │ │
│ scenario_id (↖) │ ──┘
│ action, username │
│ started_at, ended_at │
│ result, comment, steps │
└───────────────────────────┘A scenario is a set of yunos on one or several nodes, how the messages flow between them, and the commands of each action -- a test to run and watch, or just a group of yunos to watch. It is a document saved whole:
{
"id": "stress-demo",
"description": "sim_load -> gate -> db_events, both nodes",
"group": "demo",
"node": "node-a",
"yunos": [
{"key": "sim", "id": "gen1", "service": "sim_load", "rate": "tx"},
{"key": "gate_a", "id": "7601", "label": "gate",
"queue_service": "__output_side__"},
{"key": "events_a", "id": "7501", "label": "db_events"},
{"key": "gate_b", "id": "7601", "label": "gate", "node": "node-b"},
{"key": "events_b", "id": "7501", "label": "db_events", "node": "node-b"}
],
"links": [["sim", "gate_a"], ["gate_a", "events_a"], ["gate_b", "events_b"]],
"actions": {
"start": [{"yuno": "sim", "command": "set-clients clients=10"},
{"yuno": "sim", "command": "resume-load"}],
"stop": [{"yuno": "sim", "command": "set-clients clients=0"}],
"report": [{"yuno": "gate_a", "service": "__yuno__", "command": "view-config"}]
},
"view": {"mode": "graph"}
}| Key | Meaning |
|---|---|
id | The scenario’s name: no blanks, no ^, no `. |
node | The node (agent hostname or UUID) of every yuno that does not say its own. |
agent_url | Instead of node: a DIRECT scenario, watched by the web console through its own link to that agent. run-scenario refuses it. |
yunos | id (the agent’s yuno id) and optionally key (how the rest of the scenario names it, needed when two nodes carry the same id), node, service, label, rate (rx or tx), queue_service (the service that holds its output queue, when it is not service: __output_side__ for a gate, 7.27.21+), switch ({on: [steps], off: [steps]}, turned by hand, 7.28.6+, below). |
links | [from, to] pairs of keys: how the messages flow. |
actions | start, pause, resume, stop, report: each a list of steps {yuno, service?, command}, one command line with its key=value parameters. |
view | How the console shows it (mode: graph or cards, and node_labels, a short name per node on its cards, {"node-b": "b"}). |
max_run | Seconds a start can run before the control center stops it (0 = no limit, a week at most, 7.27.19+). |
save-scenario validates it -- the same rules the console’s editor applies --
and writes every column: a key the new document leaves out is emptied, not
kept.
Two editors of one scenario (since 7.25.16). scenarios answers each
scenario with its treedb metadata, and its __md_treedb__.g_rowid is the
REVISION it was read at: every save moves it. Sent back as revision=, a save
over a scenario somebody saved (or deleted) since is refused, naming who, and
the editor reads it again instead of the last writer silently winning.
Without revision (or with 0) there is no check: a new scenario, or an
overwrite asked for on purpose. updated_at is not used for this: it counts
seconds, and two saves in one second look the same.
ycommand ... -c 'scenarios scenario_id=t1' # ... "__md_treedb__": {"g_rowid": 7, ...}
ycommand ... -c 'save-scenario revision=7 scenario={...}' # saved: the answer carries g_rowid 8
ycommand ... -c 'save-scenario revision=7 scenario={...}' # -> scenario 't1' was saved by ana since you read it (revision 8, yours 7): read it againycommand --url=wss://<cc-host>:1996 --yuno-role=controlcenter --yuno-service=controlcenter \
-c 'save-scenario scenario={"id":"t1","node":"node-a","yunos":[{"id":"7301"}],"actions":{"report":[{"yuno":"7301","command":"help"}]}}'
ycommand ... -c 'scenarios'
ycommand ... -c 'scenarios scenario_id=t1'
ycommand ... -c 'delete-scenario scenario_id=t1' # and its runsRunning an action. run-scenario scenario_id=<id> action=<action> sends
each step, in order, to the yuno’s node as
command-yuno id=<yuno> [service=<service>] command=<command>carrying the user who asked (__username__, what the agent’s audit records).
How the steps go depends on the action:
startandresumeare serial. A step goes only when the one before it answered. A step that fails, does not answer inrun_step_timeout(30000 ms), or whose node’s agent disconnects meanwhile, ends the run there -- the last at once, not at the deadline. The order is the order of the start: what one yuno needs is started first.stop,pauseandreportsend every step at once (7.28.4+), and give them all onerun_step_timeout. Each step’s result is recorded. A step that fails does not keep the others from going. The run ends when every step has answered, failed, or timed out, with result-1if any did not succeed, and the comment names them (“2 of 16 steps failed; step 0 (gen1): ...; step 5 (gen6): not answered in 30000 ms”). A step on a node whose agent is not connected fails at once. An agent that disconnects fails only its own steps. A step whose agent’s link is closing fails at once too, with the link’s reason (“... not in session”), in a serial run and in a run at once. Up to 7.30.26 it waited forrun_step_timeout. Up to 7.28.3 these were serial too, so a stop ended at the first yuno that did not answer, and the yunos after it never got the stop (the max_run stop of a scenario whose first simulator was already stopped failed every minute, and stopped nothing).
A node of a step that is a name more than one node gives (see
A node is reached by its uuid) is said as such
(7.30.16+). A serial run (start, resume, on) does not start. Otherwise it does
the steps before it and stops there. A run at once does every step it reaches,
and fails the steps on that name:
run-scenario scenario_id=t1 action=start
# -> -1 "controlcenter^cc: cannot run 'start' of 't1': node 'board-b' is the hostname of more than one node: give its node uuid"
run-scenario scenario_id=t1 action=stop
# -> -1 "... stop failed, 1 of 2 steps done: 1 of 2 steps failed; step 1 (command-yuno id=5678 command=pause-load): node 'board-b' is the hostname of more than one node: give its node uuid"In 7.30.15 both said “node ‘board-b’ is not connected”, and a start did its steps up to that one.
The run is written to scenario_runs -- action, user, start and
end, the result and the answer of every step, and for a report what each
step answered (data) -- and the requester is answered with it (the command
answers when the run is OVER). One run at a time.
A step is marked in its __md_iev__ (cc_run, cc_step) and its answer is
taken only from the channel of the agent it went to: command-agent removes
those two keys from what a client forwards, and an answer that carries them
from anywhere else is dropped with a warning (“answer of a scenario run step
not from the agent of the step, dropped”). Up to 7.25.20 a client with
command-agent was able to end, or advance, another user’s run with an answer of
its own.
ycommand ... -c 'run-scenario scenario_id=t1 action=report'
ycommand ... -c 'scenario-runs scenario_id=t1' # newest firstThe parameter is scenario_id, never id: reached through an agent’s
command-yuno, the whole kw is the filter that picks the yuno, and there id
is the yuno’s.
The permissions read-scenarios, write-scenarios and run-scenarios are
checked by the commands themselves, always -- not only when the yuno turns
enable_command_authz on. The agent runs each step on the control center’s
own session, so write-scenarios together with run-scenarios is as much
as command-agent: whoever can write a scenario and run it can send any
command to any yuno of a connected node. Grant them as you grant
command-agent.
A user who may see one scenario (7.27.15+)¶
A role can grant a permission for some scenarios only: its parameters
scope what it grants (C_AUTHZ, see
Scoped permissions). The control center asks
every scenario permission with the scenario_id the command acts on -- a kw
it builds, with the authenticated user and nothing else of the request, so a
scenario_id put beside another scenario answers nothing. The three
permissions declare scenario_id as the key they can be scoped on (7.27.15)
-- and a
role row like this one, in the control center’s authz store, lets its users
read load-test and nothing else:
{
"id": "load-test-viewer",
"description": "Sees the scenario load-test",
"realm_id": "<the realm of the control center>",
"service": "controlcenter",
"permission": "read-scenarios",
"parameters": {"scenario_id": ["load-test"]}
}To let them run its actions too, the same role carries
"permissions": [{"permission": "run-scenarios"}] -- an entry without
parameters takes the role’s. Never service: "*" (a superuser) and never
command-agent for such a user: that one sends any command to any node.
What the scope does in each command:
| Command | A user whose read-scenarios is scoped |
|---|---|
scenarios | Lists only the scenarios in scope. Asked by scenario_id for another one, -1 “no permission to ‘read-scenarios’” |
scenario-runs, watch-scenario | Only for a scenario in scope |
save-scenario, delete-scenario | Need write-scenarios on that scenario (scoped the same way, on the id saved or deleted), and run-scenarios too while it runs |
run-scenario | Needs run-scenarios on that scenario |
command-agent, stats-agent, list-agents | Refused: not granted |
Watching a scenario without command-agent. The live view of the console
watched the yunos of a scenario with command-agent cmd2agent="watch-yuno-stats ids=..." to each node -- which needs command-agent. watch-scenario asks
only read-scenarios on the scenario, and the control center BUILDS the
watch itself from the scenario it keeps: the yunos of that node (keys=, a
comma-separated list of yuno keys, narrows it), with period=. stop=1 ends
it. A yuno with a queue_service is watched on that service too, so the
queue of a gate towards its store comes in the same reading. The readings
return as EV_YUNO_STATS, as through command-agent (the client says it
takes them in its __relays__). The agent never gets a
line the client wrote:
ycommand ... -c 'watch-scenario scenario_id=load-test node=node-b period=2000'
# -> the agent of node-b gets: watch-yuno-stats ids=gen3:sim_load,gen4:sim_load,gen5:sim_load,7601,7601:__output_side__,7604,7604:__output_side__,7605,7605:__output_side__,7501 period=2000
ycommand ... -c 'watch-scenario scenario_id=load-test node=node-b keys=events'
# -> watch-yuno-stats ids=7501 period=2000
ycommand ... -c 'watch-scenario scenario_id=load-test node=node-b stop=1'What can I do here? my-permissions answers, for the user who asks, every
permission of the control center: true, false, or the list of the
scenarios it is granted for. It needs no permission. The console asks it
before it builds its shell, and a user without command-agent gets one of
Scenarios only:
ycommand ... -c 'my-permissions'
# -> {"list-agents": false, "command-agent": false, "drop-agent": false, "logout-user": false,
# "write-tty": false, "read-scenarios": ["load-test"],
# "write-scenarios": false, "run-scenarios": ["load-test"]}When the permissions change (7.27.16+). The control center watches its
authz store and publishes EV_PERMISSIONS_CHANGED (public, no data) when a
role is created, changed or deleted, or a role is given, taken, or made the
child of another. A client subscribes to it on the service controlcenter
and asks my-permissions again. The console does, so a user given
run-scenarios while their console is open sees the actions appear without
a reload. An update of a user’s own record (its sessions, at every login) is
not announced. Only the store itself is believed: the same event from any
other source is ignored, with a WARNING at most once per 10 s (“event of the
users store not sent by the store, ignored”, MSGSET_AUTH). A peer cannot
send it anyway: a session’s EV_TREEDB_NODE_* is refused at the frontier
(7.30.27+).
gobj_subscribe_event(iev, "EV_PERMISSIONS_CHANGED", {__service__: "controlcenter"}, subscriber);A link to a scenario. The console shows a saved scenario at
https://<console>/#/scenarios/live/<id>, so that address is a link to send:
the user signs in and lands on it.
A test left running: max_run (7.27.19+). A scenario can say how long a
start can run, in seconds (0 = no limit, a week at most):
{"id": "load-test", "node": "node-b", "max_run": 2100, "yunos": [...], "actions": {...}}A start that did any step schedules the scenario’s stop max_run seconds
after it. A stop that did any step cancels it. Pause and resume leave the
clock alone. When it is due the control center runs stop itself, as a run of
its own -- user the control center, the reason in the comment (“max_run of
2100 s reached (started by ops@example.com); run ...: stop done, 16 steps”)
-- a few seconds later if
another run is in flight. A stop that was not able to do anything is written once, with
a warning, and tried again:
A node of it is connected (its yuno refused the stop, or did not answer -- restarting, perhaps): it is tried again in a minute (“the stop of a scenario’s max_run did nothing, tried again in a minute”). A save of the scenario, a report or a switch inside that minute keeps it (up to 7.29.3 they brought the stop forward to at once).
No node of it is connected: it waits (“the stop of a scenario’s max_run did nothing, tried again when a node of it connects”), and runs again when the agent of one of its nodes connects, not on a clock. A save of the scenario or another run of it does not end the wait.
A node of it is a name that more than one node gives (see A node is reached by its uuid): its agents are connected, so it is tried again in a minute, like a refused stop. Its step says “node ‘board-b’ is the hostname of more than one node: give its node uuid”. In 7.30.15 it waited for a node to connect, and nothing ended the wait.
A stop that did some steps but not all of them is not the end of the
max_run either. The steps that it did not do stay due, and they are tried
again until each one is done. The other steps are not sent again. The rules
are the same as above, applied to the nodes of those steps (“the stop of a
scenario’s max_run did not do every step, the rest tried again in a
minute”, or “... the rest tried again when a node of it connects”). The
schedule rebuilt at start keeps those steps too. For example, the yunos of
load-test are on node-a and node-b, and node-b is down when the stop
is due:
# the stop of the max_run: node-a stopped, node-b not connected
scenario-runs scenario_id=load-test
# -> "max_run of 2100 s reached (started by ops@example.com); run ...: stop failed, 1 of 2 steps done: ..."
scenarios scenario_id=load-test # stop_waits_node: true
# node-b connects: the stop goes to node-b only
# -> "...: stop done, 1 steps"While those steps are due the scenario runs, so saving or deleting it needs
run-scenarios too (below). The steps that stay due are those that the
scenario still has: a save that takes out or changes one of them drops it,
and when none is left nothing is scheduled. The control center never runs a
step that the run did not have. In 7.30.17 a stop that did some steps made
the scenario look stopped: a user with write-scenarios and no
run-scenarios was able to save a new stop, and when no step of it matched the
steps due, the control center ran the whole new stop by itself. For
example, a user with both permissions changes the stop of the yuno on
node-b while that step is due:
scenarios scenario_id=load-test # stop_waits_node: true (node-b's step is due)
save-scenario scenario={... "stop": [..., {"yuno": "gen-b", "command": "stop-load"}]}
scenarios scenario_id=load-test # no stop_at: node-b's step is not in the scenario nowA step answered “Yuno not found” did not do its work. The agent gives
that answer for a yuno that is not running, and also for a yuno that is
alive but is not connected to the agent yet: after a restart of the agent,
its yunos return some seconds later, and the stops that waited for that
agent are tried when it connects. So the stop is tried again in a minute,
as a stop that the yuno refused. In 7.30.18 such a step was done, and the
max_run of a yuno that was not connected again yet was lost at each
deploy of the agent.
The tries end:
10 tries in a row that did nothing (each a run, a WARNING and an INFO, a minute apart or at each connection of a node): the stop is not tried again, with one WARNING, “the stop of a scenario’s max_run did nothing in its last tries: not tried again” (
tries, and the comment of the last one). A try that did some steps starts the count again.scenariosthen answersstop_given_up: true(and nostop_at), and the scenario runs: saving or deleting it needsrun-scenariostoo. A save of the scenario tries the stop again, for 10 more tries. A stop by a user ends it. A restart of the control center counts all the tries again from the runs, so the stop is given up again. In 7.30.18 a stop given up was shown nowhere, and a save did not try it again:scenarios scenario_id=load-test # stop_given_up: true save-scenario scenario={"id": "load-test", ...} # the same scenario scenarios scenario_id=load-test # stop_at (past): the stop is tried again at onceA stop that cannot even start (the scenario lost its
stop, or none of the steps left is in it, changed outsidesave-scenario) writes no run. Each attempt says “the stop of a scenario’s max_run cannot run, tried again in a minute”, and counts towards the same 10, with the tries that the runs show. The last one says “the stop of a scenario’s max_run cannot run: not tried again”. These attempts are counted in memory: a save of the scenario, or a restart, counts again from the runs. In 7.30.17 such a stop was tried every minute, for ever.
In 7.30.17 a step that answered an error for ever was tried every minute, for ever.
A stop by a user that did some steps cancels the max_run, as before: the
steps that it did not do are the user’s to run again. In 7.30.16 and before,
a max_run stop that did some steps ended the schedule with no log, and the
yunos on a node that was down at that time continued to run.
Up to 7.29.1 every one was tried every minute, and every try wrote a run
while the node was down. 7.29.2 made every one wait for an agent, so a stop
refused on a connected node was never tried again. The schedule is rebuilt
from the runs at start, so a restart does not lose it. A stop already due
then waits for an agent, because no agent is connected yet. scenarios
answers it as stop_at (epoch seconds, stop_waits_node: true while it
waits for a node), and the run in flight of
the scenario, if any, as run_in_flight (id, action, username,
started_at, 7.28.4+), so a console can say that a start is still going and
not offer another. Every run that ends
publishes EV_SCENARIO_RUN_ENDED (public, no data): the console says “stops
at 18:45” while it runs, and sees it stopped -- by the control center, or by
anybody -- at once. While a scenario runs (a run of it in flight, its
max_run stop due, or its last run that did anything is not a stop), saving
it needs run-scenarios on it too (7.27.19, and the stop due, 7.30.18): a
max_run saved then schedules the stop steps saved then, so writing them
is running them. So does deleting it (after 7.29.1): the
delete takes its stop steps and its max_run stop, and leaves its yunos as
they are -- “scenario ‘x’ runs: deleting it needs ‘run-scenarios’ too”:
ycommand ... -c 'delete-scenario scenario_id=load-test' # stop it first, or hold run-scenariosA generator turned on or off by hand: the switch of a yuno (7.28.6+).
To climb the load one fleet at a time, a yuno can carry a switch: two lists
of steps, on and off, as those of an action, where a step that names no
yuno goes to the switch’s own:
{"key": "gen2", "id": "gen2", "service": "sim_load", "rate": "tx", "node": "node-a",
"switch": {
"on": [{"command": "set-streams streams=20"}, {"command": "set-interval interval=1000"},
{"command": "set-clients clients=100"}, {"command": "resume-load"}],
"off": [{"command": "pause-load"}, {"command": "set-clients clients=0"}]
}}ycommand ... -c 'run-scenario scenario_id=load-test action=on scenario_yuno=gen2'
ycommand ... -c 'run-scenario scenario_id=load-test action=off scenario_yuno=gen2'save-scenario refuses a switch without both lists, or with a step that
names no yuno of the scenario. on runs in order and ends at the first step
that fails, as a start does. off sends every step at once, as a stop does.
on is refused unless the scenario RUNS -- its last run that changed its
state is a start or a resume (“a switch is turned on only while its
scenario runs”) -- because a scenario that is not running has no max_run
stop to turn it off again. off runs in any state. A switch run is a run
like the others (one at a time, under run-scenarios, written in
scenario_runs with its steps, answered “run ...: on gen2 done, 4 steps”,
told by EV_SCENARIO_RUN_ENDED), but it changes neither the state of the
scenario nor its max_run clock: the scenario’s stop is what turns every
switch off, so its steps must reach every yuno that has one. run_in_flight
carries the scenario_yuno of a switch run. The web console draws the switch
on the yuno’s card, ON while its throughput is not zero.
What a step can carry. A scenario id is letters, digits and _ . @ -, not
starting with a dot, 200 characters at most (a run id is <id>.<ms>). The
id, key and service of a yuno, and the service of a step, are letters,
digits and _ . ^ -. A step’s command is a name and key=value parameters
without blanks, and a parameter must NOT be named like a parameter of
command-yuno (id, service, command) or like a column of the agent’s
yunos topic (yuno_name, date, global, realm_id, ...): the agent takes
the whole kw of command-yuno as the filter that selects the yuno, so such a
parameter picks another yuno or none. save-scenario refuses it:
ycommand ... -c 'save-scenario scenario={"id":"t2","node":"node-a","yunos":[{"id":"7301"}],"actions":{"stop":[{"yuno":"7301","command":"set-x date=1"}]}}'
# -> ... actions.stop[0]: command: the parameter 'date' is command-yuno's or a yuno's field: it would select the yunoNor can a parameter start with __ (__md_iev__, __username__,
__md_command__, ...): those are the framework’s keys, and the agent’s command
parser sets the parameters of the line over the kw -- a __md_iev__ then
replaces the routing of the step’s answer (the run waits for its deadline), a
__username__ the user the control center stamps.
ycommand ... -c 'save-scenario scenario={"id":"t3","node":"node-a","yunos":[{"id":"7301"}],"actions":{"stop":[{"yuno":"7301","command":"set-x __username__=root"}]}}'
# -> ... actions.stop[0]: command: the parameter '__username__' is a framework key: it would replace what the control center setsrun-scenario checks the steps of the action again before it sends the first
one, so a scenario saved before a check existed (by 7.25.14, which checked no
step) is refused by name until it is saved again:
ycommand ... -c 'run-scenario scenario_id=t1 action=stop'
# -> ... cannot run 'stop' of 't1': step 0: command: the parameter 'date' is command-yuno's or a yuno's field: it would select the yuno; save the scenario againConfiguration¶
The yuno composes authz (C_AUTHZ) + controlcenter (C_CONTROLCENTER,
default service). Authz.max_sessions_per_user defaults to 4.
An operator’s token opens a session only while it is young, if
Authz.max_token_age is set (7.30.14+, details). The
identity provider can give a token a long life, and this is the control
center’s own limit. The agents of before 7.30.10 log in with a token that
cannot be renewed, so their user is exempt:
"global": {
"Authz.max_token_age": 3600,
"Authz.token_age_exempt_users": ["agent@example.com"]
}ycommand logs in with a new token on each run. The agent console refreshes
its token and connects again when the control center refuses an old one.
Key attributes of C_CONTROLCENTER:
| Attribute | Purpose |
|---|---|
run_step_timeout | Milliseconds a step of a scenario run can take to answer (30000) |
drops_warning_window | Milliseconds of the window of a capped warning (60000) |
timeout | Period of the rate tick, ms (1000): rxMsgsec/txMsgsec and their maxima |
The listen URLs/ports live in the realm config (__top_side__ /
__input_side__), not in the binary. Neither side is autostarted nor
autoplayed: the control center starts both in its mt_play, where it
subscribes to them, and stops them in its mt_pause. An autostarted
__input_side__ listens from the yuno’s start (C_TCP_S listens in its
mt_start), so an agent that connects to a control center run with play=0
logs “Publish event WITHOUT subscribers”, and a paused control center
accepts agents.
{
"name": "__input_side__",
"gclass": "C_IOGATE",
"autostart": false,
"autoplay": false,
"kw": {"persistent_channels": false}
}Stats¶
The messages it relays, counted once each way:
rxMsgs, in: a client’scommand-agent,stats-agent,write-ttyandrun-scenario, and every answer or stream an agent sends (command and stats answers, the console PTY,EV_YUNO_STATS, a run step’s answer).txMsgs, out: eachcommand-agent/stats-agent/write-ttyrequest sent to an agent and each step of a run (not one the agent’s link refused at once), and each answer or stream relayed to a client, the answer of a run included.
rxMsgsec/txMsgsec are their rates in messages by second, computed on a
tick every timeout ms (1000) over the EXACT interval since the previous
tick: a reading only returns the last tick’s value, so it is the same
whoever reads and however often. maxrxMsgsec/maxtxMsgsec keep the highest
rate of any tick, a burst nobody read included. Write 0 to start them again.
stats=__reset__ zeroes the counters, the rates and the maxima. drops_timer_armed says whether a capped
warning has a count waiting for its window.
The tick is a real period (a C_TIMER0, io_uring), and runs only while the
control center plays: paused, the rates read 0. A timeout under 1 ms, in the
config or written, is refused with an ERROR and 1000 is put back. Up to
7.25.21 the tick was a C_TIMER, which checks its deadline on the yuno’s
timeout_periodic (1000 ms) and re-arms from when it was served, so a tick of
1000 came every 1 or 2 s and a burst of one second in a tick of two was halved
in the maxima. A timeout under 1 in the config was not checked (the tick was
off and the rates read 0), and paused, the rates kept the last tick’s value.
ycommand -c 'stats-yuno id=<cc> service=controlcenter'
# ... "rxMsgs": 1520, "txMsgs": 1519, "rxMsgsec": 12, "txMsgsec": 12, "maxrxMsgsec": 140, ...Up to 7.25.20 nothing counted them and the tick that computed the rates was never armed: all six read 0.
Commands¶
| Command | Description |
|---|---|
list-agents | List currently connected nodes (UUID, role and version, hostname, os). uuid, version, hostname, os: regular expressions the agent must match, all of them |
command-agent | Forward a command to one node (agent_id, agent_service, cmd2agent) |
stats-agent | Fetch stats from a node |
info-machine | The machine of a node (agent_id: uuid or hostname): os, cpu, memory, disks, network interfaces, uptime, as its agent’s yuno answers info-machine (permission list-agents, 7.31.23+) |
drop-agent | Drop every session of a node (agent_id: its uuid, or a hostname that one node has, or empty: every agent) |
list-nodes | The nodes and the keys of their agents, each with connected, version and os (of its agent in session, empty while it is away) and key: the accepted one, else the one presented (state: pending, accepted, refused, knocking or other-key, or empty: all; an other-key row is the key that the agent of an accepted node presents instead of its own, and the comment says what to do with it). uuid, version, hostname, os: regular expressions the node must match, all of them, as in list-agents (list-nodes state=accepted hostname=^box-). ycli shows a table: node uuid, hostname, state, connected, version, os, address, last seen, and the start of the key. The keys whole (64 characters) are in its form view: *list-nodes state=knocking |
accept-node | Pin a node’s uuid to its key (node_id, and spki_sha256: the key the node gives, or presented: the start of it, at least 16 hex, to pin the key the node presented if it starts so. Permission manage-nodes) |
refuse-node | Refuse a node. Its sessions are dropped (node_id, permission manage-nodes) |
delete-node | Delete the record of a node refused or pending, with no agent connected (node_id, permission manage-nodes). An accepted node is refused first (7.31.22+) |
write-tty | Write to the PTY console of one node (via agent22). agent_id is required. It is an event (EV_WRITE_TTY), not a command line. Without the permission write-tty it is answered as a command is, EV_MT_COMMAND_ANSWER with -1 “No permission to ‘write-tty’ in service ‘controlcenter’” (in 7.30.17 the answer was an EV_WRITE_TTY that no client takes, and the refusal freed the request twice) |
logout-user | Log out a user (username, permission logout-user). disabled=1 also disables the user and disabled=0 enables it. Without disabled the user stays as it is |
scenarios | List the scenarios, or one (scenario_id) |
save-scenario | Create or replace a scenario (scenario) |
delete-scenario | Delete a scenario and its runs (scenario_id) |
run-scenario | Run the steps of an action, in order (scenario_id, action) |
scenario-runs | The runs of a scenario, newest first (scenario_id) |
watch-scenario | Watch the yunos of a scenario on one node, the watch built here (scenario_id, node, keys, period, stop) |
my-permissions | The permissions of the user who asks: true, false, or the scenarios it is granted for. EV_PERMISSIONS_CHANGED says when to ask again |
authzs | Authorization help |
help | Command help |
logout-user drops the sessions of a user. disabled is passed on only when
it is given:
ycommand -c 'command-yuno id=<cc> service=controlcenter command=logout-user username=bob@example.com'
ycommand -c 'command-yuno id=<cc> service=controlcenter command=logout-user username=bob@example.com disabled=1'The first leaves bob as he is: up to 7.30.14 it also enabled him if he was disabled, and no permission was asked.
Ports¶
| Port | Used by |
|---|---|
1991 | Agent local plaintext control plane (ws://127.0.0.1:1991) |
1993 | Agent secure control plane (wss://0.0.0.0:1993) |
1988 | Primary agent → control center (default __output_url__) |
1989 | agent22 → control center |
1994 | Primary agent → control center, agents before 7.30.4 |
1995 | agent22 → control center, agents before 7.30.4 |
1996 | Control center listener, agents plane (production realm config) |
1997 | Control center listener, agent22 plane (production realm config) |
1992 | UDP log sink |
Debugging¶
| GClass | Level | Shows |
|---|---|---|
C_CONTROLCENTER | messages | Message flow |