From a86a9bbaa31c0859abf0b7f8c49f58b0a68ad134 Mon Sep 17 00:00:00 2001 From: varac Date: Thu, 9 Jun 2016 17:32:59 +0200 Subject: git subrepo clone https://leap.se/git/puppet_nagios puppet/modules/nagios subrepo: subdir: "puppet/modules/nagios" merged: "e6fee3c" upstream: origin: "https://leap.se/git/puppet_nagios" branch: "master" commit: "e6fee3c" git-subrepo: version: "0.3.0" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "cb2995b" --- puppet/modules/nagios/manifests/service/smtp.pp | 50 +++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 puppet/modules/nagios/manifests/service/smtp.pp (limited to 'puppet/modules/nagios/manifests/service/smtp.pp') diff --git a/puppet/modules/nagios/manifests/service/smtp.pp b/puppet/modules/nagios/manifests/service/smtp.pp new file mode 100644 index 00000000..14237a9e --- /dev/null +++ b/puppet/modules/nagios/manifests/service/smtp.pp @@ -0,0 +1,50 @@ +# true: +# - true : check tls and plain connect *defualt* +# - false : check plain connection only +# cert_days: +# If tls is used add an additionl check +# to check for validity for cert. +# - 'absent' : do not execute that check +# - INTEGER : Minimum number of days a certificate +# has to be valid. Default: 10 +define nagios::service::smtp( + $ensure = 'present', + $host = 'absent', + $port = '25', + $tls = true, + $cert_days = 10 +){ + $real_host = $host ? { + 'absent' => $name, + default => $host + } + + nagios::service{ + "smtp_${name}_${port}": + ensure => $ensure; + "smtp_tls_${name}_${port}": + ensure => $tls ? { + true => $ensure, + default => 'absent' + }; + "smtp_tls_cert_${name}_${port}": + ensure => $cert_days ? { + 'absent' => 'absent', + default => $ensure + }; + } + + if $ensure != 'absent' { + Nagios::Service["smtp_${name}_${port}"]{ + check_command => "check_smtp!${real_host}!${port}", + } + Nagios::Service["smtp_tls_${name}_${port}"]{ + check_command => "check_smtp_tls!${real_host}!${port}", + } + if $cert_days != 'absent' { + Nagios::Service["smtp_tls_cert_${name}_${port}"]{ + check_command => "check_smtp_cert!${real_host}!${port}!${cert_days}", + } + } + } +} -- cgit v1.2.3