Add systemd notify & watchdog support #1022
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This enables optional support for systemd notification which allows lokid to be run via
Type=notify
, allowing it to better signal status to systemd and enables systemd watchdog handling to restart if something goes wrong.Enabled here are:
systemd watchdog ping every 10s (from the idle loop callback, so it something deadlocks it's likely to stop firing).
systemd status update every 10s, so that
systemctl status loki-node
gives you a status line such as:initialization notification so that systemd can wait for and report on initialization status rather than just that the process has launched.
shutdown notification
All of these require changing the service type to
Type=notify
in the[Service]
section of the systemd service file; enabling the watchdog also requires adding aWatchdogSec=5min
line in the[Service]
section to have systemd restart it after 5 minutes with no watchdog ping.The systemd support is optional and requires the libsystemd-dev package to be built (and is probably not feasible at all for a static build).