import { useQuery } from "@tanstack/react-query"; import { api } from "../api"; export interface BrokerStatus { available: boolean; last_update: string | null; version: string | null; uptime: string | null; clients_connected: number | null; clients_disconnected: number | null; clients_total: number | null; messages_received: number | null; messages_sent: number | null; messages_stored: number | null; messages_dropped: number | null; publish_received: number | null; publish_sent: number | null; bytes_received: number | null; bytes_sent: number | null; subscriptions_count: number | null; retained_count: number | null; load_messages_received_1min: number | null; load_messages_sent_1min: number | null; load_publish_received_1min: number | null; load_publish_sent_1min: number | null; load_bytes_received_1min: number | null; load_bytes_sent_1min: number | null; } function fmt(n: number | null | undefined): string { return n === null || n === undefined ? "—" : n.toLocaleString(); } function Metric({ label, value, hint, }: { label: string; value: string; hint?: string; }) { return (
{label}
{value}
); } export function StatusPage() { const status = useQuery({ queryKey: ["broker-status"], queryFn: () => api.get("/broker/status"), // Match the broker's sys_interval (10 s in the bootstrap config). refetchInterval: 10000, }); const s = status.data; return (

Broker status

Live telemetry from the broker's $SYS topics. The broker publishes every 10 seconds; this page refreshes to match.

{status.error && (
{(status.error as Error).message}
)} {!s?.available && !status.error && (
No $SYS telemetry received yet. This happens for a few seconds after backend startup, or if the management identity lacks $SYS read access (the sys-observe grant is applied at backend startup).
)} {s?.available && ( <>

Messages

Throughput (1 min avg / s)

Bytes (total)

Last $SYS update:{" "} {s.last_update ? new Date(s.last_update).toLocaleTimeString() : "—"}

)}
); }