Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All service statuses are set to down and remain down after restarting mosquitto #1788

Merged
merged 5 commits into from
Mar 9, 2023

Conversation

PradeepKiruvale
Copy link
Contributor

Proposed changes

When the MQTT broker restarts, the registered will messages that are registered to send out the health status (down) will be published. The connections will be restored after a while, still, the status remains down.

To address this issue an updated health status up message has to be sent. For this to work, need to register an initial message when the mqtt client is created. This message will be sent out when the connection is restored.

So added an option to add the initial message with_initial_message function. Using this API, one can register the initial message.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Improvement (general improvements like code refactoring that doesn't explicitly fix a bug or add any new functionality)
  • Documentation Update (if none of the other choices apply)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Paste Link to the issue

#1774

Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA (in all commits with git commit -s)
  • I ran cargo fmt as mentioned in CODING_GUIDELINES
  • I used cargo clippy as mentioned in CODING_GUIDELINES
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2023

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass %
143 1 5 144 99.31

Passed Tests

Name ⏱️ Duration Suite
Define Child device 1 ID 0.027 s C8Y Child Alarms Rpi
Normal case when the child device does not exist on c8y cloud 5.023 s C8Y Child Alarms Rpi
Normal case when the child device already exists 1.009 s C8Y Child Alarms Rpi
Reconciliation when the new alarm message arrives, restart the mapper 1.5030000000000001 s C8Y Child Alarms Rpi
Reconciliation when the alarm that is cleared 5.606 s C8Y Child Alarms Rpi
Prerequisite Parent 17.302 s Child Conf Mgmt Plugin
Prerequisite Child 0.38 s Child Conf Mgmt Plugin
Child device bootstrapping 12.891 s Child Conf Mgmt Plugin
Snapshot from device 24.572 s Child Conf Mgmt Plugin
Child device config update 20.155 s Child Conf Mgmt Plugin
Configuration types should be detected on file change (without restarting service) 46.531 s Inotify Crate
Child devices support sending simple measurements 46.592 s Child Device Telemetry
Child devices support sending custom measurements 42.369 s Child Device Telemetry
Child devices support sending custom events 35.082 s Child Device Telemetry
Child devices support sending custom events overriding the type 35.592 s Child Device Telemetry
Child devices support sending custom alarms #1699 37.237 s Child Device Telemetry
Child devices support sending inventory data via c8y topic 26.303 s Child Device Telemetry
Main device support sending inventory data via c8y topic 25.709 s Child Device Telemetry
Successful firmware operation 58.451 s Firmware Operation
Install with empty firmware name 49.351 s Firmware Operation
Supports restarting the device 72.024 s Restart Device
Update tedge version from previous using Cumulocity 93.667 s Tedge Self Update
Test if all c8y services are up 57.363 s Service Monitoring
Check health status of tedge-mapper-c8y service on broker restart 35.862 s Service Monitoring
Check health status of child device service 32.369 s Service Monitoring
Successful shell command with output 4.684 s Shell Operation
Check Successful shell command with literal double quotes output 3.588 s Shell Operation
Execute multiline shell command 3.618 s Shell Operation
Failed shell command 3.537 s Shell Operation
Software list should be populated during startup 44.78 s Software
Install software via Cumulocity 50.549 s Software
Software list should only show currently installed software and not candidates 38.014 s Software
Stop tedge-agent service 0.461 s Log Path Config
Customize the log path 0.158 s Log Path Config
Initialize tedge-agent 0.084 s Log Path Config
Check created folders 0.089 s Log Path Config
Remove created custom folders 0.118 s Log Path Config
Install latest via script (from current branch) 24.57 s Install Tedge
Install specific version via script (from current branch) 22.674 s Install Tedge
Install latest tedge via script (from main branch) 9.981 s Install Tedge
Support starting and stopping services 32.133 s Service-Control
Supports a reconnect 45.045 s Test-Commands
Supports disconnect then connect 42.548 s Test-Commands
Update unknown setting 28.964 s Test-Commands
Update known setting 29.336 s Test-Commands
Stop c8y-configuration-plugin 0.155 s Health C8Y-Configuration-Plugin
Update the service file 0.124 s Health C8Y-Configuration-Plugin
Reload systemd files 0.294 s Health C8Y-Configuration-Plugin
Start c8y-configuration-plugin 0.253 s Health C8Y-Configuration-Plugin
Start watchdog service 10.135 s Health C8Y-Configuration-Plugin
Check PID of c8y-configuration-plugin 0.072 s Health C8Y-Configuration-Plugin
Kill the PID 0.097 s Health C8Y-Configuration-Plugin
Recheck PID of c8y-configuration-plugin 2.196 s Health C8Y-Configuration-Plugin
Compare PID change 0.001 s Health C8Y-Configuration-Plugin
Stop watchdog service 0.158 s Health C8Y-Configuration-Plugin
Remove entry from service file 0.109 s Health C8Y-Configuration-Plugin
Stop c8y-log-plugin 0.157 s Health C8Y-Log-Plugin
Update the service file 0.179 s Health C8Y-Log-Plugin
Reload systemd files 0.395 s Health C8Y-Log-Plugin
Start c8y-log-plugin 0.139 s Health C8Y-Log-Plugin
Start watchdog service 10.169 s Health C8Y-Log-Plugin
Check PID of c8y-log-plugin 0.1 s Health C8Y-Log-Plugin
Kill the PID 0.127 s Health C8Y-Log-Plugin
Recheck PID of c8y-log-plugin 2.127 s Health C8Y-Log-Plugin
Compare PID change 0.001 s Health C8Y-Log-Plugin
Stop watchdog service 0.141 s Health C8Y-Log-Plugin
Remove entry from service file 0.078 s Health C8Y-Log-Plugin
Stop tedge-mapper 0.135 s Health Tedge Mapper C8Y
Update the service file 0.208 s Health Tedge Mapper C8Y
Reload systemd files 0.537 s Health Tedge Mapper C8Y
Start tedge-mapper 0.139 s Health Tedge Mapper C8Y
Start watchdog service 10.26 s Health Tedge Mapper C8Y
Check PID of tedge-mapper 0.113 s Health Tedge Mapper C8Y
Kill the PID 0.13 s Health Tedge Mapper C8Y
Recheck PID of tedge-mapper 2.179 s Health Tedge Mapper C8Y
Compare PID change 0.001 s Health Tedge Mapper C8Y
Stop watchdog service 0.22 s Health Tedge Mapper C8Y
Remove entry from service file 0.152 s Health Tedge Mapper C8Y
Stop tedge-agent 0.144 s Health Tedge-Agent
Update the service file 0.147 s Health Tedge-Agent
Reload systemd files 0.355 s Health Tedge-Agent
Start tedge-agent 0.105 s Health Tedge-Agent
Start watchdog service 10.218 s Health Tedge-Agent
Check PID of tedge-mapper 0.086 s Health Tedge-Agent
Kill the PID 0.185 s Health Tedge-Agent
Recheck PID of tedge-agent 2.191 s Health Tedge-Agent
Compare PID change 0 s Health Tedge-Agent
Stop watchdog service 0.149 s Health Tedge-Agent
Remove entry from service file 0.128 s Health Tedge-Agent
Stop tedge-mapper-az 0.211 s Health Tedge-Mapper-Az
Update the service file 0.186 s Health Tedge-Mapper-Az
Reload systemd files 0.782 s Health Tedge-Mapper-Az
Start tedge-mapper-az 0.29 s Health Tedge-Mapper-Az
Start watchdog service 10.286 s Health Tedge-Mapper-Az
Check PID of tedge-mapper-az 0.108 s Health Tedge-Mapper-Az
Kill the PID 0.085 s Health Tedge-Mapper-Az
Recheck PID of tedge-agent 2.164 s Health Tedge-Mapper-Az
Compare PID change 0.001 s Health Tedge-Mapper-Az
Stop watchdog service 0.125 s Health Tedge-Mapper-Az
Remove entry from service file 0.098 s Health Tedge-Mapper-Az
Stop tedge-mapper-collectd 0.2 s Health Tedge-Mapper-Collectd
Update the service file 0.148 s Health Tedge-Mapper-Collectd
Reload systemd files 0.487 s Health Tedge-Mapper-Collectd
Start tedge-mapper-collectd 0.215 s Health Tedge-Mapper-Collectd
Start watchdog service 10.177 s Health Tedge-Mapper-Collectd
Check PID of tedge-mapper-collectd 0.052 s Health Tedge-Mapper-Collectd
Kill the PID 0.068 s Health Tedge-Mapper-Collectd
Recheck PID of tedge-mapper-collectd 2.146 s Health Tedge-Mapper-Collectd
Compare PID change 0.001 s Health Tedge-Mapper-Collectd
Stop watchdog service 0.065 s Health Tedge-Mapper-Collectd
Remove entry from service file 0.056 s Health Tedge-Mapper-Collectd
c8y-log-plugin health status 5.321 s MQTT health endpoints
c8y-configuration-plugin health status 5.473 s MQTT health endpoints
Wrong package name 0.254 s Improve Tedge Apt Plugin Error Messages
Wrong version 0.224 s Improve Tedge Apt Plugin Error Messages
Wrong type 0.431 s Improve Tedge Apt Plugin Error Messages
tedge_connect_test_positive 1.089 s Tedge Connect Test
tedge_connect_test_negative 1.106 s Tedge Connect Test
tedge_connect_test_sm_services 9.004 s Tedge Connect Test
tedge_disconnect_test_sm_services 1.418 s Tedge Connect Test
Install thin-edge.io 8.105 s Call Tedge
call tedge -V 0.061 s Call Tedge
call tedge -h 0.096 s Call Tedge
call tedge -h -V 0.07 s Call Tedge
call tedge help 0.113 s Call Tedge
tedge config list 0.063 s Call Tedge Config List
tedge config list --all 0.073 s Call Tedge Config List
set/unset device.type 0.232 s Call Tedge Config List
set/unset device.key.path 0.264 s Call Tedge Config List
set/unset device.cert.path 0.296 s Call Tedge Config List
set/unset c8y.root.cert.path 0.342 s Call Tedge Config List
set/unset c8y.smartrest.templates 0.279 s Call Tedge Config List
set/unset az.root.cert.path 0.213 s Call Tedge Config List
set/unset az.mapper.timestamp 0.316 s Call Tedge Config List
set/unset mqtt.bind_address 0.405 s Call Tedge Config List
set/unset mqtt.port 0.314 s Call Tedge Config List
set/unset tmp.path 0.443 s Call Tedge Config List
set/unset logs.path 0.349 s Call Tedge Config List
set/unset run.path 0.462 s Call Tedge Config List
Get Put Delete 3.216 s Http File Transfer Api
Set keys should return value on stdout 0.124 s Tedge Config Get
Unset keys should not return anything on stdout and warnings on stderr 0.309 s Tedge Config Get
Invalid keys should not return anything on stdout and warnings on stderr 0.336 s Tedge Config Get

Failed Tests

Name Message ⏱️ Duration Suite
Test if all c8y services are down DeviceNotFound 72.945 s Service Monitoring

@PradeepKiruvale PradeepKiruvale temporarily deployed to Test Pull Request March 3, 2023 12:18 — with GitHub Actions Inactive
@PradeepKiruvale PradeepKiruvale temporarily deployed to Test Pull Request March 3, 2023 12:39 — with GitHub Actions Inactive
Copy link
Contributor

@didier-wenzek didier-wenzek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

Signed-off-by: Pradeep Kumar K J <pradeepkumar.kj@softwareag.com>
Signed-off-by: Pradeep Kumar K J <pradeepkumar.kj@softwareag.com>
@PradeepKiruvale PradeepKiruvale temporarily deployed to Test Pull Request March 7, 2023 07:08 — with GitHub Actions Inactive
@PradeepKiruvale PradeepKiruvale temporarily deployed to Test Pull Request March 7, 2023 12:48 — with GitHub Actions Inactive
@gligorisaev
Copy link
Contributor

@PradeepKiruvale Test is OK

@reubenmiller reubenmiller added theme:mqtt Theme: mqtt and mosquitto related topics theme:monitoring Theme: Service monitoring and watchdogs labels Mar 9, 2023
@reubenmiller reubenmiller merged commit aa8d8dd into thin-edge:main Mar 9, 2023
albinsuresh pushed a commit to albinsuresh/thin-edge.io that referenced this pull request Mar 13, 2023
… mosquitto (thin-edge#1788)

* send init message on mqtt broker restart

* add deterministic way of starting service

---------

Signed-off-by: Pradeep Kumar K J <pradeepkumar.kj@softwareag.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme:monitoring Theme: Service monitoring and watchdogs theme:mqtt Theme: mqtt and mosquitto related topics
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants