]> git.immae.eu Git - perso/Immae/Projets/Puppet.git/blobdiff - modules/profile/manifests/monitoring/local_service.pp
Refactor a bit monitoring profile
[perso/Immae/Projets/Puppet.git] / modules / profile / manifests / monitoring / local_service.pp
index 9af7c7af2b600e711d231de88ec49239664566c4..9544fdf45070c611323e4136bd512797d15a6b68 100644 (file)
@@ -4,8 +4,9 @@ define profile::monitoring::local_service (
   Optional[Hash] $master = {},
   Optional[Hash] $local  = {},
 ) {
+  include profile::monitoring::params
+
   $service_description = $title
-  $real_hostname = lookup("base_installation::real_hostname")
 
   Nagios_service {
     ensure  => "present",
@@ -16,35 +17,6 @@ define profile::monitoring::local_service (
     require => File["/etc/naemon"],
   }
 
-  $service_generic = {
-    active_checks_enabled        => "1",
-    check_freshness              => "0",
-    check_interval               => "10",
-    check_period                 => "24x7",
-    contact_groups               => "admins",
-    event_handler_enabled        => "1",
-    flap_detection_enabled       => "1",
-    is_volatile                  => "0",
-    max_check_attempts           => "3",
-    notification_interval        => "60",
-    notification_options         => "w,u,c,r",
-    notification_period          => "24x7",
-    notifications_enabled        => "0",
-    obsess_over_service          => "1",
-    passive_checks_enabled       => "1",
-    process_perf_data            => "1",
-    retain_nonstatus_information => "1",
-    retain_status_information    => "1",
-    retry_interval               => "2",
-  }
-
-  $service_local = merge($service_generic, {
-    host_name          => $real_hostname,
-    check_interval     => "5",
-    max_check_attempts => "4",
-    retry_interval     => "1",
-    })
-
   $sudos.each |$sudo_name, $content| {
     ensure_resource("sudo::conf", $sudo_name, {
       content => $content,
@@ -56,17 +28,20 @@ define profile::monitoring::local_service (
     if $services_for_master {
       $default_local = {
         mode           => "0644",
-        target         => "/etc/naemon/services_for_master.cfg",
-        check_interval => $service_local["check_interval"],
-        retry_interval => $service_local["retry_interval"],
-        host_name      => $service_local["host_name"],
-        use            => "external-service",
+        target         => $::profile::monitoring::params::services_for_master,
+        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",
         notify         => [],
       }
       $t = "master - "
       $services_key = $master
     } else {
-      $default_local = merge($service_local, { target => "/etc/naemon/objects.cfg" })
+      $default_local = merge(
+        $::profile::monitoring::params::service_local,
+        { target => $::profile::monitoring::params::objects }
+      )
       $t = ""
       $services_key = $local
     }