]>
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 { | |
34 | $default_local = { | |
35 | mode => "0644", | |
0363f38e IB |
36 | target => $::profile::monitoring::params::services_for_master, |
37 | check_interval => $::profile::monitoring::params::service_local["check_interval"], | |
38 | retry_interval => $::profile::monitoring::params::service_local["retry_interval"], | |
39 | host_name => $::profile::monitoring::params::service_local["host_name"], | |
0cdf4940 | 40 | use => $::profile::monitoring::params::service_types["passive"], |
21d531ee | 41 | servicegroups => $service_group, |
69624636 IB |
42 | notify => [], |
43 | } | |
44 | $t = "master - " | |
45 | $services_key = $master | |
46 | } else { | |
0363f38e IB |
47 | $default_local = merge( |
48 | $::profile::monitoring::params::service_local, | |
49 | { target => $::profile::monitoring::params::objects } | |
50 | ) | |
69624636 IB |
51 | $t = "" |
52 | $services_key = $local | |
53 | } | |
54 | ||
55 | $hash = merge($default_local, $common, $services_key) | |
56 | ||
57 | nagios_service { "$t$service_description": | |
58 | service_description => $service_description, | |
59 | * => $hash | |
60 | } | |
61 | } | |
62 | } |