Discovery and Transport
On Linux, the system image, apps, and services publish their records as JSON files in standard directories, and tools read the records from there. For example, on the gateway from the overview, the system image ships its component declaration as /usr/lib/system-runtime/components/system.gateway-os.json, and a service of the telemetry app writes the result of its latest database check to /run/system-runtime/health/status/app.telemetry.postgres.json. This page describes where the files go, how to write them, how readers find and combine them, and how to send health information to another system.
Why Files
Records are published as plain files rather than through a central service or API. Files let each contributor publish its records in the way that suits it best:
- The system image ships its declarations as part of its root filesystem, so they change exactly when the system image does.
- An app ships its declarations inside its installation directory, so they appear and disappear with the app.
- A service writes its status records whenever it has run a check, without knowing which tools will read them, and without failing when none is running.
Readers, in turn, load the records whenever they need them. No daemon has to run for records to be published, and a reader that starts late still sees the current records.
Directory Layout
The specification defines standard directories for each kind of record:
| Records | Standard Directories |
|---|---|
| Component declarations | /usr/lib/system-runtime/components/etc/system-runtime/components/run/system-runtime/components |
| Health nodes | /usr/lib/system-runtime/health/nodes/etc/system-runtime/health/nodes/run/system-runtime/health/nodes |
| Health status records | /run/system-runtime/health/status |
| Metric definitions | /usr/lib/system-runtime/metrics/definitions/etc/system-runtime/metrics/definitions/run/system-runtime/metrics/definitions |
| Metric samples | /run/system-runtime/metrics/samples |
| Directory configurations | /usr/lib/system-runtime/directories/etc/system-runtime/directories/run/system-runtime/directories |
The three locations for definitions follow common Linux conventions:
/usr/lib/system-runtimeholds records that belong to the system image, such as its component declaration and the health nodes of its checks./etc/system-runtimeholds records specific to a device, such as records that an administrator adds for a single device./run/system-runtimeholds records generated at runtime, such as the board revision that a service reads from the hardware at boot. It is typically on a temporary filesystem and empty after every boot.
The standard directories for status records and metric samples exist only below /run/system-runtime, because these records are only valid during the boot in which they were published. Directory configurations add further directories, for example, those of apps, as described in Adding Directories.
Publishing Records
Each record is a regular file with the extension .json that contains exactly one record of the directory’s kind. The file name is up to the publisher; the record’s ID determines its identity. Writers omit optional fields that are not set.
Readers may load a file at any moment, including while it is being written. To prevent them from reading a partially written file, write the record to a temporary file with a different extension in the same directory, then rename it to its final name. Renaming within a directory replaces a file atomically. There are no transactions across files, so a reader may see a new version of one file and an old version of another.
For example, the following script checks with pg_isready whether PostgreSQL accepts connections and publishes the result as a status record for the app.telemetry.postgres node from Health. A systemd timer can run it every 5 seconds:
#!/bin/sh
# Take the time before running the check, so that a slow check does
# not extend the validity of its result. /proc/uptime contains the
# boot-time clock in seconds.
boot_id=$(cat /proc/sys/kernel/random/boot_id)
observed_at_ms=$(awk '{ printf "%.0f", $1 * 1000 }' /proc/uptime)
if pg_isready -q -h 127.0.0.1 -p 5432; then
state=healthy message="Accepting connections"
else
state=unhealthy message="Not accepting connections"
fi
dir=/run/system-runtime/health/status
mkdir -p "$dir"
cat > "$dir/app.telemetry.postgres.json.tmp" <<EOF
{
"id": "app.telemetry.postgres",
"owner": "rugix.apps.telemetry",
"state": "$state",
"bootId": "$boot_id",
"observedAtMs": $observed_at_ms,
"maxAgeMs": 15000,
"message": "$message"
}
EOF
mv "$dir/app.telemetry.postgres.json.tmp" "$dir/app.telemetry.postgres.json"
Each status record and each metric sample has exactly one publisher. The directories do not authenticate publishers, so restrict write access to them. To let an unprivileged service publish its records without giving it access to the records of other services, give the service a directory of its own and add it with a directory configuration.
Reading Records
A reader collects the records of each kind from all directories of that kind and combines them. Records in different directories do not override each other, so a file in /etc/system-runtime with the same name as a file in /usr/lib/system-runtime adds a second record. Two components with the same ID make the composition inconsistent, and two health or metric records of the same kind with the same ID make evaluation fail.
To read the records of one kind, a reader:
- Loads the directory configurations and appends their directories to the standard directories.
- Visits the directories in order and traverses each recursively, visiting entries in lexical order.
- Reads every regular file with the extension
.json, skipping files with other extensions and symlinks inside the directories. - Reads each file only once, even when several directories overlap.
Missing directories are skipped. A path that exists but is not a directory, a broken symlink in place of a directory, a file that cannot be read, and a file that does not contain a valid record are errors. Readers ignore unknown fields in records, so records with fields added by a newer version of the specification remain readable. New kinds of health rules or new units, in contrast, require updated readers.
Because records can change at any moment, a reader loads a fresh set of records before acting on them. If loading fails because a file changed during the read, for example, because it was removed, the reader loads the records again. The language packages report such failures as errors and leave retrying to the caller.
Adding Directories
A directory configuration adds directories in which readers look for records. Readers load directory configurations from /usr/lib/system-runtime/directories, /etc/system-runtime/directories, and /run/system-runtime/directories. For example, a Node-RED installation in /opt/node-red can add its own directories, including a status directory for its service, with /etc/system-runtime/directories/node-red.json:
{
"components": ["/opt/node-red/components"],
"healthNodes": ["/opt/node-red/health/nodes"],
"healthStatuses": ["/run/node-red/health/status"]
}
Paths must be absolute. A path segment consisting of only * matches every directory at that level, in lexical order. Readers expand such patterns every time they load records, so one configuration covers installations added later. Relative paths, .. segments, and other wildcards, such as *.d or **, make loading fail.
Wildcards only match real directories, not symlinks to directories. Explicit path segments, in contrast, may be symlinks, such as the current symlink of Rugix Apps. A reader resolves every matched directory to its physical location before reading its files. If the symlink changes while the reader traverses the directory, the reader still reads all files from the directory it resolved first, never a mix of both.
Directory configurations cannot add further directory configurations.
Discovering Rugix Apps
Rugix Apps keeps each installed version of an app, a generation, in its own directory. A current symlink in the app’s directory points to the active generation. An app’s payloads can place health nodes in the .rugix/health/nodes directory of the generation, as described in Rugix Apps Internals. Adding the following configuration to the system image, for example, as /usr/lib/system-runtime/directories/rugix-apps.json, makes the health nodes and component declarations of all active apps visible to readers:
{
"components": ["/run/rugix/state/apps/*/current/.rugix/components"],
"healthNodes": ["/run/rugix/state/apps/*/current/.rugix/health/nodes"]
}
If Rugix state management is not active, apps live in /var/lib/rugix/apps instead of /run/rugix/state/apps.
The current symlink makes this configuration follow the app’s lifecycle. While Rugix Apps switches to a new generation, the symlink keeps pointing to the previous generation and changes atomically once the new generation has been activated successfully. If activation fails and Rugix Apps rolls back, the symlink never changes. When an app is activated for the first time, the symlink appears once activation has succeeded. After an app has been deactivated or has entered the Error state, the symlink is removed, and the app’s records disappear.
Rugix Ctrl’s Component Directories
For its compatibility checks, Rugix Ctrl reads component declarations from its own directories. The following configuration, for example, as /usr/lib/system-runtime/directories/rugix.json, makes them visible to readers of the specification:
{
"components": [
"/usr/lib/rugix/components",
"/etc/rugix/components",
"/run/rugix/components"
]
}
Rugix Ctrl accepts component declarations in TOML or JSON, while readers of the specification only read .json files. Write declarations in JSON, including those shipped with apps, to make them visible to both. Give them an owner as well, because readers do not derive owners from directories.
Rugix Ctrl also adds a rugix.host component with the capabilities host.arch and rugix.ctrl when it checks compatibility. This component does not exist as a file, so for other readers, requirements on these capabilities remain unsatisfied unless another component provides them.
Sending Health to Another System
A fleet-management server or a remote diagnostic tool may want to show a device’s health. Sending only the evaluated states loses the information an operator needs to understand them: which checks a function depends on, what each check reported, and when it ran. A health snapshot therefore contains the records themselves, so that the receiver can evaluate and display the complete graph. It contains:
- the health nodes,
- the status records, unchanged,
- metric definitions and samples, including at least the definition of every metric referenced by a threshold node, and
- a clock sample of the observed system.
The status records carry their observation times on the boot-time clock of the device, which the receiver cannot interpret on its own. The clock sample connects that clock to the wall clock: it contains the device’s boot ID and boot time together with the device’s wall-clock time at the same moment. Collect the records first and take the clock sample afterwards, so that no record appears to be observed after the sample was taken.
{
"context": {
"bootId": "e09a482c-4a41-4f95-891e-042af3d3c4a4",
"nowMs": 45000
},
"timestamp": "2026-10-14T12:00:00Z"
}
With this sample, the receiver can estimate when a check ran. For a status record from the same boot, the observation time is the sample’s timestamp minus the difference between the sample’s nowMs and the record’s observedAtMs. The status record of the database check from the overview, observed at boot time 42000, ran 3 seconds before the sample, at about 2026-10-14T11:59:57Z. The estimate is only as accurate as the device’s wall clock at the time of sampling. For a record from another boot or with an observation time after the sample, no wall-clock time can be estimated.
To determine the device’s health, the receiver evaluates the snapshot with the sample’s context as the current boot and time. The result describes the device’s health at the moment the snapshot was taken, because transport does not renew the validity of records. A tool that needs the current health of the device evaluates the records on the device itself.
Reference
Directory Configurations
DirectoryConfig
Additional absolute directory paths supplied by packages or administrators.
Whole * path segments match real directories in lexical order on each load.
Explicit path segments may follow symlinks; .. and partial wildcards are invalid.
Fields (JSON object)
componentsoptionalAdditional component declaration directories.
array<string>
Items
stringhealthNodes(fromhealth_nodes)optionalAdditional health definition directories.
array<string>
Items
stringhealthStatuses(fromhealth_statuses)optionalAdditional health status directories.
array<string>
Items
stringmetricsoptionalAdditional metric definition directories.
array<string>
Items
stringmetricSamples(frommetric_samples)optionalAdditional metric sample directories.
array<string>
Items
string
Health Snapshots
HealthSnapshot
Transport view of a health graph and the evidence used to evaluate it.
Fields (JSON object)
clockrequiredClock correlation sampled after collecting the records.
HealthClockSample
Fields (JSON object)
contextrequiredBoot identifier and boot-time milliseconds at sampling.
HealthContext
Fields (JSON object)
bootId(fromboot_id)requiredCurrent boot identifier.
stringnowMs(fromnow_ms)requiredCurrent boot-time clock value in milliseconds.
integer (i64)
timestamprequiredWall-clock timestamp at the same instant, serialized as an RFC 3339 string.
timestamp
nodesrequiredHealth definitions, including their owners.
array<HealthNode>
Items
HealthNode
Fields (JSON object)
idrequiredUnique health node ID.
HealthNodeId
Wraps
stringowneroptionalOwnership group for replacement or removal, matched exactly.
stringlabeloptionalHuman-readable label.
stringcomponentsoptionalRelated component IDs; these associations do not imply health dependencies.
array<string>
Items
stringruleoptionalHow this node's health is determined; omitted means an observed node without constraints.
HealthRule
Casesinternally — tag field
typeObserved→"observed"Health is supplied by an external status record.
{ "type": "observed", ...<payload fields> } — or "content" for non-object payloadsObservationRule
Fields (JSON object)
maxAgeMs(frommax_age_ms)optionalOptional consumer limit on status age, in milliseconds.
integerexpectedTag(fromexpected_tag)optionalOptional tag that published status records must match exactly.
string
Threshold→"threshold"Health is derived from a fresh metric sample.
{ "type": "threshold", ...<payload fields> } — or "content" for non-object payloadsThresholdRule
Fields (JSON object)
metricrequiredMetric definition supplying the unit, identity, and freshness constraints.
MetricId
Wraps
stringhealthyrequiredDesired range; must be a subset of the usable range.
MetricRange
Fields (JSON object)
loweroptionalOptional lower endpoint.
MetricBound
Fields (JSON object)
valuerequiredFinite endpoint in the referenced metric's unit.
numberinclusiverequiredWhether equality with this endpoint is inside the range.
boolean
upperoptionalOptional upper endpoint.
MetricBound
Fields (JSON object)
valuerequiredFinite endpoint in the referenced metric's unit.
numberinclusiverequiredWhether equality with this endpoint is inside the range.
boolean
usablerequiredMinimum range for usability.
MetricRange
Fields (JSON object)
loweroptionalOptional lower endpoint.
MetricBound
Fields (JSON object)
valuerequiredFinite endpoint in the referenced metric's unit.
numberinclusiverequiredWhether equality with this endpoint is inside the range.
boolean
upperoptionalOptional upper endpoint.
MetricBound
Fields (JSON object)
valuerequiredFinite endpoint in the referenced metric's unit.
numberinclusiverequiredWhether equality with this endpoint is inside the range.
boolean
maxAgeMs(frommax_age_ms)optionalOptional consumer limit on sample age, in milliseconds; must be positive.
integer
Aggregate→"aggregate"Health is evaluated from other nodes.
{ "type": "aggregate", ...<payload fields> } — or "content" for non-object payloadsAggregationRule
Fields (JSON object)
inputsrequiredDependencies with distinct node IDs.
array<AggregationInput>
Items
AggregationInput
Fields (JSON object)
noderequiredReferenced health node ID.
HealthNodeId
Wraps
stringrequiredoptionalWhether this dependency must meet minimum and desired criteria; omitted means false.
booleanoptionaloptionalWhether this dependency only affects desired criteria; omitted means false. Must not be combined with required.
boolean
requiredoptionalMinimum healthy or degraded count of non-optional inputs, including mandatory inputs; omitted means the healthy count.
integerhealthyoptionalDesired healthy count of non-optional inputs, including mandatory inputs; omitted means all non-optional inputs. Must satisfy 1 <= required <= healthy <= non-optional inputs.
integer
statusesrequiredOriginal status records; observation times and validity are preserved.
array<HealthStatus>
Items
HealthStatus
Fields (JSON object)
idrequiredObserved node ID.
HealthNodeId
Wraps
stringowneroptionalOwnership group; must match the node's owner when one is specified.
stringstaterequiredReported health.
HealthState
Casesexternally
Healthy→"healthy"Desired health criteria are confirmed.
Value: "healthy"Degraded→"degraded"Minimum criteria are confirmed; desired criteria are unconfirmed or unmet.
Value: "degraded"Unhealthy→"unhealthy"Minimum criteria are confirmed to be unmet.
Value: "unhealthy"Unknown→"unknown"Evidence does not determine whether minimum criteria are met.
Value: "unknown"
bootId(fromboot_id)requiredBoot identifier defining the observation clock domain.
stringobservedAtMs(fromobserved_at_ms)requiredMilliseconds on the boot-time clock when health was observed.
integer (i64)maxAgeMs(frommax_age_ms)requiredFinite positive validity duration in milliseconds.
integertagoptionalOpaque label identifying the check configuration or instance.
stringmessageoptionalExplanation supplied by the observer.
string
metricsoptionalMetric definitions used by threshold nodes or displayed independently.
array<MetricDefinition>
Items
MetricDefinition
Fields (JSON object)
idrequiredUnique metric ID.
MetricId
Wraps
stringowneroptionalOwnership group for replacement or removal, matched exactly.
stringlabeloptionalHuman-readable label.
stringcomponentsoptionalRelated component IDs; these associations do not imply health dependencies.
array<string>
Items
stringunitrequiredUnit shared by samples and all thresholds referencing this metric.
MetricUnit
Casesexternally
Celsius→"celsius"Degrees Celsius; consumers may convert for display.
Value: "celsius"Bytes→"bytes"Bytes; consumers may display decimal or binary prefixes.
Value: "bytes"Seconds→"seconds"Seconds; consumers may display subsecond units.
Value: "seconds"Ratio→"ratio"Dimensionless fraction, with 1 corresponding to 100 percent.
Value: "ratio"Count→"count"Number of items or events.
Value: "count"BytesPerSecond→"bytes-per-second"Bytes per second.
Value: "bytes-per-second"Hertz→"hertz"Cycles per second.
Value: "hertz"Volts→"volts"Electric potential in volts.
Value: "volts"Amperes→"amperes"Electric current in amperes.
Value: "amperes"Watts→"watts"Power in watts.
Value: "watts"RevolutionsPerMinute→"revolutions-per-minute"Revolutions per minute.
Value: "revolutions-per-minute"
maxAgeMs(frommax_age_ms)optionalOptional consumer limit on sample age, in milliseconds; must be positive.
integerexpectedTag(fromexpected_tag)optionalOptional tag that samples must match exactly.
string
metricSamples(frommetric_samples)optionalOriginal metric samples; sample times and validity are preserved.
array<MetricSample>
Items
MetricSample
Fields (JSON object)
idrequiredMeasured metric ID.
MetricId
Wraps
stringowneroptionalOwnership group; must match the definition's owner when specified.
stringvaluerequiredFinite measurement in the definition's unit.
numberbootId(fromboot_id)requiredBoot identifier defining the sample clock domain.
stringobservedAtMs(fromobserved_at_ms)requiredMilliseconds on the boot-time clock when the measurement was taken.
integer (i64)maxAgeMs(frommax_age_ms)requiredPositive validity duration in milliseconds.
integertagoptionalOpaque label identifying the measurement configuration or instance.
stringmessageoptionalExplanation supplied by the observer.
string
Clock sample timestamps use RFC 3339 in UTC, ending in Z, and may include fractional seconds. Estimated observation times have millisecond precision and are only defined for the years 0001 to 9999.