Repository navigation
Conversation
Systemd use a regular message on a socket to see if a process is alive, and restart it if needed. In order to achieve that, a timer is added to the main loop to notify systemd that we are still alive. This doesn't add any overhead on a non-systemd enabled system, and requires to be configured by the sysadmin, in the systemd unit file to be used. See http://0pointer.de/blog/projects/watchdog.html for details. This requires a version newer than 209, due to usage of sd_watchdog_enabled function, and require to pass HAVE_SYSTEMD=1 to the Makefile.
|
How is this any different from systemd just seeing if a process is running? Does systemd restart the service if there is a time lapse without the ALIVE=1 message? |
|
The process can be running, but stuck in a loop or some other conditions making it running, but not working. So systemd would not see the process is blocked, while it see it is running ( because the process is not dead ). And yes, systemd restart the service if there is no message. |
|
Eeek. So, systemd requires external applications support its own internal design? Does systemd have the option of checking services using service-specific interfaces ( |
|
Nope, i do not think, even if that could be a feature to add. Redis and systemd work fine without the proposed patch, this is just a more integrated way of watching over the process. |
|
@mscherer He was talking about just for watchdog support. Yes, this is more integrated. No, that is not a positive. Matt's suggestion is actually a really good one that will allow for these features to extend to other monitoring tools and init systems with little effort, and require zero or near zero additions on the part of the daemon. @mattsta You may have luck proposing / asking about the feature on the systemd ML. I am optimistic that they would be happy to have a method to get watchdog support without having to patch a thousand+ daemons :) |
|
@CameronNemo And it would produce useless logs or load to the daemon for nothing, depending on the daemon ( for example, a TLS/SSL connexion that would need to be negotiated on every connexion ). Such job is also already done by external monitoring system, and the goal is not to reinvent the wheel, but provides some choices and a middle ground between "fully checking everything" ( as nagios/etc do ) and "just using wait to see the process is not working" ( like what upstart and systemd are doing without patches ). |
Minor cleanup, fast path reduces the number of lines of code and improves readability. Signed-off-by: Nadav Levanoni <[email protected]> Co-authored-by: Nadav Levanoni <[email protected]>
Systemd use a regular message on a socket to see if a process is alive,
and restart it if needed. In order to achieve that, a timer is added to
the main loop to notify systemd that we are still alive. This doesn't
add any overhead on a non-systemd enabled system, and requires to be
configured by the sysadmin, in the systemd unit file to be used.
See http://0pointer.de/blog/projects/watchdog.html for details.
This requires a version newer than 209, due to usage of sd_watchdog_enabled
function, and require to pass HAVE_SYSTEMD=1 to the Makefile.