Skip to content

Event Monitoring with MQTT (MQTT Eventing)

Open AMT Cloud Toolkit supports Eventing using Message Queuing Telemetry Transport (MQTT), an IoT publish-and-subscribe network protocol. With MQTT Eventing, administrators can subscribe to specific topics, categories of events, for server event monitoring. This eliminates the need to query or poll MPS to determine network events, such as a device's activation or deactivation. Administrators can subscribe to events and respond proactively.

Important

Currently, the implementation publishes all MPS and RPS REST API call events to the MQTT Broker.

Figure 1: MQTT Eventing Examples
Figure 1: MQTT Eventing Examples

MPS and RPS send JSON events to a Mosquitto* broker deployed as a Docker container. Administrators subscribe to the broker. As shown in Figure 1, proactive notifications are published in the MQTT Broker container.

Set Up MQTT Support

To enable support:

  1. This guide assumes you have completed the Getting Started Guide and have Open AMT currently running in Docker containers. If not, follow the Get Started Guide Setup page. Stop and return here after the your services are running.

  2. In a text editor or IDE of choice, open the .env file to edit.

  3. Update the following fields. The mqtt: prefix indicates an MQTT broker is being used. Kong* will now route event messages to port 8883.

    Field Name Set to:
    RPS_MQTT_ADDRESS mqtt://mosquitto:8883
    MPS_MQTT_ADDRESS mqtt://mosquitto:8883
  4. Save and close the file.

  5. Pull the Mosquitto image. Read more about profiles in the Docker docs at Using profiles with Compose.

    docker compose --profile mqtt pull
    
  6. Start the Mosquitto container.

    docker compose --profile mqtt up -d
    

    Note - Cleaning up Mosquitto Container

    When stopping and cleaning up containers deployed using the mqtt profile, you must also use that profile when running docker compose down in order to remove all resources.

    Example:

    docker compose --profile mqtt down -v