X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=modules%2Fprofile%2Fmanifests%2Fmonitoring%2Flocal_service.pp;h=cf8ef782b5480644a60fc433bc452ccb7a33b354;hb=60fb787df260a2fb9cd87761d19eed6e78d0d797;hp=3b39d1f9b39ce924189eccbdb9fdd3a846d0d88b;hpb=6962463657db999c33f1aabe60e0567be218918d;p=perso%2FImmae%2FProjets%2FPuppet.git diff --git a/modules/profile/manifests/monitoring/local_service.pp b/modules/profile/manifests/monitoring/local_service.pp index 3b39d1f..cf8ef78 100644 --- a/modules/profile/manifests/monitoring/local_service.pp +++ b/modules/profile/manifests/monitoring/local_service.pp @@ -1,56 +1,51 @@ define profile::monitoring::local_service ( + Optional[Hash] $sudos = {}, Optional[Hash] $common = {}, Optional[Hash] $master = {}, Optional[Hash] $local = {}, ) { + include profile::monitoring::params + $service_description = $title - $real_hostname = lookup("base_installation::real_hostname") - $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", + Nagios_service { + ensure => "present", + owner => "naemon", + group => "naemon", + notify => Service["naemon"], + before => Service["naemon"], + require => File["/etc/naemon"], } - $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, + before => Nagios_service[$service_description], }) + } + $service_group = "${::profile::monitoring::params::service_local[host_name]}-servicegroup" + ensure_resource("nagios_servicegroup", $service_group, { + target => $::profile::monitoring::params::services_for_master, + }) [true, false].each |$services_for_master| { 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", - notify => [], - } + $default_local = merge( + $::profile::monitoring::params::service_local_for_master, + { + mode => "0644", + target => $::profile::monitoring::params::services_for_master, + servicegroups => $service_group, + 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 }