Skip to main content
Documentation
Preview
You're viewing the Next docs — a rolling preview of in-development changes. The current release docs may differ.

Command Line

The nexigon-agent binary runs the agent and lets scripts and applications on the device read and write device data. Run nexigon-agent --help, or append --help to any command, for its options.

nexigon-agent [OPTIONS] <COMMAND>
OptionDescription
--config <PATH>Configuration file. Defaults to /etc/nexigon/agent.toml.
--log-level <LEVEL>off, error, warn, info, debug, or trace.
--log-format <FORMAT>compact or full.

How Commands Reach Nexigon Hub

nexigon-agent run starts the agent, which the service manager does on a device. The device, events, and repositories commands act as the device. On Unix, they first try the running agent’s local API, which sends their requests over the agent’s connection; they fail if the agent reports that it is disconnected. If the local API is unavailable, for example because the agent does not run or the API is disabled, and on other platforms, they connect to Nexigon Hub themselves with the configured credentials. status always needs the local API. Commands print their results as JSON, except device id, which prints the plain device ID.

Agent

CommandDescription
nexigon-agent runRun the agent.
nexigon-agent statusPrint the connection status of the running agent. Unix only.

Device

CommandDescription
nexigon-agent device idPrint the device ID.
nexigon-agent device properties get <NAME>Print a device property.
nexigon-agent device properties set <NAME> <VALUE>Set an unprotected device property to a JSON value.
nexigon-agent device tokens issueIssue a device token for an application.

device tokens issue accepts --valid-for <SECONDS> and --claims <JSON> with additional claims.

Events

nexigon-agent events emit [OPTIONS] <BODY>

Emits a device event with a JSON body.

OptionDescription
--severity <SEVERITY>trace, debug, info, warning, error, or critical. Defaults to info.
--category <CATEGORY>Event type, such as com.example.sensor.connection.
--attribute <NAME>=<JSON>Named JSON value. Repeat for several attributes.
--emitted-at <TIMESTAMP>Time of the event in RFC 3339. Defaults to now.

The agent does not buffer events. Without a connection to Nexigon Hub, the command fails.

Repositories

The nexigon-agent repositories commands read and manage repositories with the device’s permissions. A device can read the repositories that are public or linked to its project. The commands and their arguments match the repository commands of Nexigon CLI. For example, an updater on the device requests a download URL with:

nexigon-agent repositories issue-url my-repo/controller/stable/controller-aarch64.rugixb