diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-07-11 07:45:22 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-07-11 08:02:15 +0200 |
commit | 0363f38e186b8c942a6db2de4974befbc373f618 (patch) | |
tree | 4c3b08bface133b92748f33bfdb0c58065433a91 /modules/profile/manifests/monitoring/local_service.pp | |
parent | bff7d1b743bc2239d7ce7ced37dd03e4e846c03d (diff) | |
download | Puppet-0363f38e186b8c942a6db2de4974befbc373f618.tar.gz Puppet-0363f38e186b8c942a6db2de4974befbc373f618.tar.zst Puppet-0363f38e186b8c942a6db2de4974befbc373f618.zip |
Refactor a bit monitoring profile
Diffstat (limited to 'modules/profile/manifests/monitoring/local_service.pp')
-rw-r--r-- | modules/profile/manifests/monitoring/local_service.pp | 47 |
1 files changed, 11 insertions, 36 deletions
diff --git a/modules/profile/manifests/monitoring/local_service.pp b/modules/profile/manifests/monitoring/local_service.pp index 9af7c7a..9544fdf 100644 --- a/modules/profile/manifests/monitoring/local_service.pp +++ b/modules/profile/manifests/monitoring/local_service.pp | |||
@@ -4,8 +4,9 @@ define profile::monitoring::local_service ( | |||
4 | Optional[Hash] $master = {}, | 4 | Optional[Hash] $master = {}, |
5 | Optional[Hash] $local = {}, | 5 | Optional[Hash] $local = {}, |
6 | ) { | 6 | ) { |
7 | include profile::monitoring::params | ||
8 | |||
7 | $service_description = $title | 9 | $service_description = $title |
8 | $real_hostname = lookup("base_installation::real_hostname") | ||
9 | 10 | ||
10 | Nagios_service { | 11 | Nagios_service { |
11 | ensure => "present", | 12 | ensure => "present", |
@@ -16,35 +17,6 @@ define profile::monitoring::local_service ( | |||
16 | require => File["/etc/naemon"], | 17 | require => File["/etc/naemon"], |
17 | } | 18 | } |
18 | 19 | ||
19 | $service_generic = { | ||
20 | active_checks_enabled => "1", | ||
21 | check_freshness => "0", | ||
22 | check_interval => "10", | ||
23 | check_period => "24x7", | ||
24 | contact_groups => "admins", | ||
25 | event_handler_enabled => "1", | ||
26 | flap_detection_enabled => "1", | ||
27 | is_volatile => "0", | ||
28 | max_check_attempts => "3", | ||
29 | notification_interval => "60", | ||
30 | notification_options => "w,u,c,r", | ||
31 | notification_period => "24x7", | ||
32 | notifications_enabled => "0", | ||
33 | obsess_over_service => "1", | ||
34 | passive_checks_enabled => "1", | ||
35 | process_perf_data => "1", | ||
36 | retain_nonstatus_information => "1", | ||
37 | retain_status_information => "1", | ||
38 | retry_interval => "2", | ||
39 | } | ||
40 | |||
41 | $service_local = merge($service_generic, { | ||
42 | host_name => $real_hostname, | ||
43 | check_interval => "5", | ||
44 | max_check_attempts => "4", | ||
45 | retry_interval => "1", | ||
46 | }) | ||
47 | |||
48 | $sudos.each |$sudo_name, $content| { | 20 | $sudos.each |$sudo_name, $content| { |
49 | ensure_resource("sudo::conf", $sudo_name, { | 21 | ensure_resource("sudo::conf", $sudo_name, { |
50 | content => $content, | 22 | content => $content, |
@@ -56,17 +28,20 @@ define profile::monitoring::local_service ( | |||
56 | if $services_for_master { | 28 | if $services_for_master { |
57 | $default_local = { | 29 | $default_local = { |
58 | mode => "0644", | 30 | mode => "0644", |
59 | target => "/etc/naemon/services_for_master.cfg", | 31 | target => $::profile::monitoring::params::services_for_master, |
60 | check_interval => $service_local["check_interval"], | 32 | check_interval => $::profile::monitoring::params::service_local["check_interval"], |
61 | retry_interval => $service_local["retry_interval"], | 33 | retry_interval => $::profile::monitoring::params::service_local["retry_interval"], |
62 | host_name => $service_local["host_name"], | 34 | host_name => $::profile::monitoring::params::service_local["host_name"], |
63 | use => "external-service", | 35 | use => "external-passive-service", |
64 | notify => [], | 36 | notify => [], |
65 | } | 37 | } |
66 | $t = "master - " | 38 | $t = "master - " |
67 | $services_key = $master | 39 | $services_key = $master |
68 | } else { | 40 | } else { |
69 | $default_local = merge($service_local, { target => "/etc/naemon/objects.cfg" }) | 41 | $default_local = merge( |
42 | $::profile::monitoring::params::service_local, | ||
43 | { target => $::profile::monitoring::params::objects } | ||
44 | ) | ||
70 | $t = "" | 45 | $t = "" |
71 | $services_key = $local | 46 | $services_key = $local |
72 | } | 47 | } |