Monitor
Use the Monitor web service to monitor Remote Manager activity and push notifications to a client application. Each configured monitor specifies the Remote Manager events or activities to monitor, the notification mechanism, and the transport type (TCP, HTTP, or Polling).
Monitored events can include:
- Data: Data pushed into Remote Manager from remote gateways in the form of DataPoints (directly or through DIA or Smart Energy), FileData, and so on.
- Status: General status updates such as connection status or remote device availability.
- Alarms: Alarm status updates, such as when alarms are triggered or reset.
FileData and FileDataCore events are not published when the file size is larger than 120K. Delete operations for FileData events are never published.
The Monitor web service is available only for Remote Manager accounts with a subscription to the Push Monitor service.
For information on retrieving saved pushed notifications or resetting a monitor, see v1/monitors.
URI
http://<hostname>/ws/Monitor
HTTP method |
Format |
Description |
GET |
/ws/Monitor |
Get a list of all configured monitors. |
GET |
/ws/Monitor/{monId} |
Get details for a specific monitor. |
POST |
/ws/Monitor |
Create a new monitor to push event notifications. |
PUT |
/ws/Monitor/{monId} |
Update an existing monitor. Note that any PUT request to a monitor resets the monitor state. |
DELETE |
/ws/Monitor/{monId} |
Delete a monitor. |
Elements
monId
System-generated identifier for the monitor.
cstId
Remote Manager identifier for the customer.
Format for delivered event data:
monTopic
One or more topics to monitor. Supported monitor topics include:
-
alert_status
-
devices
-
jobs
-
Alarm
-
AlarmStatus
-
DataPoint
-
DataStream
-
DeviceCore
-
FileData
-
FileDataCore
-
Job
-
JobResult
-
XbeeCore
The following monitor topics have been deprecated and should not be used: DiaChannelDataFull, XbeeAttributeDataCore, XbeeEventDataCore.
FileData and FileDataCore events are not published when the file size is larger than 120K. Delete operations for FileData events are not published.
DataStream updates publish changes to DataStream attributes only, not currentValues. To get changes for currentValue, monitor the DataPoint topic to get changes to the current value as they arrive.
To monitor |
Specify |
general topic |
Resource name only. For example:DataPoint Monitors all DataPoint events. |
specific resource |
Resource name followed by the resource ID using standard REST slash conventions. For example:DataPoint/00000000-00000000-00000000-00000000 Monitors DataPoint events reported by the specific device. |
multiple topics |
Comma-delimited list of topics. For example:DataPoint,DeviceCore Monitors all DataPoint and Device data for the current customer. |
scope by operation |
By default, all operations for the specified monitor topic are monitored. To limit the monitor topic to specific operations, prefix the monitor topic with the operation qualifier. Valid operations:C for createU for any updateD for deleteFor example, to monitor update operations only for DeviceCore:[operation=U]DeviceCore To monitor create and update operations for DeviceCore:[operation=C,U]DeviceCore |
scope by group |
By default, all groups for the specified monitor topic are monitored. To limit the monitor topic to one or more groups, prefix the monitor topic with the group qualifier. For example:[group=America,Columbia]DeviceCore |
scope by operation and group |
To use both the operation and the group qualifiers, prefix the monitor topic with both qualifiers:[operation=C,U,D][group=America,Columbia]DeviceCore Note You can prefix the qualifiers in any order. |
special characters |
URL encode the following special characters when specifying additional subtopic components:/ (forward slash)% (percent sign). (period)* (asterisk)[ (open bracket)] (close bracket)When monitor topics are reported, components are URL encoded. This allows for easy parsing of monitor topics. The general procedure is to split the published topic string on the backslash (/) separator character and then URL decode the identified components. |
For HTTP transport type only. HTTP header fields in the following format:
header-name: header-value
header-name-2: header-value-2
Returned in the GET response. Returned as a comma separated list of header names.
monTransportType
Transport method used to deliver push notifications to the client application:
monTransportUrl
For HTTP transport type only. URL of the customer web server. For http URLs, the default listening port is 80; for https URLs, the default listening port is 443.
monTransportToken
For HTTP transport type only. Credentials for basic authentication in the following format:
monTransportMethod
For HTTP transport type only. HTTP method to use for sending data: PUT or POST. The default is PUT.
monConnectTimeout
For HTTP transport type only. Time in milliseconds Remote Manager waits when attempting to connect to the destination http server. A value of 0 means use the system default of 5000 (5 seconds). Most monitors do not need to configure this setting.
monResponseTimeout
For HTTP transport type only. Time in milliseconds Remote Manager waits for a response for pushed events from the http server. A value of 0 means use the system default of 5000 (5 seconds). Most monitors do not need to configure this setting.
monAckOption
For TCP transport type only. Indicates whether the client will explicitly acknowledge TCP push events or allow Remote Manager to automatically acknowledge events when sent. Options include: explicit or off. The default is off.
monBatchSize
Specifies an upper bound on how many messages are aggregated before sending a batch. The default is 100.
monBatchDuration
Specifies an upper bound on the number of seconds messages are aggregated before sending. The default is 10.
monCompression
Keyword that specifies the method used to compress messages. Options include: zlib or none. The default is none. For zlib, the deflate algorithm is used to compress the data; use inflate to decompress the data.
Note For backwards compatibility, gzip is accepted as a valid keyword. Compression has always been done using the deflate algorithm.
monAutoReplayOnConnect
Boolean value that specifies whether Remote Manager replays any missed published events before any new published events are forwarded. True indicates missed published events are replayed. False indicates missed published events are not replayed. The default is false.
monDescription
Optional text field used to label or describe the monitor.
monLastConnect
Returned in the GET response. Specifies last connection time to the client application.
monLastSent
Returned in the GET response. Specifies the last message pushed to the client application.
monStatus
Returned in the GET response. Specifies the current connection status to the client application.
Status |
Description |
CONNECTING |
For HTTP monitors only. Remote Manager is attempting to connect to the configured HTTP server. Once connected, the state changes to ACTIVE. |
ACTIVE |
Monitor is connected and publishing events. |
INACTIVE |
Monitor is not connected and events are not published or recorded. |
SUSPENDED |
For monitors with monAutoReplayOnConnect = True.Monitor has disconnected, but publish events are recorded for later replay. |
DISABLED |
For HTTP monitors only. If a monitor has not connected for 24 hours, the state is set to DISABLED, and publish events are not recorded for replay. A disabled monitor must be reconfigured via the Monitor web service. |
DISCONNECT |
Monitor is currently disconnecting, and events are not being published. For monitors with monAutoReplayOnConnect = True, events are recorded for later replay. (Dashboard shows status as Disconnecting.) |
Any PUT request to a monitor resets the monitor state.
List all Monitors
The following example shows how to list all configured monitors.
Request
Response
<?xml version="1.0" encoding="ISO-8859-1"?>
<result>
<resultTotalRows>2</resultTotalRows>
<requestedStartRow>0</requestedStartRow>
<resultSize>2</resultSize>
<requestedSize>1000</requestedSize>
<remainingSize>0</remainingSize>
<Monitor>
<monId>148214</monId>
<cstId>2</cstId>
<monLastConnect>2014-07-09T22:01:41.187Z</monLastConnect>
<monLastSent>2014-07-09T22:02:09.000Z</monLastSent>
<monTopic>DeviceCore</monTopic>
<monTransportType>tcp</monTransportType>
<monFormatType>json</monFormatType>
<monBatchSize>1</monBatchSize>
<monCompression>zlib</monCompression>
<monStatus>INACTIVE</monStatus>
<monBatchDuration>60</monBatchDuration>
<monLastSentUuid>ac59ee13-07b4-11e4-a573-fa163ef93b22</monLastSentUuid>
</Monitor>
<Monitor>
<monId>148215</monId>
<cstId>2</cstId>
<monLastConnect>2014-07-21T21:24:02.507Z</monLastConnect>
<monLastSent>2014-07-14T17:17:15.000Z</monLastSent>
<monTopic>DeviceCore,XbeeCore</monTopic>
<monTransportType>http</monTransportType>
<monTransportUrl>https://google.com</monTransportUrl>
<monFormatType>json</monFormatType>
<monBatchSize>100</monBatchSize>
<monCompression>none</monCompression>
<monStatus>DISABLED</monStatus>
<monBatchDuration>10</monBatchDuration>
<monTransportMethod>PUT</monTransportMethod>
</Monitor>
</result>
Create an Http Monitor
The following sample shows how to create a simple HTTP monitor.
Payload:
<Monitor>
<monTopic>DeviceCore,XbeeCore</monTopic>
<monTransportType>http</monTransportType>
<monTransportUrl>https://your web site url</monTransportUrl>
<monTransportToken>username:password</monTransportToken>
<monTransportMethod>PUT</monTransportMethod>
<monFormatType>json</monFormatType>
<monBatchSize>100</monBatchSize>
<monCompression>none</monCompression>
<monBatchDuration>10</monBatchDuration>
</Monitor>
Create a Tcp Monitor
The following sample shows how to create a TCP monitor.
Payload:
<Monitor>
<monTopic>DeviceCore,XbeeCore</monTopic>
<monTransportType>tcp</monTransportType>
<monFormatType>json</monFormatType>
<monBatchSize>100</monBatchSize>
<monCompression>none</monCompression>
<monBatchDuration>10</monBatchDuration>
<monAckOption>explicit</monAckOption>
<monAutoReplayOnConnect>true</monAutoReplayOnConnect>
</Monitor>
Recover Disabled Monitor
An HTTP monitor that is not able to successfully connect over a 24 hour period is disabled. Once disabled:
- System alarm is generated to indicate the monitor state was changed to disabled.
- Remote Manager does not make any more attempts to connect the monitor.
- Persistent monitors no longer store missed monitor events.
To recover a disabled monitor, re-enable the monitor using the v1/monitors/inventory/{monitorId}/reset API and then wait for the monitor to reconnect.
Delete Monitor With Condition
The following examples shows how to delete all TCP monitors that are currently inactive:
DELETE ws/Monitor?condition=monTransportType='tcp' and monStatus='INACTIVE'
Delete Monitor
The following sample shows how to delete a monitor.
DELETE /ws/Monitor/148214
Create Polling Monitor
The following sample shows how to create a polling monitor.
Request
Payload
<Monitor>
<monTopic>DeviceCore,DataPoint/00000000-00000000-00000000-00000000</monTopic>
<monTransportType>polling</monTransportType>
<monDescription>Query monitor saves push notifications but does not send them.</monDescription>
</Monitor>
Response
<?xml version="1.0" encoding="ISO-8859-1"?>
<result>
<location>Monitor/433016</location>
</result>
To query the data from a polling monitor, see v1/monitors.
Monitor HTTP/HTTPS Transport Protocol
This section highlights the details associated with an HTTPS or HTTP connection between the Remote Manager server and the customer web server. This is a high speed, transport over a HTTP connection. This transport requires that the customer has a publicly facing web server application. Remote Manager will be the HTTP client and will push any configured published events to the customer’s web server. This transport uses basic authentication and therefore HTTPS is recommended. HTTP is available for debugging or troubleshooting.
To configure an HTTP monitor, specify http as the monTransportType setting. Additionally, specify monTransportUrl, monTransportToken, and monTransportHeaders options.
monTransportType: (Required) Sets the transport type, TCP or HTTP. For HTTP, set the transport type to HTTP.
monTransportUrl: (Required) Specifies the URL of the customer web server. The URL should be of the following form:
http[s]://customer.domain.com/application/path
monTransportToken: (Required) Specifies the credentials for basic authentication in the following format:
username:password
monTransportMethod: (Optional) Specifies the HTTP method to use to send data: PUT or POST. The default is PUT.
The following example shows how to create an HTTP monitor:
<Monitor>
<monTopic>DeviceCore,XbeeCore</monTopic>
<monTransportType>http</monTransportType>
<monTransportUrl>your website url</monTransportUrl>
<monTransportToken>username:password</monTransportToken>
<monTransportMethod>PUT</monTransportMethod>
<monFormatType>json</monFormatType>
<monBatchSize>100</monBatchSize>
<monCompression>none</monCompression>
<monBatchDuration>10</monBatchDuration>
</Monitor>
monTransportHeaders: (Optional) Specifies HTTP header fields in the following format:
header-name: header-value
header-name-2: header-value-2
The standard and custom HTTP headers outlined below cannot be overridden.
Protocol
Once the HTTP monitor has been configured, the monitor will be activated and Remote Manager will connect to the customer’s web server. Any matching events will be published to the specified URL using the supplied token credentials. Please note that if the monitor’s URL or credentials are configured incorrectly or if the customer’s web server is unreachable, Remote Manager will periodically attempt to connect to the web server for up to 24 hours. The monitor will be disabled after 24 hours without a successful connection.
Events are published using the configured monTransportMethod: PUT or POST. The default is an HTTP PUT operation. The standard HTTP headers of the published event include:
- Authorization: Basic…
- Content-Type: “application/xml;charset=UTF-8” or “application/json;charset=UTF-8”
- Content-Length: indicates how many bytes of payload data are in the message
- [Content-Encoding: deflate] - if present, indicates the monitor event data is compressed
Additionally, the following custom header fields will be set to describe the payload being delivered:
- Monitor-Protocol-Version: indicates what version of push protocol is being used. The current version is ‘1’.
- Monitor-DataBlockId: a rotating integer ID that identifies the data block.
- Monitor-Aggregate-Count: the number of publish events included in this batch.
The body of the PUT operation is the published event payload data. Its format, compression, and size are indicated in the headers above. The payload data format is the same as for the TCP transport.
The returned HTTP status code indicates the ability of the customer application to receive and process the data:
- 200 - indicates customer application successfully received and processed the data
Standard HTTP headers
- Host: Indicates the domain name, and the port number of the server
- Accept: “text/html,application/xml,application/json”
- Accept-Language: “en-us”
- Accept-Charset: “UTF-8,ISO-8859-1”
- Cache-Control: “no-cache”
- Pragma: “no-cache”
- [Accept-Encoding: deflate]—If present, indicates the monitor event data is compressed.
Monitor Event Payload
Data is encapsulated in a message envelope that includes the topic, operation, and timestamp plus the data itself. This will be formatted according to the format type requested when establishing the monitor. Additionally, when the monAutoReplayOnConnect option is enabled, there will be a replay=“true” attribute if the message is being resent.
<?xml version="1.0" encoding="UTF-8"?>
<Msg topic="3/DeviceCore/882/7" operation="create|update|delete" timestamp="2010-12-03T13:34:00.001Z" [replay="true"]>
<DeviceCore>
<id>
<devId>882</devId>
<devVersion>7</devVersion>
</id>
<devRecordStartDate>2010-12-03T13:34:00Z</devRecordStartDate>
<devMac>00:40:9D:3D:71:15</devMac>
<devConnectwareId>00000000-00000000-00409DFF-FF3D7115</devConnectwareId>
...
</DeviceCore>
</Msg>
{
"Document":{
"Msg":{
"timestamp":"2010-12-03T13:34:00.001Z",
"topic":"3/DeviceCore/882/7",
"operation":"UPDATE",
"DeviceCore":{
"id":{
"devId":882,
"devVersion":7
},
"devMac":"00:40:9D:3D:71:15",
"...": "..."
}
}
}
}
Tcp Transport Protocol
This section details standard TCP/IP and SSL socket connections between a client application and Remote Manager. Because authentication messages flow across the socket, we strongly recommend using SSL. Use standard TCP/IP connections for debugging and troubleshooting only.
Monitor configuration options for TCP
The Monitor API provides two TCP-specific elements:
monTransportType: (Required) Sets the transport type, TCP or HTTP. For TCP, set the transport type to TCP.
monAckOption: (Optional) Specifies acknowledge options for sent messages.
- explicit: Client must explicitly acknowledge TCP push events.
- off: Remote Manager automatically acknowledges events when sent.
The default is off.
The following example shows how to create a TCP monitor:
<Monitor>
<monTopic>DeviceCore,XbeeCore</monTopic>
<monTransportType>tcp</monTransportType>
<monFormatType>json</monFormatType>
<monBatchSize>100</monBatchSize>
<monCompression>none</monCompression>
<monBatchDuration>10</monBatchDuration>
<monAckOption>explicit</monAckOption>
<monAutoReplayOnConnect>true</monAutoReplayOnConnect>
</Monitor>
Protocol
When a monitor is created through the Web Services API, a Monitor ID is assigned and returned to the caller. If the monitor is configured to use the TCP transport the customer application can activate the monitor by establishing a TCP socket connection back to the Remote Managerserver. SSL monitor sockets should be made to port 3201 while unsecure TCP sockets should be made to port 3200.
Once Remote Manager makes the socket connection, the customer application must send a ConnectRequest message through that connection to the Remote Manager server. The server will authenticate the request and send back a response. Once the connect request succeeds, the server will begin sending PublishMessages to the customer application as events matching the monitor configuration occur. There are two options on how the customer application can acknowledge the PublishMessages: explicit and off. The acknowledgment option is configured using the monAckOption in the Monitor web service. If not specified, the monAckOption defaults to off.
Explicit means that the customer application will acknowledge the receipt of PublishMessages using the PublishMessageReceived message. The dataBlockId in the PublishMessageReceived indicates that all events up to and including that dataBlockId were successfully received, i.e. one PublishMessageReceive message can acknowledge multiple PublishMessages. If the customer application detects a missing dataBlockId or cannot process a PublishMessage, it should disconnect the TCP socket. On the next reconnect, the replay will start with the unacknowledged push event. (Note that monAutoReplayOnConnect needs to be enabled.)
The off option means that Remote Manager will treat the push event as acknowledged when it is written to the TCP socket. Any PublishMessageReceived messages will be ignored by Remote Manager if the monitor is configured with monAckOption set to off.
As long as the monitor socket connection remains open, monitor events will flow from the server to the customer application per the requirements established in the monitor configuration. If the socket is closed for any reason, the monitor will be deactivated and monitor events will stop flowing to the customer application. When the monitor is deactivated, the monitor’s status will be marked as SUSPENDED (for monitors configured for auto replay of missed events using monAutoReplayOnConnect), otherwise INACTIVE. The customer application can reactivate the monitor socket in the same manner as the initial connection.
Conventions
In this protocol, all multi-byte numeric fields must be transmitted in big endian format. All text data must be transmitted as UTF-8 characters. See RFC 2279 as a reference for this format.
Framing
All messages between the client application and the Remote Manager server are framed as follows:
- Header [6 Bytes]
- Type: [2 Bytes] - indicates the type of message being exchanged
- Length: [4 Bytes] - indicating size of the framed message payload
- Payload [n Bytes] - the wrapped message
ConnectRequest Message
To initiate a new monitor connection, send a ConnectRequest message from the client application to Remote Manager. This is the first message sent upon connect and will authenticate and activate the monitor.
Header [6 Bytes] Type=0x0001
Payload:
- ProtocolVersion: [2 Bytes] - indicates what version of push protocol is being used. The current version is 0x0001.
- UserNameLen [2 Bytes] - length of UserName payload
- UserName: [UTF-8 encoded byte array] - the username to authenticate connection
- PasswordLen [2 Bytes] - length of Password payload
- Password: [UTF-8 encoded byte array] - the password to authenticate connection
- MonitorId: [4 Bytes] - the ID of the monitor for this connect
Example

Legend:
Type: 0x0001
Size: 0x00000013
ProtocolVersion: 0x0001
UsernameSize: 0x0005
Username: 0x7065707369 (pepsi)
PasswordSize: 0x0004
Password: 0x636f6c61 (cola)
MessageId: 0x00000104
ConnectResponse Message
The response to ConnectRequest, sent from Remote Manager to the client application, is a ConnectResponse message. This indicates to the client application the status of the web services request, as well as the protocol version that Remote Manager is speaking.
Header [6 Bytes] Type=0x0002
Payload:
- Status Code: [2 Bytes]
- ProtocolVersion: [2 Bytes] - indicates what version of push protocol is being used
Example:

Legend:
Type: 0x0002
Size: 0x00000004
Status: 0x0001
ProtocolVersion: 0x0001
PublishMessage Message
As monitored events occur, Remote Manager will send PublishMessage messages to the client application.
Header [6 Bytes] Type=0x0003
Payload:
- DataBlockId: [2 Bytes] - rotating id that uniquely identifies the data block
- Count: [2 Bytes] - number of messages in this batch
- Compression: [1 Byte] - indicates what payload compression algorithm is being used (0x00=none, 0x01=zlib)
- Format: [1 Byte] - indicates data format of payload (0x00=xml, 0x01=json)
- PayloadSize: [4 Bytes] - indicates how many bytes of payload data follow
- PayloadData: [n Bytes] - the actual Monitor event data (may be compressed & Base64 encoded)
Example:

Legend:
Type: 0x0003
Size: 0x00000215
DataBlockId: 0x01A7
Count: 0x0002
Compression: 0x00
Format: 0x00
PayloadSize: 0x00000205
PayloadData: 0x3C446F63756D656E74 … 6E743E
<Document>
<Msg topic="3/DeviceCore/882/7" operation="update" timestamp="2010-12-03T13:34:00.001Z">
<DeviceCore>...</DeviceCore>
</Msg>
<Msg topic="3/XbeeCore/00:13:A2:00:40:01:60:45/1/0/1794/256"operation="update" timestamp="2010-12-03T13:34:00.001Z">
<XbeeCore>...</XbeeCore>
</Msg>
</Document>
Publishmessagereceived Message
In response to a PublishMessage message, the client application will send a PublishMessageReceived to acknowledge the message was received and what its processing status is.
Header [6 Bytes] Type=0x0004
Payload:
- DataBlockId: [2 Bytes] - corresponds to incoming DataBlockId
- Status: [2 Bytes] 200 - indicates customer application successfully received and processed the data
Example:

Type: 0x0004
Size: 0x00000004
Status: 0x00C8