System administrators can view MQTT client-related statistics by using a REST Monitoring API.
System administrators can view (dis)connected MQTT client-related statistics by using a REST Monitoring API, or by using the Amlen WebUI. For more information about using the Amlen WebUI to view disconnected MQTT client-related
statistics, see Viewing
MQTT client-related statistics by using the GUI.
MQTT client-related monitoring statistics can be created by using a REST Monitoring API. To create MQTT
client-related monitoring statistics, complete the following steps:
-
Use the Eclipse Amlen REST API GET method with the following Eclipse Amlen configuration URI:
http://<admin-endpoint-IP:Port>/ima/v1/monitor/<Object Type>
-
Provide query parameters requesting the statistics that you want returned in the JSON
payload. The following example uses cURL to create MQTT client-related statistics:
curl -X GET http://127.0.0.1:9089/ima/v1/monitor/MQTTClient?ClientID=ClientID%26StatType=StatType%26ConnectionState=&ConnectionState%26ResultCount=ResultCount
Where:
-
- ClientID
- Optional.
Specifies the name of the MQTT Client.
Asterisk (*) matches 0 or more characters. To use an asterisk (*), you must specify
ClientID in the query.
The default value is *.
-
- ResultCount
- Optional.
Specifies the number of results to display. (Ignored if StatType is set to AllUnsorted)
Options available for selection are 10, 25, 50, and 100.
The default is 25.
-
- ConnectionState
- Optional.
Lists connected clients, or both connected and disconnected clients.
This value can be one of the following values:
-
- Disconnected
- Lists durable clients that are disconnected from Eclipse Amlen.
-
- Connected
- Lists clients that are connected to Eclipse Amlen.
-
- All
- Lists all clients, whether they are disconnected, or connected to Eclipse Amlen.
The default value is Disconnected.
-
- StatType
- Optional.
Specifies the type of data to order the results by.
This value can be the following values:
-
- LastConnectedTimeOldest
- The most recent date that the specified client ID connected to Eclipse Amlen.
-
- AllUnsorted
Lists all MQTT client IDs that are connected to Eclipse Amlen.
Any value that is specified for ResultCount is ignored, so setting
StatType to AllUnsorted can result in a large number of
responses being generated.
The default value is LastConnectedTimeOldest.
The following fields are returned:
-
- ClientID
- String
- The Client ID.
-
- IsConnected
- Boolean
- Whether the client is connected to the Eclipse Amlen server. Only disconnected
clients are shown.
-
- LastConnectedTime
- Numeric
- Specifies the number of microseconds since the client last connected to the Eclipse Amlen server.
The following example uses cURL to show how a GET method is used to create statistics about a
disconnected MQTT Client with a Client ID that is set to DemoClientID:
curl -X GET http://127.0.0.1:9089/ima/v1/monitor/MQTTClient?ClientID=DemoClientID
The following example shows a successful example response to the GET method that was used to
create statistics about a disconnected MQTT Client with a Client ID that is set to
DemoClientID:
{ "Version":"v1", "MQTTClient": [ { "ClientID":"DemoClientID","IsConnected":False,"LastConnectedTime":1446728129213566618 } ] }