com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_link3' is unknown.

Monitoring the Device Status

Due to various reasons, the devices registered with WSO2 IoT Server might not be able to communicate with the server continuously. When the device is not actively communicating with the server, you need to know of it to take necessary actions, such as checking if the device has any malfunctions and repairing it or checking if the device was stolen.

To get a clear understanding, let's look at how this works in WSO2 IoT Server.

  • If the device and the server are actively communicating, the device is shown as active.

     Click here to see how the status is displayed.

    In the device management console, click View under Devices. You can see all your registered devices and their device statuses.

  • If the server is unable to communicate with the device within a defined time period, the device is shown as unreachable.

     Click here to see how the status is displayed.

    In the device management console, click View under Devices. You can see all your registered devices and their device statuses.

  • If the server is still unable to communicate with the device after a defined time period, the device is shown as inactive.

     Click here to see how the status is displayed.

    In the device management console, click View under Devices. You can see all your registered devices and their device statuses.

  • If the device starts to communicate with the device after some time, the device status is updated back to active.

The device's status has the following lifecycle:

The device monitoring task is not applicable for all IoT devices. Therefore, you can choose to enable or disable it for your device type. Let's take a look at how you can configure WSO2 IoT Server and your device type to monitor the device status.

  1. Open the <IOTS_HOME>/conf/cdm-config.xml file and make sure the DeviceStatusTaskConfig is enabled. This configuration is enabled by default.

    If the DeviceStatusTaskConfig is enabled (or enabled on a node that is in a clustered setup) it will run the status monitoring task in the server. If the configuration is disabled, the server will not monitor the status of the devices.

    <DeviceStatusTaskConfig>
    	<Enable>true</Enable>
    </DeviceStatusTaskConfig>
  2. Configure the device type to go into the unreachable state and then to the inactive state after a specified time.
    Navigate to the <IOTS_HOME>/repository/deployment/server/devicetype directory, open the <DEVICE_TYPE>.xml file, and configure the fields given below:
    The default configuration in the android.xml file is shown below:

    <DeviceStatusTaskConfig>
       <RequireStatusMonitoring>true</RequireStatusMonitoring>
       <Frequency>300</Frequency>
       <IdleTimeToMarkUnreachable>300</IdleTimeToMarkUnreachable>
       <IdleTimeToMarkInactive>600</IdleTimeToMarkInactive>
    </DeviceStatusTaskConfig>
    RequireStatusMonitoring

    If the value is set to true, it enables the status monitoring task for the device type. Else it will not monitor the status of the device type.

    For the task to run on the specified device type it must be enabled on the server as shown in step 1 above.

    Frequency
    Define how often this task should run for the specified device type. The value needs to be given in seconds.

    Make sure to have the value above 60 seconds.

    IdleTimeToMarkUnreachable
    Define after how long the device needs to be marked as unreachable. The value needs to be given in seconds.
    IdleTimeToMarkInactive
    Define after how long the device needs to be marked as inactive. The value needs to be given in seconds.

Additionally to the above configurations, for the device monitoring task to actively function, you need to have pending operations on the device end. When there are pending operations the device communicates with the server to send the operation details to the server and through it, the server keeps track that the device is active.

com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links2' is unknown.