]>
Commit | Line | Data |
---|---|---|
69624636 | 1 | define profile::monitoring::local_service ( |
b5305b5c | 2 | Optional[Hash] $sudos = {}, |
69624636 IB |
3 | Optional[Hash] $common = {}, |
4 | Optional[Hash] $master = {}, | |
5 | Optional[Hash] $local = {}, | |
6 | ) { | |
0363f38e IB |
7 | include profile::monitoring::params |
8 | ||
69624636 | 9 | $service_description = $title |
69624636 | 10 | |
b5305b5c IB |
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 | ||
b5305b5c | 20 | $sudos.each |$sudo_name, $content| { |
bff7d1b7 IB |
21 | ensure_resource("sudo::conf", $sudo_name, { |
22 | content => $content, | |
23 | before => Nagios_service[$service_description], | |
24 | }) | |
b5305b5c | 25 | } |
69624636 | 26 | |
21d531ee IB |
27 | $service_group = "${::profile::monitoring::params::service_local[host_name]}-servicegroup" |
28 | ensure_resource("nagios_servicegroup", $service_group, { | |
29 | target => $::profile::monitoring::params::services_for_master, | |
30 | }) | |
31 | ||
69624636 IB |
32 | [true, false].each |$services_for_master| { |
33 | if $services_for_master { | |
60fb787d IB |
34 | $default_local = merge( |
35 | $::profile::monitoring::params::service_local_for_master, | |
36 | { | |
37 | mode => "0644", | |
38 | target => $::profile::monitoring::params::services_for_master, | |
39 | servicegroups => $service_group, | |
40 | notify => [], | |
41 | }) | |
69624636 IB |
42 | $t = "master - " |
43 | $services_key = $master | |
44 | } else { | |
0363f38e IB |
45 | $default_local = merge( |
46 | $::profile::monitoring::params::service_local, | |
47 | { target => $::profile::monitoring::params::objects } | |
48 | ) | |
69624636 IB |
49 | $t = "" |
50 | $services_key = $local | |
51 | } | |
52 | ||
53 | $hash = merge($default_local, $common, $services_key) | |
54 | ||
55 | nagios_service { "$t$service_description": | |
56 | service_description => $service_description, | |
57 | * => $hash | |
58 | } | |
59 | } | |
60 | } |