Availability Monitoring
thin-edge.io fully supports the Cumulocity IoT's device availability monitoring feature
allowing you to set the desired required interval for the devices
and also sending heartbeats to Cumulocity IoT periodically when a device is deemed available.
thin-edge.io considers a device as available when the tedge-agent
service on it is up and running,
monitored using its service health endpoint.
The health endpoint can be changed from the tedge-agent
to any other entity's health endpoint as well.
Set the required availability interval​
As described in the Cumulocity IoT's user documentation,
thin-edge.io main and child devices set their required interval during their first connection.
Availability monitoring is enabled by default with a default required interval of 1 hour.
The value to be updated using the tedge config set
command as follows:
sudo tedge config set c8y.availability.interval 30m
If the value is set to less than 1 minute or 0, availability monitoring is disabled and the device is considered to be in maintenance mode.
Change the health endpoint for heartbeat messages​
Once the device connection to Cumulocity IoT is established, tedge-mapper-c8y will keep sending heartbeat messages (empty inventory update messages) on behalf of the main and child devices to keep their availability active. By default, the status of the tedge-agent service is used to determine whether the device is available or not.
For example, the device device/my-device//
is considered "available" when its tedge-agent service status is reported as up
as shown below:
- tedge
- mosquitto
- mqtt
tedge mqtt pub -r -q 2 'te/device/my-device/service/tedge-agent/status/health' '{
"status": "up"
}'
mosquitto_pub -r -q 2 -t 'te/device/my-device/service/tedge-agent/status/health' -m '{
"status": "up"
}'
te/device/my-device/service/tedge-agent/status/health
{
"status": "up"
}
To change the health endpoint from the default to a custom value, include the @health
property in the entity registration message.
The @health
value should be a valid entity topic identifier.
- tedge
- mosquitto
- mqtt
tedge mqtt pub -r -q 2 'te/device/my-device//' '{
"@health": "device/my-device/service/foo",
"@type": "child-device"
}'
mosquitto_pub -r -q 2 -t 'te/device/my-device//' -m '{
"@health": "device/my-device/service/foo",
"@type": "child-device"
}'
te/device/my-device//
{
"@health": "device/my-device/service/foo",
"@type": "child-device"
}
If the status of the new endpoint is reported as up
, the device is considered "available",
and a heartbeat signal is sent to Cumulocity IoT.
If the status has any other value, the device is considered "unavailable",
and no heartbeat message are sent to Cumulocity until the status changes to up
again.
Disable the availability monitoring​
By default, the feature is enabled.
To disable the feature, use the tedge config set
command as follows and restart the tedge-mapper-c8y service.
sudo tedge config set c8y.availability.enable false
When disabled, the required availability interval and periodic heartbeat messages aren't sent to Cumulocity IoT.