Skip to main content
Documentation

Report Device Events

Emit structured events from a device, so that operators can follow what happened on it over time. A device property holds a current value, such as the latest sensor reading; an event records an occurrence, such as a disconnected sensor, with a severity, a category, and attributes.

You need a device connected through Nexigon Agent. The agent sends each event immediately and does not buffer events while the device is offline, so emitting an event fails without a connection to Nexigon Hub. Handle that failure in your application if it depends on the event’s delivery.

Emit an Event

Run this on the device:

nexigon-agent events emit '"Sensor service started"'

The body is any JSON value. A text body needs JSON double quotes inside the shell’s single quotes, as above. An object lets consumers read individual fields without parsing a message:

nexigon-agent events emit '{"temperature_c": 24.5, "sensor": "ambient"}'

The device’s event log in Nexigon shows both events.

Classify Events

Classify an event with a severity, a category, and attributes:

nexigon-agent events emit \
  --category "com.example.sensor.connection" \
  --severity error \
  --attribute 'sensorId="ambient"' \
  --attribute 'retryCount=3' \
  '"Sensor connection has been lost"'
  • Severity states how serious an event is: trace or debug for diagnostic detail, info by default, warning for a potential problem, and error or critical for failures that need attention.
  • A category names a stable event type, so that operators can filter by it. Keep the set of categories small and prefix custom categories with your domain.
  • Attributes carry varying values, such as serial numbers or retry counts, as named JSON values. Here, sensorId is a string and retryCount a number.

Telemetry describes the event fields and limits, and events emit lists all options.

Export Events with OpenTelemetry

Dedicated and enterprise Nexigon instances can export a project’s events to an OTLP collector of an observability system such as Grafana or Datadog. Open Project Settings → Event Export, select Export device events, and enter the collector’s endpoint URL. Add the request headers that the collector requires, such as an Authorization header, then choose Save. The page is available when the organization’s subscription includes event export.

Saved header values are not shown again. Leave a value empty to keep it. After changing the endpoint, enter the header values again, so stored credentials only reach the endpoint they were entered for.

Nexigon Hub adds the authenticated device’s ID to each event, so downstream systems can trust which device emitted it.