diff options
Diffstat (limited to 'modules/profile/manifests/monitoring/local_service.pp')
-rw-r--r-- | modules/profile/manifests/monitoring/local_service.pp | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/modules/profile/manifests/monitoring/local_service.pp b/modules/profile/manifests/monitoring/local_service.pp new file mode 100644 index 0000000..1f975f0 --- /dev/null +++ b/modules/profile/manifests/monitoring/local_service.pp | |||
@@ -0,0 +1,56 @@ | |||
1 | define profile::monitoring::local_service ( | ||
2 | Optional[Hash] $sudos = {}, | ||
3 | Optional[Hash] $common = {}, | ||
4 | Optional[Hash] $master = {}, | ||
5 | Optional[Hash] $local = {}, | ||
6 | ) { | ||
7 | include profile::monitoring::params | ||
8 | |||
9 | $service_description = $title | ||
10 | |||
11 | Nagios_service { | ||
12 | ensure => "present", | ||
13 | owner => "naemon", | ||
14 | group => "naemon", | ||
15 | notify => Service["naemon"], | ||
16 | before => Service["naemon"], | ||
17 | require => File["/etc/naemon"], | ||
18 | } | ||
19 | |||
20 | $sudos.each |$sudo_name, $content| { | ||
21 | ensure_resource("sudo::conf", $sudo_name, { | ||
22 | content => $content, | ||
23 | before => Nagios_service[$service_description], | ||
24 | }) | ||
25 | } | ||
26 | |||
27 | [true, false].each |$services_for_master| { | ||
28 | if $services_for_master { | ||
29 | $default_local = { | ||
30 | mode => "0644", | ||
31 | target => $::profile::monitoring::params::services_for_master, | ||
32 | check_interval => $::profile::monitoring::params::service_local["check_interval"], | ||
33 | retry_interval => $::profile::monitoring::params::service_local["retry_interval"], | ||
34 | host_name => $::profile::monitoring::params::service_local["host_name"], | ||
35 | use => $::profile::monitoring::params::service_types["passive"], | ||
36 | notify => [], | ||
37 | } | ||
38 | $t = "master - " | ||
39 | $services_key = $master | ||
40 | } else { | ||
41 | $default_local = merge( | ||
42 | $::profile::monitoring::params::service_local, | ||
43 | { target => $::profile::monitoring::params::objects } | ||
44 | ) | ||
45 | $t = "" | ||
46 | $services_key = $local | ||
47 | } | ||
48 | |||
49 | $hash = merge($default_local, $common, $services_key) | ||
50 | |||
51 | nagios_service { "$t$service_description": | ||
52 | service_description => $service_description, | ||
53 | * => $hash | ||
54 | } | ||
55 | } | ||
56 | } | ||