From 409e745d9419c5f9a13e64b427c22d5d55ca68cc Mon Sep 17 00:00:00 2001 From: Jan Dittberner Date: Fri, 27 Sep 2024 10:38:09 +0200 Subject: [PATCH] Avoid local checks on remote hosts --- global-templates/host-templates.conf | 3 +++ global-templates/services.conf | 14 +++++++------- infra02sat.infra.cacert.org/hosts.conf | 3 +++ infra03sat.infra.cacert.org/hosts.conf | 3 +++ master/hosts.conf | 1 + 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/global-templates/host-templates.conf b/global-templates/host-templates.conf index 1ae40e2..5bf60e3 100644 --- a/global-templates/host-templates.conf +++ b/global-templates/host-templates.conf @@ -55,3 +55,6 @@ template Host "puppet-host" { procs_critical = "1:2" } } + +template Host "icinga-host" { +} diff --git a/global-templates/services.conf b/global-templates/services.conf index 02350fc..dcaaf20 100644 --- a/global-templates/services.conf +++ b/global-templates/services.conf @@ -53,7 +53,7 @@ apply Service "icinga" { check_command = "icinga" - assign where host.name + assign where "icinga-host" in host.templates } apply Service "icinga API certificate" { @@ -69,7 +69,7 @@ apply Service "icinga API certificate" { vars.ssl_cert_warn = 30 vars.ssl_cert_rootssl_cert = "/var/lib/icinga2/certs/ca.crt" - assign where host.name + assign where "icinga-host" in host.templates } apply Service "icinga CA certificate" { @@ -83,7 +83,7 @@ apply Service "icinga CA certificate" { vars.ssl_cert_warn = 396 vars.ssl_cert_critical = 376 - assign where host.name + assign where "icinga-host" in host.templates } apply Service "kernel-status" { @@ -91,7 +91,7 @@ apply Service "kernel-status" { check_command = "kernel_status" - assign where !host.vars.is_container + assign where !host.vars.is_container && "linux-host" in host.templates } apply Service "load" { @@ -99,7 +99,7 @@ apply Service "load" { check_command = "load" - assign where !host.vars.is_container + assign where !host.vars.is_container && "linux-host" in host.templates } apply Service "pgsql " for (name => config in host.vars.pgsql_dbs) { @@ -132,7 +132,7 @@ apply Service "procs" { check_command = "procs" command_endpoint = host.name - assign where host.name + assign where "linux-host" in host.templates } apply Service "proc-" for (proc => config in host.vars.procs) { @@ -165,5 +165,5 @@ apply Service "users" { check_command = "users" command_endpoint = host.name - assign where host.name + assign where "linux-host" in host.templates } diff --git a/infra02sat.infra.cacert.org/hosts.conf b/infra02sat.infra.cacert.org/hosts.conf index cd713d9..cd1fff2 100644 --- a/infra02sat.infra.cacert.org/hosts.conf +++ b/infra02sat.infra.cacert.org/hosts.conf @@ -2,6 +2,7 @@ object Host "infra02sat.infra.cacert.org" { import "debian-host" import "puppet-host" + import "icinga-host" display_name = "infra02sat" @@ -27,5 +28,7 @@ object Host "beholder-from-infra02" { address = "49.13.65.97" address6 = "2a01:4f8:c17:7495::1" + command_endpoint = "infra02sat" + vars.notification.from = "infra02sat" } diff --git a/infra03sat.infra.cacert.org/hosts.conf b/infra03sat.infra.cacert.org/hosts.conf index 1a5582d..aa073d8 100644 --- a/infra03sat.infra.cacert.org/hosts.conf +++ b/infra03sat.infra.cacert.org/hosts.conf @@ -2,6 +2,7 @@ object Host "infra03sat.infra.cacert.org" { import "debian-host" import "puppet-host" + import "icinga-host" display_name = "infra03sat" @@ -27,5 +28,7 @@ object Host "beholder-from-infra03" { address = "49.13.65.97" address6 = "2a01:4f8:c17:7495::1" + command_endpoint = "infra03sat" + vars.notification.from = "infra03sat" } diff --git a/master/hosts.conf b/master/hosts.conf index 7c9a566..7fea5ba 100644 --- a/master/hosts.conf +++ b/master/hosts.conf @@ -2,6 +2,7 @@ object Host "beholder" { import "debian-host" import "postfix-host" + import "icinga-host" groups += [ "monitoring" ]