-
Notifications
You must be signed in to change notification settings - Fork 8
Retain active-state (closes #201) #202
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Could you add a line to the # Unreleased section of the CHANGELOG.md?
Did you set the executable bit on setup.py intentionally?
|
|
||
| for monitored_system_unit in state.monitored_system_unit_names: | ||
| await mqtt_client.publish( | ||
| topic=state.get_system_unit_active_state_mqtt_topic(unit_name=monitored_system_unit), | ||
| payload="unknown", | ||
| retain=True, | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| for monitored_system_unit in state.monitored_system_unit_names: | |
| await mqtt_client.publish( | |
| topic=state.get_system_unit_active_state_mqtt_topic(unit_name=monitored_system_unit), | |
| payload="unknown", | |
| retain=True, | |
| ) |
I am not sure whether we should report "unknown" on the shutdown of systemctl-mqtt, as consumers should always subscribe to the birth/last-will topic systemctl/[hostname]/status (c3533ee) to be notified when systemctl-mqtt becomes available or unavailable (so "unknown" seems redundant to me and somehow misleadingly suggests that systemd reports "unknown").
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I was really aiming for was to clear the topic of stale services. As it stands, if you decided to change what services are monitored the retained topic stays there "forever" - this was an easy way to at least mark out topics that haven't changed since shutdown. Do you think we need to clear out stale topics or leave that as an exercise of due diligence for the user?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I missed your reply. Yes, I would leave clearing the topic to the user/subscriber as we can't guarantee that "unknown" will be sent (e.g. on sigkill).
Monitored unit active-states are now retained. To try & prevent invalid data getting "stuck" in the broker, we publish "unknown" as the status to every monitored unit on shutdown.