nagios: Add service dependencies for service certificate checks

This commit is contained in:
Ossi Salmi 2015-08-27 18:47:49 +03:00
parent 45ad1a4a65
commit 1c39964c17
2 changed files with 48 additions and 14 deletions

View file

@ -609,6 +609,7 @@ define nagios::host($address=undef, $group="NONE", $osname="NONE",
# Hostgroup name.
#
define nagios::service($host, $command, $description, $group="NONE",
$depended_host=undef, $depended_service=undef,
$confdir=$nagios::common::confdir) {
file { "${confdir}/service_${name}.cfg":
@ -649,6 +650,25 @@ define nagios::service($host, $command, $description, $group="NONE",
servicegroups => $group,
}
}
if $depended_host and $depended_service {
file { "${confdir}/service_dependency_${name}.cfg":
ensure => present,
mode => "0640",
owner => "root",
group => "nagios",
before => Nagios_servicedependency[$name],
require => File["/etc/nagios/conf.d"],
}
nagios_servicedependency { $name:
dependent_host_name => $host,
dependent_service_description => $description,
host_name => $depended_host,
service_description => $depended_service,
execution_failure_criteria => 'c,p',
target => "${confdir}/service_dependency_${name}.cfg",
notify => Service["nagios"],
}
}
}

View file

@ -120,8 +120,10 @@ class nagios::target::https($expect=undef) inherits nagios::target {
}
@@nagios::service { "${::homename}_https_certificate":
command => "check_http!--ssl -C 14",
description => "HTTPS Certificate",
command => "check_http!--ssl -C 14",
description => "HTTPS Certificate",
depended_host => $::homename,
depended_service => "HTTPS",
}
}
@ -137,8 +139,10 @@ class nagios::target::imaps inherits nagios::target {
}
@@nagios::service { "${::homename}_imaps_certificate":
command => "check_imap!--ssl -p 993 -D 14",
description => "IMAPS Certificate",
command => "check_imap!--ssl -p 993 -D 14",
description => "IMAPS Certificate",
depended_host => $::homename,
depended_service => "IMAPS",
}
}
@ -166,8 +170,10 @@ class nagios::target::ipp::ssl inherits nagios::target {
}
@@nagios::service { "${::homename}_ipp_ssl_certificate":
command => "check_http!-p 631 --ssl -C 14",
description => "IPP + SSL Certificate",
command => "check_http!-p 631 --ssl -C 14",
description => "IPP + SSL Certificate",
depended_host => $::homename,
depended_service => "IPP + SSL",
}
}
@ -183,8 +189,10 @@ class nagios::target::jabber inherits nagios::target {
}
@@nagios::service { "${::homename}_jabber_certificate":
command => "check_jabber!--ssl -p 5223 -D 14",
description => "Jabber Certificate",
command => "check_jabber!--ssl -p 5223 -D 14",
description => "Jabber Certificate",
depended_host => $::homename,
depended_service => "Jabber",
}
}
@ -248,8 +256,10 @@ class nagios::target::pop3s inherits nagios::target {
}
@@nagios::service { "${::homename}_pop3s_certificate":
command => "check_pop!--ssl -p 995 -D 14",
description => "POP3s Certificate",
command => "check_pop!--ssl -p 995 -D 14",
description => "POP3s Certificate",
depended_host => $::homename,
depended_service => "POP3s",
}
}
@ -265,8 +275,10 @@ class nagios::target::puppet inherits nagios::target {
}
@@nagios::service { "${::homename}_puppet_certificate":
command => "check_http!--ssl -p 8140 -C 30,14",
description => "Puppet Certificate",
command => "check_http!--ssl -p 8140 -C 30,14",
description => "Puppet Certificate",
depended_host => $::homename,
depended_service => "Puppet Master",
}
}
@ -306,8 +318,10 @@ class nagios::target::submission inherits nagios::target {
}
@@nagios::service { "${::homename}_submission_certificate":
command => "check_smtp!--starttls -p 587 -D 14",
description => "Submission Certificate",
command => "check_smtp!--starttls -p 587 -D 14",
description => "Submission Certificate",
depended_host => $::homename,
depended_service => "Submission",
}
}