diff options
Diffstat (limited to 'modules/profile/manifests/monitoring/local_service.pp')
-rw-r--r-- | modules/profile/manifests/monitoring/local_service.pp | 65 |
1 files changed, 65 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..3b39d1f --- /dev/null +++ b/modules/profile/manifests/monitoring/local_service.pp | |||
@@ -0,0 +1,65 @@ | |||
1 | define profile::monitoring::local_service ( | ||
2 | Optional[Hash] $common = {}, | ||
3 | Optional[Hash] $master = {}, | ||
4 | Optional[Hash] $local = {}, | ||
5 | ) { | ||
6 | $service_description = $title | ||
7 | $real_hostname = lookup("base_installation::real_hostname") | ||
8 | |||
9 | $service_generic = { | ||
10 | active_checks_enabled => "1", | ||
11 | check_freshness => "0", | ||
12 | check_interval => "10", | ||
13 | check_period => "24x7", | ||
14 | contact_groups => "admins", | ||
15 | event_handler_enabled => "1", | ||
16 | flap_detection_enabled => "1", | ||
17 | is_volatile => "0", | ||
18 | max_check_attempts => "3", | ||
19 | notification_interval => "60", | ||
20 | notification_options => "w,u,c,r", | ||
21 | notification_period => "24x7", | ||
22 | notifications_enabled => "0", | ||
23 | obsess_over_service => "1", | ||
24 | passive_checks_enabled => "1", | ||
25 | process_perf_data => "1", | ||
26 | retain_nonstatus_information => "1", | ||
27 | retain_status_information => "1", | ||
28 | retry_interval => "2", | ||
29 | } | ||
30 | |||
31 | $service_local = merge($service_generic, { | ||
32 | host_name => $real_hostname, | ||
33 | check_interval => "5", | ||
34 | max_check_attempts => "4", | ||
35 | retry_interval => "1", | ||
36 | }) | ||
37 | |||
38 | |||
39 | [true, false].each |$services_for_master| { | ||
40 | if $services_for_master { | ||
41 | $default_local = { | ||
42 | mode => "0644", | ||
43 | target => "/etc/naemon/services_for_master.cfg", | ||
44 | check_interval => $service_local["check_interval"], | ||
45 | retry_interval => $service_local["retry_interval"], | ||
46 | host_name => $service_local["host_name"], | ||
47 | use => "external-service", | ||
48 | notify => [], | ||
49 | } | ||
50 | $t = "master - " | ||
51 | $services_key = $master | ||
52 | } else { | ||
53 | $default_local = merge($service_local, { target => "/etc/naemon/objects.cfg" }) | ||
54 | $t = "" | ||
55 | $services_key = $local | ||
56 | } | ||
57 | |||
58 | $hash = merge($default_local, $common, $services_key) | ||
59 | |||
60 | nagios_service { "$t$service_description": | ||
61 | service_description => $service_description, | ||
62 | * => $hash | ||
63 | } | ||
64 | } | ||
65 | } | ||