Skip to content

Telemetry Plugin

The telemetry plugin collects device metrics (CPU, memory, disk, network, runtime) and makes them queryable via Prometheus. Metric collection is configured per-tenant and hot-applied to devices via the shadow/config system — no device restart required.


Overview

PropertyValue
Plugin IDtelemetry
TierSDK (pluginsdk.BackendPlugin)
Version1.0.0
HTTP routesNone
Prometheus metricsYes — device metrics exposed for scraping
Bus subscriptionsevt.telemetry.v1.*
DB schemaNone

RBAC Permissions

PermissionDefault rolesDescription
telemetry/metrics:readviewer, operator, tenant_adminQuery device telemetry via the Prometheus proxy

To access telemetry from the Web UI, the user needs telemetry/metrics:read. This gates the monitoring dashboards that call through /api/v1/metrics/*.

typescript
can(perms, 'telemetry/metrics', 'read')   // show monitoring dashboards

Message Bus

Subscriptions

The telemetry plugin subscribes to the wildcard topic evt.telemetry.v1.* to receive all telemetry events published by device agents.

Published Topics

TopicTriggerPayloadDescription
device/{id}/cmd.telemetry.v1.ping_ackHeartbeat{timestamp}Acknowledge a device telemetry heartbeat
device/{id}/cfg.plugins.v1.setConfig change{plugin_id, config}Push updated telemetry config to the device agent

Telemetry Wire Format

Device agents publish telemetry reports as structured messages on the bus:

json
{
  "device_id": "550e8400-e29b-41d4-a716-446655440000",
  "tenant_id": "660f9511-...",
  "timestamp": "2025-03-25T10:00:00Z",
  "metrics": [
    { "name": "cpu_usage_percent",   "value": 23.5,  "labels": {} },
    { "name": "memory_used_bytes",   "value": 536870912, "labels": {} },
    { "name": "disk_used_bytes",     "value": 1073741824, "labels": { "mount": "/" } },
    { "name": "net_rx_bytes_total",  "value": 98765432, "labels": { "iface": "eth0" } },
    { "name": "net_tx_bytes_total",  "value": 12345678, "labels": { "iface": "eth0" } }
  ]
}

The server-side plugin ingests these reports and writes them into Prometheus (via the MetricsRegistry capability) with a device_id and tenant_id label on each metric.


Available Device Metrics

Metric nameUnitDescription
cpu_usage_percent%Overall CPU utilization
memory_used_bytesbytesRSS / used memory
memory_total_bytesbytesTotal physical memory
disk_used_bytesbytesDisk space used (per mount point)
disk_total_bytesbytesDisk capacity (per mount point)
net_rx_bytes_totalbytes (counter)Bytes received (per interface)
net_tx_bytes_totalbytes (counter)Bytes transmitted (per interface)
runtime_uptime_secondssecondsAgent/device uptime

Label device_id and tenant_id are attached to every metric automatically by the server-side plugin.


Plugin Configuration

Configuration is stored per-tenant using SetPluginConfig / GetPluginConfig.

KeyTypeDefaultDescription
interval_secondsint30How often the device agent collects and reports metrics
metricsstring[]["cpu","memory","disk","network","runtime"]Which metric groups to collect

Example per-tenant config:

json
{
  "interval_seconds": 60,
  "metrics": ["cpu", "memory", "disk"]
}

Config changes are propagated to devices via cfg.plugins.v1.set bus messages — no agent restart needed.


Querying Telemetry

Use the ConnectRPC QueryDeviceTelemetry RPC or the Prometheus proxy:

Via ConnectRPC

http
POST /umoo.v1.admin.AdminService/QueryDeviceTelemetry
Authorization: Bearer <token>
X-Tenant-ID: <tenant-id>
Content-Type: application/json

{
  "device_id": "550e8400-...",
  "metric":    "cpu_usage_percent",
  "start":     "2025-03-25T00:00:00Z",
  "end":       "2025-03-25T12:00:00Z",
  "step":      "5m"
}

Required permission: telemetry/metrics:read

Via Prometheus Proxy

http
GET /api/v1/metrics/api/v1/query_range
  ?query=cpu_usage_percent{device_id="550e8400-..."}
  &start=2025-03-25T00:00:00Z
  &end=2025-03-25T12:00:00Z
  &step=300
Authorization: Bearer <token>

Required permission: metrics:read


Agent-Side Plugin

The device agent runs a corresponding telemetry agent plugin that:

  1. Reads the interval_seconds and metrics config from its local plugin config store.
  2. On each interval, samples the configured metric groups.
  3. Publishes the report as evt.telemetry.v1.report on the agent bus, which is bridged to the server via NATS.
  4. Listens for cfg.plugins.v1.set messages to hot-reload its configuration.

See Also

Umoo — IoT Device Management Platform