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

  1. 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.
  2. 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.
  3. 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
    Specifies the version of server.
  • NodeName
    String
    Specifies the name of the server.
  • Timestamp
    Date/Time
    Specifies the date and time in ISO8601 format.
  • Object type
    String
    Specifies the type of object that you are monitoring.
  • TopicString
    String
    The topic that is being monitored.
  • Subscriptions
    Numeric
    The number of active subscriptions on the topics that are monitored. The figure shows all active subscriptions that match the topic string.
  • ResetTime
    Date/Time
    The time at which the statistics for the topic were reset. The ResetTime is usually the time when the topic monitor is created.
  • PublishedMsgs
    Numeric
    The number of messages that are successfully published to a topic that matches the wildcarded topic string.
  • RejectedMsgs
    Numeric
    The number of messages that are rejected by one or more subscriptions where the quality of service level did not cause the publish request to fail.
  • FailedPublishes
    Numeric
    The number of publish requests that failed because the message is rejected by one or more subscriptions.

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, 
	}