summaryrefslogtreecommitdiff
path: root/manifests/service.pp
blob: 42d9a4d91da7750e2d88987a705fd85f1b85159c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
define nagios::service(
    $ensure = present,
    $check_command,
    $host_name = $fqdn,
    $use = 'generic-service',
    $notification_period = "24x7",
    $max_check_attempts = 4,
    $retry_check_interval = 1,
    $notification_interval = 960,
    $normal_check_interval = 5,
    $check_period = "24x7",
    $nagios_contact_groups_in = $nagios_contact_groups,
    $service_description = 'absent')
{

    # this ensures nagios internal check, that every 
    # service has it's host
    # temporary disabled.
    # include nagios::target::host

    $real_nagios_contact_groups = $nagios_contact_groups_in ? {
        '' => 'admins',
        default => $nagios_contact_groups_in
    }
    @@nagios_service {$name:
        ensure => $ensure,
        check_command => $check_command,
        use => $use,
        host_name => $host_name,
        notification_period => $notification_period,
        max_check_attempts => $max_check_attempts,
        retry_check_interval => $retry_check_interval,
        notification_interval => $notification_interval,
        normal_check_interval => $normal_check_interval,
        contact_groups => $real_nagios_contact_groups,
        check_period => $check_period,
        notify => Service[nagios],
    }
    case $service_description {
        'absent': {
            Nagios_service[$name]{
                service_description => $name,
            }
        }
        default: {
            Nagios_service[$name]{
                service_description => $service_description,
            }
        }
    }
}