From: Ismaƫl Bouya Date: Wed, 11 Jul 2018 06:43:05 +0000 (+0200) Subject: Monitor websites from master X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=0cdf494080b285e81b531a38dbbac7f7d8e9c990;p=perso%2FImmae%2FProjets%2FPuppet.git Monitor websites from master --- diff --git a/modules/profile/manifests/monitoring/external_service.pp b/modules/profile/manifests/monitoring/external_service.pp new file mode 100644 index 0000000..027dad8 --- /dev/null +++ b/modules/profile/manifests/monitoring/external_service.pp @@ -0,0 +1,16 @@ +define profile::monitoring::external_service ( + Optional[String] $type = undef, + Optional[Hash] $master = {}, +) { + include profile::monitoring::params + $service_description = $title + + nagios_service { $service_description: + service_description => $service_description, + host_name => $::profile::monitoring::params::service_local["host_name"], + use => $::profile::monitoring::params::service_types[$type], + target => $::profile::monitoring::params::services_for_master, + * => $master, + } + +} diff --git a/modules/profile/manifests/monitoring/local_service.pp b/modules/profile/manifests/monitoring/local_service.pp index 9544fdf..1f975f0 100644 --- a/modules/profile/manifests/monitoring/local_service.pp +++ b/modules/profile/manifests/monitoring/local_service.pp @@ -32,7 +32,7 @@ define profile::monitoring::local_service ( check_interval => $::profile::monitoring::params::service_local["check_interval"], retry_interval => $::profile::monitoring::params::service_local["retry_interval"], host_name => $::profile::monitoring::params::service_local["host_name"], - use => "external-passive-service", + use => $::profile::monitoring::params::service_types["passive"], notify => [], } $t = "master - " diff --git a/modules/profile/manifests/monitoring/params.pp b/modules/profile/manifests/monitoring/params.pp index a647130..27f895e 100644 --- a/modules/profile/manifests/monitoring/params.pp +++ b/modules/profile/manifests/monitoring/params.pp @@ -5,6 +5,11 @@ class profile::monitoring::params { $objects = "/etc/naemon/objects.cfg" $plugins = "/etc/naemon/monitoring-plugins" + $service_types = { + "passive" => "external-passive-service", + "web" => "external-web-service", + } + $service_generic = { active_checks_enabled => "1", check_freshness => "0", diff --git a/modules/profile/manifests/monitoring/services.pp b/modules/profile/manifests/monitoring/services.pp index b20a352..95c6efb 100644 --- a/modules/profile/manifests/monitoring/services.pp +++ b/modules/profile/manifests/monitoring/services.pp @@ -38,4 +38,5 @@ class profile::monitoring::services { } Profile::Monitoring::Local_service <| |> + Profile::Monitoring::External_service <| |> } diff --git a/modules/role/manifests/etherpad.pp b/modules/role/manifests/etherpad.pp index 1a86389..119af56 100644 --- a/modules/role/manifests/etherpad.pp +++ b/modules/role/manifests/etherpad.pp @@ -122,4 +122,17 @@ class role::etherpad ( proxy_preserve_host => true; default: * => $::profile::apache::apache_vhost_default; } + + @profile::monitoring::external_service { "Etherpad service is running on $web_host": + type => "web", + master => { + check_command => "check_https!$web_host!/!Etherpad" + } + } + @profile::monitoring::external_service { "$web_host ssl certificate is up to date": + type => "web", + master => { + check_command => "check_https_certificate!$web_host" + } + } }