]> git.immae.eu Git - perso/Immae/Projets/Puppet.git/blob - modules/profile/manifests/monitoring/local_service.pp
Prepare master monitoring
[perso/Immae/Projets/Puppet.git] / modules / profile / manifests / monitoring / local_service.pp
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 }