Viewing topic monitoring statistics by using an external application
External monitoring applications can access topic data that is published by IBM® IoT MessageSight by subscribing to the IBM IoT MessageSight topic $SYS/ResourceStatistics/Topic.
Before you begin
To publish monitoring data on a topic, the IBM IoT MessageSight server must be running.
The published data is in JSON format. The published data always includes Version, NodeName, Timestamp, and ObjectType. NodeName is the name of the server and ObjectType is the name of the object that you are monitoring.
For more information about monitoring by using an external application, see Monitoring and reporting.
About this task
Monitoring data is automatically published every 2 seconds to the topic string $SYS/ResourceStatistics/Topic. The name of the monitored topic is included in the message.
In MQTT, you cannot subscribe to a $SYS topic if you specify cleanSession=0. In JMS, you cannot subscribe to a $SYS topic if you use a durable subscription.
Procedure
- Create an endpoint. You can use this endpoint to connect your external monitoring application to IBM IoT MessageSight and create a monitoring subscription. For more information about configuring an endpoint, see Configuring message hubs.
- Optional: Strengthen
your security by configuring this endpoint specifically for monitoring,
with connection and messaging policies to restrict access to monitoring
data that is published on the topic root $SYS.
For more information about configuring connection and messaging policies, see Configuring message hubs.
- Connect your external application to the endpoint that you created in step 1, and subscribe to the topic string $SYS/ResourceStatistics/Topic.
Results
The following information is made available to the monitoring application:
- Version
- String
- NodeName
- String
- Timestamp
- Date/Time
- Object type
- String
-
- TopicString
- String
-
- Subscriptions
- Numeric
-
- ResetTime
- Date/Time
-
- PublishedMsgs
- Numeric
-
- RejectedMsgs
- Numeric
-
- FailedPublishes
- Numeric
Example
The following example shows a monitoring message that contains monitoring data about a topic.
{
"Version":"1.2",
"NodeName":"mar#678",
"TimeStamp":"2014-07-26T12:52:41.226Z",
"ObjectType":"Topic",
"TopicString":"*",
"Subscriptions":50,
"ResetTime":"2014-07-13T12:11:42Z",
"PublishedMsgs":100,
"RejectedMsgs":3,
"FailedPublishes":0,
}