Defined Type: nagios::host

Defined in:
manifests/host.pp

Overview

Parameters:

  • ensure (Any) (defaults to: present)
  • address (Any) (defaults to: false)
  • nagios_alias (Any) (defaults to: undef)
  • hostgroups (Any) (defaults to: undef)
  • contact_groups (Any) (defaults to: undef)
  • use (Any) (defaults to: 'generic-host-active')


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
# File 'manifests/host.pp', line 11

define nagios::host (
  $ensure=present,
  $address=false,
  $nagios_alias=undef,
  $hostgroups=undef,
  $contact_groups=undef,
  $use='generic-host-active',
  ) {

  include ::nagios::params

  $fname = regsubst($name, '\W', '_', 'G')
  $nagios_address = $address ? {
    false   => $::ipaddress,
    default => $address,
  }

  nagios_host { $name:
    ensure         => $ensure,
    use            => $use,
    address        => $nagios_address,
    # lint:ignore:alias_parameter
    alias          => $nagios_alias,
    # lint:endignore
    hostgroups     => $hostgroups,
    contact_groups => $contact_groups,
    target         => "${nagios::params::resourcedir}/host-${fname}.cfg",
    notify         => Exec['nagios-restart'],
  }

  file { "${nagios::params::resourcedir}/host-${fname}.cfg":
    ensure => $ensure,
    owner  => 'root',
    mode   => '0644',
    before => Nagios_host[$name],
  }

}