nagios: Create service groups automatically
This commit is contained in:
parent
c05b882bdb
commit
e7626f33b3
1 changed files with 21 additions and 6 deletions
|
@ -190,8 +190,8 @@ class nagios::server::manual inherits nagios::common {
|
|||
require => File["/etc/nagios/conf.d"],
|
||||
}
|
||||
nagios_contactgroup { "all":
|
||||
target => "${confdir}/contactgroup_all.cfg",
|
||||
notify => Service["nagios"],
|
||||
target => "${confdir}/contactgroup_all.cfg",
|
||||
notify => Service["nagios"],
|
||||
}
|
||||
|
||||
file { "${confdir}/host_default.cfg":
|
||||
|
@ -522,8 +522,8 @@ define nagios::host($address=undef, $group="NONE", $osname="NONE",
|
|||
require => File["/etc/nagios/conf.d"],
|
||||
}
|
||||
nagios_contactgroup { $group:
|
||||
target => "${confdir}/contactgroup_${group}.cfg",
|
||||
notify => Service["nagios"],
|
||||
target => "${confdir}/contactgroup_${group}.cfg",
|
||||
notify => Service["nagios"],
|
||||
}
|
||||
}
|
||||
if !defined(Nagios_hostgroup[$group]) {
|
||||
|
@ -536,8 +536,8 @@ define nagios::host($address=undef, $group="NONE", $osname="NONE",
|
|||
require => File["/etc/nagios/conf.d"],
|
||||
}
|
||||
nagios_hostgroup { $group:
|
||||
target => "${confdir}/hostgroup_${group}.cfg",
|
||||
notify => Service["nagios"],
|
||||
target => "${confdir}/hostgroup_${group}.cfg",
|
||||
notify => Service["nagios"],
|
||||
}
|
||||
}
|
||||
Nagios_host[$name] {
|
||||
|
@ -584,8 +584,23 @@ define nagios::service($host, $command, $description, $group="NONE",
|
|||
}
|
||||
|
||||
if $group != "NONE" {
|
||||
if !defined(Nagios_servicegroup[$group]) {
|
||||
file { "${confdir}/servicegroup_${group}.cfg":
|
||||
ensure => present,
|
||||
mode => "0640",
|
||||
owner => "root",
|
||||
group => "nagios",
|
||||
before => Nagios_servicegroup[$group],
|
||||
require => File["/etc/nagios/conf.d"],
|
||||
}
|
||||
nagios_servicegroup { $group:
|
||||
target => "${confdir}/servicegroup_${group}.cfg",
|
||||
notify => Service["nagios"],
|
||||
}
|
||||
}
|
||||
Nagios_service[$name] {
|
||||
contact_groups => "all,${group}",
|
||||
servicegroups => $group,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue