nagios: Create service groups automatically
This commit is contained in:
parent
c05b882bdb
commit
e7626f33b3
1 changed files with 21 additions and 6 deletions
|
@ -584,8 +584,23 @@ define nagios::service($host, $command, $description, $group="NONE",
|
||||||
}
|
}
|
||||||
|
|
||||||
if $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] {
|
Nagios_service[$name] {
|
||||||
contact_groups => "all,${group}",
|
contact_groups => "all,${group}",
|
||||||
|
servicegroups => $group,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue