Four ways to consume broker metrics, all driven by the same counter pipeline in PostgreSQL.
Switch tabs to see each scenario in action.
Live Counters
SELECT * FROM pgmqtt_metrics() via PostgREST
| Metric |
Value |
Unit |
Description |
Active Connections
SELECT * FROM pgmqtt_connections() via PostgREST
| Client ID |
Transport |
Connected At |
Last Activity |
Keep-Alive |
Msgs Rx |
Msgs Tx |
Queue |
Real-Time Metric Stream
LISTEN pgmqtt_live → SSE bridge → EventSource
Hook Function Log
public.pgmqtt_alert_hook(snap jsonb) called on each flush
| Time |
Alert? |
Connections |
Msgs Rx |
DB Batches |
Errors |
Payload |
Grafana Dashboard
postgres_exporter → Prometheus → provisioned dashboard