Infrastructure
Namespaces
Organize ingestion schemas and control what Sentinel can receive.
No namespaces found
Try another search or create a new namespace.
Documentation
User Guide
Reference for organizing schemas, authenticating MQTT devices, and streaming telemetry.
1. Connection & Topic Reference
2. Authentication & Token Lifetimes
Prime issues two JWT token types. All MQTT Client IDs must start with your user ID prefix {user_id}:{device_name} (e.g. {user_id}:esp32-sensor).
| Token Type | Default TTL | Configurable | Usage |
|---|---|---|---|
| Sentinel (Normal) JWT | 30 days (2592000s) |
Fixed (30d) | REST API, Read-Only SQL (POST /prime/namespaces/{nid}/sql), & Sentinel SSE stream (GET /prime/uiDirect/{user_id}) |
| MQTT Device JWT | 24 hours (86400s) |
Yes (ttl_seconds) |
MQTT broker password (generated per namespace in the drawer) |
3. Schemas & Payload Format
Payloads published to /{user_id}/{namespace_id}/{table_name} must be a JSON object with a "data" array matching your table's exact column order and SQLite types (TEXT, INTEGER, REAL, BLOB, NUMERIC):
{"data": ["esp32-living-room", 22.5, 45.2]}
4. Code Examples
#include <WiFi.h>
#include <WiFiClientSecure.h>
#include <PubSubClient.h>
const char* ssid = "YOUR_WIFI_SSID";
const char* password = "YOUR_WIFI_PASS";
const char* mqtt_server = "primetelemetry.dev";
const int mqtt_port = 8883;
const char* mqtt_client_id = "{user_id}:esp32-sensor";
const char* mqtt_user = "{user_id}:esp32-sensor";
const char* mqtt_token = "YOUR_MQTT_JWT_TOKEN";
const char* topic = "/{user_id}/{namespace_id}/sensor_health";
WiFiClientSecure espClient;
PubSubClient client(espClient);
void setup() {
Serial.begin(115200);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) { delay(500); }
espClient.setInsecure(); // Or load root CA with espClient.setCACert(root_ca);
client.setServer(mqtt_server, mqtt_port);
}
void loop() {
if (!client.connected()) {
if (!client.connect(mqtt_client_id, mqtt_user, mqtt_token)) { delay(5000); return; }
}
String payload = "{\"data\": [\"esp32-sensor\", 23.4, 55.1]}";
client.publish(topic, payload.c_str());
delay(10000);
}
import ssl, time, json
import paho.mqtt.client as mqtt
BROKER = "primetelemetry.dev"
PORT = 8883
USER_ID = "{user_id}"
NAMESPACE_ID = "{namespace_id}"
CLIENT_ID = f"{USER_ID}:python-worker-01"
TOKEN = "YOUR_MQTT_JWT_TOKEN"
client = mqtt.Client(client_id=CLIENT_ID, protocol=mqtt.MQTTv311)
client.username_pw_set(username=CLIENT_ID, password=TOKEN)
client.tls_set(tls_version=ssl.PROTOCOL_TLS_CLIENT)
client.connect(BROKER, PORT, keepalive=60)
client.loop_start()
topic = f"/{USER_ID}/{NAMESPACE_ID}/sensor_health"
client.publish(topic, json.dumps({"data": ["python-node", 24.8, 48.3]}), qos=1)
time.sleep(1)
client.loop_stop()
client.disconnect()
mosquitto_pub -h primetelemetry.dev -p 8883 \
--capath /etc/ssl/certs \
-i "{user_id}:cli-producer" \
-u "{user_id}:cli-producer" \
-P "YOUR_MQTT_JWT_TOKEN" \
-t "/{user_id}/{namespace_id}/sensor_health" \
-m '{"data": ["cli-node", 21.0, 50.0]}'
const mqtt = require('mqtt');
const userId = '{user_id}';
const namespaceId = '{namespace_id}';
const clientId = `${userId}:node-client-01`;
const client = mqtt.connect('mqtts://primetelemetry.dev:8883', {
clientId,
username: clientId,
password: 'YOUR_MQTT_JWT_TOKEN',
});
client.on('connect', () => {
client.publish(`/${userId}/${namespaceId}/sensor_health`, JSON.stringify({ data: ['node-sensor', 26.1, 44.0] }), { qos: 1 }, () => client.end());
});
5. Streaming to Sentinel UI Direct (sentinel.json)
Point your Sentinel desktop client to Prime's SSE endpoint using your 30-day Sentinel (Normal) JWT, then push widget arrays to /sentinel/{user_id}/uidirect.
github.com/Muthu-Arun/Sentinel/releases
Linux
First-Class Linux Build Support ↗
Native C++23 build instructions in the Sentinel repository README.md
[
{
"window": "UI direct",
"host": "https://primetelemetry.dev",
"port": 443,
"endpoint": "/prime/uiDirect/{userID}",
"connection": "sse",
"authorization": "Bearer <Token>"
}
]
6. Querying Data with Read-Only SQL
Run ad-hoc read-only SQLite queries against any namespace you own using the SQL Query button in a namespace drawer, or directly via REST using your 30-day Sentinel (Normal) JWT:
curl -X POST "https://primetelemetry.dev/prime/namespaces/{namespace_id}/sql" \
-H "Authorization: Bearer YOUR_SENTINEL_JWT" \
-H "Content-Type: application/json" \
-d '{"query": "SELECT * FROM \"sensor_health\" LIMIT 100", "limit": 1000}'
You can also post to POST /prime/sql with {"ns": {namespace_id}, "query": "...", "limit": 1000}. Responses return {"columns": [...], "rows": [[...]], "row_count": N, "truncated": bool, "duration_ms": M}.
| Guardrail | Enforcement |
|---|---|
| Read-Only Isolation | Hardened SQLite connection (mode=ro, query_only=1) + C-level SQLite Authorizer allowing only single-statement SELECT, non-recursive WITH, and VALUES. Writes, DDL, ATTACH/DETACH, PRAGMA, and WITH RECURSIVE are blocked. |
| Resource & Rate Limits | 5s query timeout (408), 1–10,000 row cap (default 1,000), 16 KiB max SQL length, 1 MiB max value size, 4 MiB max response payload (413), and max 4 concurrent queries server-wide (429). |
Server-Driven UI · UI Direct
Sentinel SDUI & UI Direct
Connect the Sentinel C++23 / Dear ImGui desktop client to Prime over SSE (/prime/uiDirect/{userID}) and stream real-time widget JSON arrays over MQTT (/sentinel/{user_id}/uidirect).
1. Overview, Installation & UI Direct Architecture
Sentinel functions as an immediate-mode, Server-Driven UI (SDUI) desktop client built with Dear ImGui, ImPlot, and modern C++23. The client is a stateless rendering engine where the backend dictates layout, widget configuration, and real-time data streaming.
With Prime's UI Direct bridge, you do not run a separate SSE server: connect Sentinel to Prime's HTTPS SSE endpoint and publish widget JSON arrays to your direct UI MQTT topic. Prime automatically frames and flushes every message over Server-Sent Events.
2. Client Setup (sentinel.json)
Sentinel reads its connection configuration from sentinel.json. Use your 30-day Sentinel (Normal) JWT in the authorization field.
[
{
"window": "UI direct",
"host": "https://primetelemetry.dev",
"port": 443,
"endpoint": "/prime/uiDirect/{userID}",
"connection": "sse",
"authorization": "Bearer <Token>"
}
]
| Field | Value | Description |
|---|---|---|
window |
"UI direct" |
Title of the Dear ImGui window created inside the Sentinel desktop client. |
host |
"https://primetelemetry.dev" |
Prime server base URL over HTTPS. |
port |
443 |
HTTPS port for the SSE stream connection. |
endpoint |
"/prime/uiDirect/{userID}" |
Prime UI Direct SSE path. {userID} must match the authenticated user ID in your Bearer token. |
connection |
"sse" |
Instructs Sentinel to open a persistent Server-Sent Events (text/event-stream) reader. |
authorization |
"Bearer <Token>" |
Sent as the HTTP Authorization header. Use your Sentinel (Normal) JWT (30-day TTL). |
3. Widget Lifecycle & State Management
Sentinel manages widget state dynamically inside the "UI direct" window based on each widget's unique id:
When Sentinel encounters an id that does not yet exist in the window, it creates the widget instance with its initial parameters (e.g., min/max for gauges, header for tables) and appends it to the display order list.
When Sentinel receives an id that already exists, it updates the widget's internal memory buffer in-place and triggers a redraw. Subsequent updates only need id, type, and data.
Top-to-bottom rendering order matches the sequence in which widget ids were first received by Sentinel. Group widgets inside an inline container to render them horizontally side-by-side.
remove)
Widgets can be unmounted at any time by sending a {"type": "remove", "targets": ["id1", "id2"]} command, freeing their allocated buffers and mutexes.
4. Supported Widget Types & Schemas
Every message published to /sentinel/{user_id}/uidirect MUST be a top-level JSON Array ([...]), even when updating a single widget.
| Widget Type | Init Fields (First Mount) | Update Fields (Stream) | Data Type & Behavior |
|---|---|---|---|
text |
id, type, data |
id, type, data |
string — Renders a Dear ImGui text label or status banner. |
radial_gauge |
id, type, data, min, max |
id, type, data |
float / number — Arc gauge with active fill %, centered id label, and numeric readout. |
plot |
id, type, data |
id, type, data |
float / number — Appends scalar sample to a 16,384-point rolling circular buffer line chart with auto-fitting axes. |
bar_plot |
id, type, data, data_labels |
id, type, data, data_labels |
data: number[], data_labels: string[] — Categorical bar chart with floating numeric annotations. |
table |
id, type, header, data |
id, type, data |
header: string[], data: array<array> — Scrollable table supporting mixed int, float, and string cells. |
button |
id, type, endpoint, method |
id, type, endpoint, method |
Renders an ImGui push button that fires an async HTTP request (GET/POST) to endpoint on click. |
image |
id, type, endpoint |
id, type, endpoint |
Fetches and renders raw image/video frame bytes (JPEG/PNG) from endpoint. |
inline |
id, type, widgets |
id, type, widgets |
widgets: object[] — Horizontal layout container using ImGui::SameLine() to place child widgets side-by-side. |
remove |
type: "remove", targets: string[] |
Dynamically removes all widget IDs listed in targets from the window and frees their memory. |
|
Widget Payload Examples (Initialization vs. Real-Time Update)
Select a widget type to inspect its exact JSON array structure for mounting and updating.
5. End-to-End UI Direct Stream Walkthrough
Complete lifecycle of payloads published to /sentinel/{user_id}/uidirect and streamed by Prime over SSE (data: [...]\n\n).
[
{
"id": "cluster_header",
"type": "text",
"data": "Node 01: Active | Cluster: us-east-prod"
},
{
"id": "gauges_group",
"type": "inline",
"widgets": [
{"id": "CPU %", "type": "radial_gauge", "data": 25.0, "min": 0.0, "max": 100.0},
{"id": "RAM %", "type": "radial_gauge", "data": 48.0, "min": 0.0, "max": 100.0}
]
},
{
"id": "Throughput (MB/s)",
"type": "plot",
"data": 12.4
},
{
"id": "Service Request Rates",
"type": "bar_plot",
"data": [450.0, 1200.0, 310.0],
"data_labels": ["Auth", "API Gateway", "Billing"]
},
{
"id": "Critical Alerts",
"type": "table",
"header": ["Code", "Source", "Message"],
"data": [
[1002, "disk_monitor", "Volume /var/log approaching 85% capacity"]
]
}
]
[
{"id": "CPU %", "type": "radial_gauge", "data": 31.4},
{"id": "RAM %", "type": "radial_gauge", "data": 49.2},
{"id": "Throughput (MB/s)", "type": "plot", "data": 18.9}
]
[
{
"type": "remove",
"targets": ["Critical Alerts"]
},
{
"id": "cluster_header",
"type": "text",
"data": "Node 01: All alerts resolved | Status: Optimal"
}
]
6. Pushing UI Payloads via MQTT (/sentinel/{user_id}/uidirect)
Publish widget JSON arrays to your direct UI MQTT topic over TLS/SSL (primetelemetry.dev:8883) using an MQTT Device JWT generated from any namespace drawer.
import ssl, time, json, random
import paho.mqtt.client as mqtt
BROKER = "primetelemetry.dev"
PORT = 8883
USER_ID = "{user_id}"
CLIENT_ID = f"{USER_ID}:sentinel-ui-publisher"
MQTT_TOKEN = "YOUR_MQTT_JWT_TOKEN"
UI_TOPIC = f"/sentinel/{USER_ID}/uidirect"
client = mqtt.Client(client_id=CLIENT_ID, protocol=mqtt.MQTTv311)
client.username_pw_set(username=CLIENT_ID, password=MQTT_TOKEN)
client.tls_set(tls_version=ssl.PROTOCOL_TLS_CLIENT)
client.connect(BROKER, PORT, keepalive=60)
client.loop_start()
# 1. Mount initial layout on Sentinel ("UI direct" window)
initial_ui = [
{"id": "banner", "type": "text", "data": "Telemetry Stream Initialized"},
{
"id": "system_gauges",
"type": "inline",
"widgets": [
{"id": "CPU", "type": "radial_gauge", "data": 20.0, "min": 0.0, "max": 100.0},
{"id": "GPU", "type": "radial_gauge", "data": 40.0, "min": 0.0, "max": 100.0}
]
},
{"id": "IOPS", "type": "plot", "data": 150.0},
{
"id": "node_load",
"type": "bar_plot",
"data": [45.0, 78.0, 23.0],
"data_labels": ["Node-A", "Node-B", "Node-C"]
}
]
client.publish(UI_TOPIC, json.dumps(initial_ui), qos=1)
# 2. Continuous real-time widget updates
while True:
time.sleep(0.5)
update_payload = [
{"id": "CPU", "type": "radial_gauge", "data": round(random.uniform(15.0, 85.0), 1)},
{"id": "GPU", "type": "radial_gauge", "data": round(random.uniform(30.0, 95.0), 1)},
{"id": "IOPS", "type": "plot", "data": round(random.uniform(100.0, 500.0), 2)}
]
client.publish(UI_TOPIC, json.dumps(update_payload), qos=1)
mosquitto_pub -h primetelemetry.dev -p 8883 \
--capath /etc/ssl/certs \
-i "{user_id}:ui-cli" \
-u "{user_id}:ui-cli" \
-P "YOUR_MQTT_JWT_TOKEN" \
-t "/sentinel/{user_id}/uidirect" \
-m '[{"id": "CPU", "type": "radial_gauge", "data": 42.5, "min": 0.0, "max": 100.0}, {"id": "Net RX", "type": "plot", "data": 88.1}]'
#include <WiFi.h>
#include <WiFiClientSecure.h>
#include <PubSubClient.h>
const char* ssid = "YOUR_WIFI_SSID";
const char* password = "YOUR_WIFI_PASS";
const char* mqtt_server = "primetelemetry.dev";
const int mqtt_port = 8883;
const char* mqtt_client_id = "{user_id}:esp32-ui-direct";
const char* mqtt_user = "{user_id}:esp32-ui-direct";
const char* mqtt_token = "YOUR_MQTT_JWT_TOKEN";
const char* ui_topic = "/sentinel/{user_id}/uidirect";
WiFiClientSecure espClient;
PubSubClient client(espClient);
bool mounted = false;
void setup() {
Serial.begin(115200);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) { delay(500); }
espClient.setInsecure();
client.setServer(mqtt_server, mqtt_port);
client.setBufferSize(1024);
}
void loop() {
if (!client.connected()) {
if (!client.connect(mqtt_client_id, mqtt_user, mqtt_token)) { delay(5000); return; }
mounted = false;
}
if (!mounted) {
const char* initPayload = "[{\"id\":\"ESP32 Status\",\"type\":\"text\",\"data\":\"Online\"},{\"id\":\"Temp (C)\",\"type\":\"radial_gauge\",\"data\":24.5,\"min\":0,\"max\":60},{\"id\":\"RSSI (dBm)\",\"type\":\"plot\",\"data\":-52}]";
client.publish(ui_topic, initPayload);
mounted = true;
} else {
String update = "[{\"id\":\"Temp (C)\",\"type\":\"radial_gauge\",\"data\":25.1},{\"id\":\"RSSI (dBm)\",\"type\":\"plot\",\"data\":" + String(WiFi.RSSI()) + "}]";
client.publish(ui_topic, update.c_str());
}
delay(1000);
}
const mqtt = require('mqtt');
const userId = '{user_id}';
const clientId = `${userId}:node-ui-publisher`;
const uiTopic = `/sentinel/${userId}/uidirect`;
const client = mqtt.connect('mqtts://primetelemetry.dev:8883', {
clientId,
username: clientId,
password: 'YOUR_MQTT_JWT_TOKEN',
});
client.on('connect', () => {
// 1. Mount initial widgets
const initialUi = [
{ id: 'banner', type: 'text', data: 'Node.js Telemetry Connected' },
{ id: 'CPU Load', type: 'radial_gauge', data: 28.4, min: 0, max: 100 },
{ id: 'Req/s', type: 'plot', data: 142.0 },
];
client.publish(uiTopic, JSON.stringify(initialUi), { qos: 1 });
// 2. Stream incremental updates
setInterval(() => {
const update = [
{ id: 'CPU Load', type: 'radial_gauge', data: +(20 + Math.random() * 60).toFixed(1) },
{ id: 'Req/s', type: 'plot', data: +(100 + Math.random() * 250).toFixed(1) },
];
client.publish(uiTopic, JSON.stringify(update), { qos: 1 });
}, 500);
});
7. Protocol Rules & Best Practices
[...])
Sentinel's SSE parser rejects single JSON objects. Always wrap payloads in a JSON array [...], even when updating a single widget.
id)
Use persistent and descriptive id strings. An id acts as both the lookup key for in-place updates and the default title/label displayed in the Sentinel GUI.
data for "plot" and "radial_gauge" must be JSON numbers (e.g. 45.2, not "45.2"); "text" requires a JSON string; "bar_plot" requires a 1D number array and matching-size string array in data_labels; "table" requires a 2D array of rows.
Only supply "min" and "max" for radial_gauge, or "header" for table, when the widget is first mounted. Subsequent high-frequency updates only need "id", "type", and "data".
Use your 30-day Sentinel (Normal) JWT in sentinel.json ("authorization": "Bearer <Token>" for GET /prime/uiDirect/{userID}). Use a scoped MQTT Device JWT as the password when publishing widget arrays to primetelemetry.dev:8883.
Namespace Markdown Reference
Agent Documentation
Namespace-specific Markdown reference (MQTT TLS connection, table schemas, and Sentinel SDUI spec) to paste into your coding agent.
Loading documentation…