summaryrefslogtreecommitdiff
path: root/manifests/host.pp
blob: 88147380c987c27489e709e0b8b5f687baf23cfb (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
define nagios::host(
    $ensure = present,
    $ip = $fqdn,
    $nagios_alias = $hostname,
    $check_command = 'check-host-alive',
    $max_check_attempts = 4,
    $notification_interval = 120,
    $notification_period = '24x7',
    $notification_options = 'd,r',
    $use = 'generic-host',
    $nagios_contact_groups_in = $nagios_contact_groups,
    $parents = 'localhost' )
{
    $real_nagios_contact_groups = $nagios_contact_groups_in ? {
        '' => 'admins',
        default => $nagios_contact_groups_in
    }
    $real_nagios_parents = $parents ? {
        '' => 'localhost',
        default => $parents
    }

    @@nagios_host { $name:
        ensure => $ensure,
        address => $ip,
        alias => $nagios_alias,
        check_command => $check_command,
        max_check_attempts => $max_check_attempts,
        notification_interval => $notification_interval,
        notification_period => $notification_period,
        notification_options => $notification_options,
        parents => $real_nagios_parents,
        contact_groups => $real_nagios_contact_groups,
        use => $use,
        notify => Service[nagios],
    }
}