Skip to main content
Version: 1.4.1

Health Monitoring

The health of a thin-edge.io service or any other service that is running on the thin-edge.io device or on the child device can be monitored from the Cumulocity IoT by sending the health-status message to Cumulocity IoT.

Publish health status​

A health status message can be published for any service on a status/health channel. The health message should at least contain the status of the service.

note

The status here can be up or down or any other string. For example, unknown.

For example, to update the health status of device/my-device/service/my-test-service service, one has to send the following message:

tedge mqtt pub -r -q 2 'te/device/my-device/service/my-test-service/status/health' '{
"status": "up"
}'
note

The health status message has to be sent as a retain message.

When an empty health status message is sent, e.g. {} or '', the status will be replaced with unknown.

Conversion of the health status message to Cumulocity IoT service monitor message​

The tedge-mapper-c8y will translate any health status message that is received on te/+/+/+/+/status/health topic to Cumulocity Service creation SmartREST message and send it to the Cumulocity cloud. If a service was not previously registered and it fulfills the requirements for auto-registration, it will be auto-registered as described in the Auto Registration section.

For example, assuming a service device/child1/service/service1, running on a device device/child1//, which is a child device of thin-edge.io device device/main// with an ID of TE_DEVICE, the resulting topic mapping looks like this:

thin-edge.io health status message

tedge mqtt pub -r -q 2 'te/device/child1/service/service1/status/health' '{
"status": "up"
}'

Cumulocity IoT (output)

Topic
c8y/s/us/<device-id>:device:child1
Payload
102,<device-id>:device:child1:service:service1,service,service1,up

Configuring the default service type​

The default service type can be configured using the tedge cli.

The example below shows how one can set the default service type to systemd.

sudo tedge config set service.type systemd
note

When the type property was not included in the service registration message, then the configured default value will be used by the mapper while auto-registering the service.

To clear the configured default service type one can use the command below. This will set the service.type to service.

sudo tedge config unset service.type

References

More info about the service monitoring can be found in the link below.

Service monitoring Cumulocity IoT