MXS-2057 systemd watchdog

Systemd wathdog notification at a little more than 2/3 of the
systemd configured time. In the service config (maxscale.service)
add e.g. WatchdogSec=30s to set and enable the watchdog.
For building: install libsystemd-dev.

The next commit will modify cmake configuration and code to
conditionally compile the new code based on existence of libsystemd-dev.
This commit is contained in:
Niclas Antti
2018-11-09 10:18:22 +02:00
parent 2a6df0e724
commit f29e5b65de
4 changed files with 93 additions and 1 deletions

View File

@ -27,6 +27,7 @@
#include <time.h>
#include <unistd.h>
#include <getopt.h>
#include <systemd/sd-daemon.h>
#include <set>
#include <map>
@ -1768,6 +1769,13 @@ int main(int argc, char** argv)
cnf->log_target = MXB_LOG_TARGET_STDOUT;
}
// Systemd watchdog. Must be called in the initial thread */
uint64_t systemd_interval; // in microseconds
if (sd_watchdog_enabled(false, &systemd_interval) > 0)
{
RoutingWorker::set_watchdog_interval(systemd_interval);
}
if (!daemon_mode)
{
fprintf(stderr,