Mosquitto
Auto-Detection
Exporter Metrics
Auto-Detection
Section titled “Auto-Detection”Glouton automatically detects Mosquitto when it is running on the monitored host.
Exporter Metrics
Section titled “Exporter Metrics”Detailed Mosquitto metrics are available through the third-party sapcc/mosquitto-exporter.
Prerequisites
Section titled “Prerequisites”- Mosquitto MQTT broker installed and running
- Glouton agent installed on the same host
- Go toolchain (if building from source) or access to GitHub releases
Installing the Exporter
Section titled “Installing the Exporter”No special configuration is required on the Mosquitto side. The exporter subscribes to the
MQTT $SYS/# topics, which Mosquitto publishes by default with broker statistics.
Verify that Mosquitto is running and the $SYS topics are available:
mosquitto_sub -t '$SYS/#' -C 5Download the latest release from the mosquitto-exporter releases page, or install with Go:
go install github.com/sapcc/mosquitto-exporter@latestStart the exporter:
mosquitto-exporter --endpoint tcp://localhost:1883The exporter listens on port 9234 by default. Verify it is working:
curl http://localhost:9234/metricsFor production use, create a systemd service unit to manage the exporter process.
Glouton Configuration
Section titled “Glouton Configuration”sudo tee /etc/glouton/conf.d/99-mosquitto.conf > /dev/null << 'EOF'metric: prometheus: targets: - url: "http://localhost:9234/metrics" name: "mosquitto" allow_metrics: - "mosquitto_clients_connected" - "mosquitto_messages_received_total" - "mosquitto_messages_sent_total" - "mosquitto_clients_total" - "mosquitto_bytes_received_total" - "mosquitto_bytes_sent_total"EOFCreate or edit C:\ProgramData\glouton\conf.d\99-mosquitto.conf:
metric: prometheus: targets: - url: "http://localhost:9234/metrics" name: "mosquitto" allow_metrics: - "mosquitto_clients_connected" - "mosquitto_messages_received_total" - "mosquitto_messages_sent_total" - "mosquitto_clients_total" - "mosquitto_bytes_received_total" - "mosquitto_bytes_sent_total"| Metric | Description |
|---|---|
mosquitto_clients_connected | Number of currently connected clients |
mosquitto_messages_received_total | Total number of messages received by the broker |
mosquitto_messages_sent_total | Total number of messages sent by the broker |
mosquitto_clients_total | Total number of active and inactive clients |
mosquitto_bytes_received_total | Total bytes received by the broker |
mosquitto_bytes_sent_total | Total bytes sent by the broker |