nagios: Added parent host support to nagios::target.

This commit is contained in:
Timo Mkinen 2013-05-06 23:40:53 +03:00
parent 20078c82ea
commit f9e719d33e
2 changed files with 11 additions and 2 deletions

View file

@ -425,9 +425,11 @@ define nagios::contact::pushover($token, $group=["all"],
# Operating system name for hostextinfo. # Operating system name for hostextinfo.
# $osicon: # $osicon:
# Operating system icon name for hostextinfo. # Operating system icon name for hostextinfo.
# $parent:
# Parent hostname.
# #
define nagios::host($group="NONE", $osname="NONE", $osicon="NONE", define nagios::host($group="NONE", $osname="NONE", $osicon="NONE",
$confdir=$nagios::common::confdir) { $confdir=$nagios::common::confdir, $parent=undef) {
file { "${confdir}/host_${name}.cfg": file { "${confdir}/host_${name}.cfg":
ensure => present, ensure => present,
@ -501,6 +503,7 @@ define nagios::host($group="NONE", $osname="NONE", $osicon="NONE",
Nagios_Host[$name] { Nagios_Host[$name] {
contact_groups => "all,${group}", contact_groups => "all,${group}",
hostgroups => $group, hostgroups => $group,
parents => $parent,
} }
} }

View file

@ -1,11 +1,16 @@
# Configure nagios target. # Configure nagios target.
# #
# === Parameters
#
# $parent:
# Parent hostname.
#
# === Global variables # === Global variables
# #
# $nagios_target_group: # $nagios_target_group:
# Host and service group name. Defaults to $domain. # Host and service group name. Defaults to $domain.
# #
class nagios::target { class nagios::target($parent=undef) {
if $nagios_target_group { if $nagios_target_group {
$group = $nagios_target_group $group = $nagios_target_group
@ -24,6 +29,7 @@ class nagios::target {
"" => "NONE", "" => "NONE",
default => inline_template("<%= osfamily.downcase %>") default => inline_template("<%= osfamily.downcase %>")
}, },
parent => $parent,
} }
Nagios::Service { Nagios::Service {