thin-edge / thin-edge.io

The open edge framework for lightweight IoT devices
https://thin-edge.io
Apache License 2.0
221 stars 54 forks source link

MQTT health endpoints for tedge plugin extensions #1172

Closed albinsuresh closed 2 years ago

albinsuresh commented 2 years ago

The following tedge daemons currently don't honour the tedge health check mechanism:

These daemons must also implement the tedge health-check contract by exposing health endpoints via tedge/health/<plugin-name> topics.

rina23q commented 2 years ago

Since we already have health check mechanism for tedge daemons (tedge-mapper and tedge-agent), we need to expand the mechanism also for the new plugins.

  1. The 3 components should listen to the tedge/health-check/<plugin-name> and tedge/health-check topics, and respond back to the tedge/heath/<plugin-name> topic.
  2. tedge-watchdog monitors c8y-configuration-plugin and c8y-log-plugin.
gligorisaev commented 2 years ago

@PradeepKiruvale I really need to be able to see how is this issue Resolved, please add the Information

PradeepKiruvale commented 2 years ago

Steps to test this feature.

  1. sudo tedge connect c8y
  2. sudo systemctl start c8y-log-plugin.service
  3. Note down the PID of the c8y-log-plugin.service
  4. Start a mqtt subscriber as below sudo tedge mqtt subtedge/health/c8y-log-plugin`
  5. Send an empty message on tedge/health-check or tedge/health-check/c8y-log-plugin as below sudo tedge mqtt pubtedge/health-check/c8y-log-plugin` ' '
  6. Verify the message received on the tedge/health/c8y-log-plugin

The message will be as below, the first part is the topic on which the message was received and the second part is the actual message.
[tedge/health/c8y-log-plugin] {"pid":175236,"status":"up","time":1659276372} Now cross-check the PID and the status

Follow the same steps for the testing health-check feature of c8y-configuration-plugin as well, and replace the c8y-log-plugin with c8y-configuration-plugin.

gligorisaev commented 2 years ago
GIVEN   thin-edge.io is installed on DUT
AND      c8y-log-plugin is installed
AND      Connected to Cumulocity `sudo tedge connect c8y`
AND      Log plugin service is started  `sudo systemctl start c8y-log-plugin.service`
AND      You have noted the PID of the c8y-log-plugin.service `pgrep c8y_log_plugin`
WHEN     You start a mqtt subscriber `sudo tedge mqtt sub 'tedge/health/c8y-log-plugin' &` [ENTER]
AND      You send an empty message `sudo tedge mqtt pub 'tedge/health-check/c8y-log-plugin`
THEN     PID is part of the Actual message
AND      the status is up

GIVEN    thin-edge.io is installed on DUT
AND      c8y-configuration-plugin is installed
AND      Configuration plugin is started `sudo systemctl start c8y-configuration-plugin.service`
AND      You have noted the PID of the c8y-configuration-plugin.service `pgrep c8y_configuration_plugin`
WHEN     You start a mqtt subscriber `sudo tedge mqtt sub 'tedge/health/c8y-configuration-plugin' &` [ENTER]
AND      You send an empty message sudo tedge mqtt pub 'tedge/health-check/c8y-configuration-plugin' ''
THEN     PID is part of the Actual message
AND      the status is up
rina23q commented 2 years ago

Resolved by #1299