Difference between revisions of "Monitoring via MQTT"

From Teltonika Networks Wiki
(Created page with "==Summary== '''MQTT (MQ Telemetry Transport or Message Queue Telemetry Transport)''' is an ISO standard (ISO/IEC PRF 20922) publish-subscribe-based messaging protocol. It wor...")
 
Line 5: Line 5:
 
==How MQTT works==
 
==How MQTT works==
  
First lets look over how MQTT works on RUT routers. An MQTT connection takes place between two Clients and a Broker. A RUT router can be Broker, a Client or both. The MQTT Publisher (Client) present in RUT routers subscribes to two topics by default: '''router/get''' and '''get/<SERIAL>/command''', where '''<SERIAL>''' is the router's serial number. A third party  
+
First lets look over how MQTT works on RUT routers. An MQTT connection takes place between two Clients and a Broker. A RUT router can be Broker, a Client or both. The MQTT Publisher (Client) present in RUT routers subscribes to two topics by default: '''router/get''' and '''get/<SERIAL>/command''', where '''<SERIAL>''' is the router's serial number. When a third party client connects to the Broker, it sends the message '''id''' to the the topic '''router/get'''. The publisher then sends a response containing its serial number to the topic '''router/id'''. Now that the Client knows the router's serial number it can ask for values of various parameters by sending requests to the topic '''router/<SERIAL>/parameter_name'''. The MQTT Publisher can send responses containing values of these system parameters:
 +
 
 
{| class="wikitable"
 
{| class="wikitable"
 
|+
 
|+
! style="width: 250px; background: black; color: white;"  | Field name
+
! style="width: 250px; background: black; color: white;"  | Parameter name
! style="width: 250px; background: black; color: white;"  | Value
+
! style="width: 250px; background: black; color: white;"  | Parameter description
! style="width: 1200px; background: black; color: white;" | Description
 
 
|-
 
|-
! style="text-align: left; vertical-align: top;" | Enable
+
! style="text-align: left; vertical-align: top;" | temperature
| style="text-align: left; vertical-align: top;" | yes {{!}} no; Default: '''no'''
+
| style="text-align: left; vertical-align: top;" | Temperature of the module in 0.1 degrees Celsius
| style="text-align: left; vertical-align: top;" | Toggles MQTT Broker ON or OFF
 
 
|-
 
|-
! style="text-align: left; vertical-align: top;" | Local Port
+
! style="text-align: left; vertical-align: top;" | operator
| style="text-align: left; vertical-align: top;" | integer [0..65535]; Default: " "
+
| style="text-align: left; vertical-align: top;" | Current operator’s name
| style="text-align: left; vertical-align: top;" | Specifies the local port that the MQTT broker will listen to
 
 
|-
 
|-
! style="text-align: left; vertical-align: top;" | Enable Remote Access
+
! style="text-align: left; vertical-align: top;" | signal
| style="text-align: left; vertical-align: top;" | yes {{!}} no; Default: '''no'''
+
| style="text-align: left; vertical-align: top;" | Signal strength in dBm
| style="text-align: left; vertical-align: top;" | If enabled, MQTT Broker will be reachable by remote user (from WAN)
+
|-
 +
! style="text-align: left; vertical-align: top;" | network
 +
| style="text-align: left; vertical-align: top;" | Current network type (2G, 3G, 4G)
 +
|-
 +
! style="text-align: left; vertical-align: top;" | connection
 +
| style="text-align: left; vertical-align: top;" | Data connection status
 +
|-
 +
! style="text-align: left; vertical-align: top;" | wan
 +
| style="text-align: left; vertical-align: top;" | WAN IP address
 +
|-
 +
! style="text-align: left; vertical-align: top;" | uptime
 +
| style="text-align: left; vertical-align: top;" | System uptime in seconds
 +
|-
 +
! style="text-align: left; vertical-align: top;" | name
 +
| style="text-align: left; vertical-align: top;" | Router’s name
 +
|-
 +
! style="text-align: left; vertical-align: top;" | digital1
 +
| style="text-align: left; vertical-align: top;" | Value of digital input no. 1
 +
|-
 +
! style="text-align: left; vertical-align: top;" | digital2
 +
| style="text-align: left; vertical-align: top;" | Value of digital input no. 2
 +
|-
 +
! style="text-align: left; vertical-align: top;" | analog
 +
| style="text-align: left; vertical-align: top;" | Value of analog
 
|-
 
|-
 
|}
 
|}

Revision as of 14:36, 30 November 2017

Main Page > General Information > Configuration Examples > Router control and monitoring > Monitoring via MQTT

Summary

MQTT (MQ Telemetry Transport or Message Queue Telemetry Transport) is an ISO standard (ISO/IEC PRF 20922) publish-subscribe-based messaging protocol. It works on top of the TCP/IP protocol. It is designed for connections with remote locations where a "small code footprint" is required or the network bandwidth is limited. The publish-subscribe messaging pattern requires a message broker. This chapter is a guide on how to configure a basic MQTT setup on RUT routers.

How MQTT works

First lets look over how MQTT works on RUT routers. An MQTT connection takes place between two Clients and a Broker. A RUT router can be Broker, a Client or both. The MQTT Publisher (Client) present in RUT routers subscribes to two topics by default: router/get and get/<SERIAL>/command, where <SERIAL> is the router's serial number. When a third party client connects to the Broker, it sends the message id to the the topic router/get. The publisher then sends a response containing its serial number to the topic router/id. Now that the Client knows the router's serial number it can ask for values of various parameters by sending requests to the topic router/<SERIAL>/parameter_name. The MQTT Publisher can send responses containing values of these system parameters:

Parameter name Parameter description
temperature Temperature of the module in 0.1 degrees Celsius
operator Current operator’s name
signal Signal strength in dBm
network Current network type (2G, 3G, 4G)
connection Data connection status
wan WAN IP address
uptime System uptime in seconds
name Router’s name
digital1 Value of digital input no. 1
digital2 Value of digital input no. 2
analog Value of analog