From 0ca93dff41ff3a9889a5847ff0f854cf5cef1185 Mon Sep 17 00:00:00 2001 From: Tobias Wiese Date: Mon, 11 May 2020 20:38:42 +0200 Subject: service: basic node health Check for basic node health including ping, disk and swap. Also check with the package manager, that the system is up to date. Signed-off-by: Tobias Wiese --- zones.d/global-templates/services.conf | 57 ++++++++++++++++++++++++++++++++++ zones.d/master/hosts.conf | 4 +++ zones.d/master/services.conf | 34 ++++++++++++++++++++ 3 files changed, 95 insertions(+) create mode 100644 zones.d/global-templates/services.conf create mode 100644 zones.d/master/services.conf diff --git a/zones.d/global-templates/services.conf b/zones.d/global-templates/services.conf new file mode 100644 index 0000000..9081f19 --- /dev/null +++ b/zones.d/global-templates/services.conf @@ -0,0 +1,57 @@ +template Service "generic-service" { } + + +/** + * Basic node health checks + */ + +apply Service "disk" { + import "generic-service" + + check_command = "disk" + + assign where host.vars.kernel == "linux" +} + +apply Service "icinga" { + import "generic-service" + + check_command = "icinga" + + assign where host.vars.kernel == "linux" +} + +apply Service "load" { + import "generic-service" + + check_command = "load" + + assign where host.vars.kernel == "linux" +} + +apply Service "procs" { + import "generic-service" + + check_command = "procs" + + assign where host.vars.kernel == "linux" +} + +apply Service "swap" { + import "generic-service" + + check_command = "swap" + + assign where host.vars.kernel == "linux" +} + +/* OS specific basic health checks */ +apply Service "apt" { + import "generic-service" + + check_command = "apt" + + volatile = true + + assign where host.vars.os_family == "debian" +} diff --git a/zones.d/master/hosts.conf b/zones.d/master/hosts.conf index 8a71c7e..567fdb7 100644 --- a/zones.d/master/hosts.conf +++ b/zones.d/master/hosts.conf @@ -3,4 +3,8 @@ object Host "new-babbage.server.tobiaswiese.net" { address = "185.244.192.195" address6 = "2a03:4000:27:5fc::1" + + vars.os = "debian" + vars.os_family = "debian" + vars.kernel = "linux" } diff --git a/zones.d/master/services.conf b/zones.d/master/services.conf new file mode 100644 index 0000000..25ca1c5 --- /dev/null +++ b/zones.d/master/services.conf @@ -0,0 +1,34 @@ +template Service "generic-network-service" { + import "generic-service" + zone = "master" +} + +/** + * Basic node health checks + */ + +apply Service "ping4" { + import "generic-network-service" + + check_command = "ping4" + + assign where host.address +} + +apply Service "ping6" { + import "generic-network-service" + + check_command = "ping6" + + assign where host.address6 +} + +apply Service "ssh" { + import "generic-network-service" + + check_command = "ssh" + + vars.ssh_port = host.vars.ssh_port || 222 + + assign where (host.address || host.address6) && host.vars.kernel == "linux" +} -- cgit v1.2.3