Skip to content

Commit

Permalink
add nagios
Browse files Browse the repository at this point in the history
  • Loading branch information
b4ldr committed Jun 2, 2016
1 parent 5baf461 commit fec7098
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
6 changes: 6 additions & 0 deletions manifests/zone.pp
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,10 @@
content => template($::knot::zones_template),
order => '20';
}
if $::knot::manage_nagios and $::knot::enable {
knot::zone::nagios {$zones:
masters => $masters,
slaves => $provide_xfr,
}
}
}
32 changes: 32 additions & 0 deletions manifests/zone/nagios.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# knot::zone::nagios
#
define knot::zone::nagios (
$slaves = [],
$masters = [],
) {
validate_array($slaves)
validate_array($masters)
$_masters = delete($masters,['127.0.0.1','0::1'])
$_slaves = delete($slaves,['127.0.0.1','0::1'])
$addresses = join($::knot::ip_addresses, ' ')
if ! empty($_masters) {
$master_check_args = join($_masters, ' ')
@@nagios_service{ "${::fqdn}_DNS_ZONE_MASTERS_${name}":
ensure => present,
use => 'generic-service',
host_name => $::fqdn,
service_description => "DNS_ZONE_MASTERS_${name}",
check_command => "check_nrpe_args!check_dns!${name}!${master_check_args}!${addresses}",
}
}
if ! empty($_slaves) {
$slave_check_args = join($_slaves, ' ')
@@nagios_service{ "${::fqdn}_DNS_ZONE_SLAVES_${name}":
ensure => present,
use => 'generic-service',
host_name => $::fqdn,
service_description => "DNS_ZONE_MASTERS_${name}",
check_command => "check_nrpe_args!check_dns!${name}!${slave_check_args}!${addresses}",
}
}
}

0 comments on commit fec7098

Please sign in to comment.