Connect Agent DVR to your MQTT server using the Settings menu. When Agent is connected you can set alert actions to publish messages to your MQTT server. See MQTT Server Settings.
To do this, edit your device, go to the General tab and select Actions. Add an action to take on alert (or other event) and choose MQTT. You can then provide a topic and post to send in.
Here you can specify the topic to post to (for example, Agent/alerts) and the message.
Agent can also receive and process MQTT messages on the channel Agent/commands. These commands follow the same format as our HTTP API.
For example: cmd=allon
Or via mosquitto:
mosquitto_pub -t 'Agent/commands' -m 'cmd=record&ot=2&oid=1'
Agent will action the command and send a JSON response to the Agent/responses channel.
Agent also has an automatic MQTT configuration that sends through default events and statuses along with usage statistics. To enable this, check the "MQTT Events" option on the General tab when you edit the device.
This will set flags for topics: motion, connected, alert, recording.
If you are seeing frequent disconnects and reconnects in MQTT this usually means that the Client ID in Server Settings - MQTT is in use in multiple places. Make sure every client connected to MQTT has a different Client ID.