]> git.immae.eu Git - perso/Immae/Projets/Puppet.git/commitdiff
Monitor websites from master
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Wed, 11 Jul 2018 06:43:05 +0000 (08:43 +0200)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Wed, 11 Jul 2018 06:49:25 +0000 (08:49 +0200)
modules/profile/manifests/monitoring/external_service.pp [new file with mode: 0644]
modules/profile/manifests/monitoring/local_service.pp
modules/profile/manifests/monitoring/params.pp
modules/profile/manifests/monitoring/services.pp
modules/role/manifests/etherpad.pp

diff --git a/modules/profile/manifests/monitoring/external_service.pp b/modules/profile/manifests/monitoring/external_service.pp
new file mode 100644 (file)
index 0000000..027dad8
--- /dev/null
@@ -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,
+  }
+
+}
index 9544fdf45070c611323e4136bd512797d15a6b68..1f975f03c26d91038ad4c3341e976a15ff0f1d73 100644 (file)
@@ -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 - "
index a64713008eaff9021616494f6e75cb5108880e12..27f895e998f639fcd6235f41923f19999a9e7024 100644 (file)
@@ -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",
index b20a3528546c1ad6bf7c142feb099b04cb7c7850..95c6efba8bfb2ff026d4a3898e58267a9dc034e0 100644 (file)
@@ -38,4 +38,5 @@ class profile::monitoring::services {
   }
 
   Profile::Monitoring::Local_service <| |>
+  Profile::Monitoring::External_service <| |>
 }
index 1a86389ee48d0ec993ae85905884b5f13512672e..119af5653d808284e8d0f81763404ede9d691e9b 100644 (file)
@@ -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!/!<title>Etherpad"
+    }
+  }
+  @profile::monitoring::external_service { "$web_host ssl certificate is up to date":
+    type   => "web",
+    master => {
+      check_command => "check_https_certificate!$web_host"
+    }
+  }
 }