From d43609479788f62409fc21c7966db874d299cb13 Mon Sep 17 00:00:00 2001 From: Jan Dittberner Date: Thu, 17 Aug 2023 09:49:33 +0200 Subject: [PATCH] Add more generic checks - introduce host template linux-host to define vars.os - sort service definitions alphabetically - replace assign where true with assign where host.name == NodeName - add load, ping4, ping6, ssh and users checks - add http checks for hosts with vars.http_vhosts - define basic vars.http_vhosts for master (beholder.cacert.org) --- global-templates/host-templates.conf | 8 +++- global-templates/services.conf | 62 ++++++++++++++++++++++++---- master/hosts.conf | 5 +++ 3 files changed, 67 insertions(+), 8 deletions(-) diff --git a/global-templates/host-templates.conf b/global-templates/host-templates.conf index fb7f191..ffe20a9 100644 --- a/global-templates/host-templates.conf +++ b/global-templates/host-templates.conf @@ -16,9 +16,15 @@ template Host "generic-host" { check_command = "hostalive" } -template Host "debian-host" { +template Host "linux-host" { import "generic-host" + vars.os = "Linux" +} + +template Host "debian-host" { + import "linux-host" + vars.osfamily = "Debian" vars.procs = { diff --git a/global-templates/services.conf b/global-templates/services.conf index dd1ac03..8115d77 100644 --- a/global-templates/services.conf +++ b/global-templates/services.conf @@ -12,12 +12,54 @@ apply Service "apt" { assign where host.vars.osfamily == "Debian" } +apply Service "disk " for (disk => config in host.vars.disks) { + import "generic-service" + + check_command = "disk" + + vars += config + + assign where host.vars.disks +} + +apply Service (http_vhost => config in host.vars.http_vhosts) { + import "generic-service" + + check_command = "http" + + vars += config +} + apply Service "icinga" { import "generic-service" check_command = "icinga" - assign where true + assign where host.name == NodeName +} + +apply Service "load" { + import "generic-service" + + check_command = "load" + + assign where host.name == NodeName +} + +apply Service "ping4" { + import "generic-service" + + check_command = "ping4" + + assign where host.address +} + +apply Service "ping6" { + import "generic-service" + + check_command = "ping6" + + assign where host.address6 } apply Service "procs" { @@ -25,7 +67,7 @@ apply Service "procs" { check_command = "procs" - assign where true + assign where host.name == NodeName } apply Service "proc-" for (proc => config in host.vars.procs) { @@ -38,12 +80,18 @@ apply Service "proc-" for (proc => config in host.vars.procs) { assign where host.vars.disks } -apply Service "disk " for (disk => config in host.vars.disks) { +apply Service "ssh" { import "generic-service" - check_command = "disk" + check_command = "ssh" - vars += config - - assign where host.vars.disks + assign where (host.address || host.address6) && host.vars.os == "Linux" && !host.vars.no_check_ssh +} + +apply Service "users" { + import "generic-service" + + check_command = "users" + + assign where host.name == NodeName } diff --git a/master/hosts.conf b/master/hosts.conf index 4014589..d4dbe3a 100644 --- a/master/hosts.conf +++ b/master/hosts.conf @@ -13,4 +13,9 @@ object Host "beholder" { vars.disks["/boot/efi"] = { disk_partitions = "/boot/efi" } + + vars.http_vhosts["http redirect"] = { + http_uri = "/" + http_headerstring = "Location: https://beholder.cacert.org/" + } }