summaryrefslogtreecommitdiff
path: root/manifests/service
diff options
context:
space:
mode:
Diffstat (limited to 'manifests/service')
-rw-r--r--manifests/service/http.pp4
-rw-r--r--manifests/service/smtp.pp50
-rw-r--r--manifests/service/ssmtp.pp32
3 files changed, 86 insertions, 0 deletions
diff --git a/manifests/service/http.pp b/manifests/service/http.pp
index 5fd9890..8fd5059 100644
--- a/manifests/service/http.pp
+++ b/manifests/service/http.pp
@@ -8,6 +8,7 @@ define nagios::service::http(
$check_domain = 'absent',
$check_url = '/',
$check_code = 'OK',
+ $use = 'generic-service',
$ssl_mode = false
){
$real_check_domain = $check_domain ? {
@@ -18,12 +19,14 @@ define nagios::service::http(
'force',true,'only': {
nagios::service{"https_${name}_${check_code}":
ensure => $ensure,
+ use => $use,
check_command => "check_https_url_regex!${real_check_domain}!${check_url}!'${check_code}'",
}
case $ssl_mode {
'force': {
nagios::service{"httprd_${name}":
ensure => $ensure,
+ use => $use,
check_command => "check_http_url_regex!${real_check_domain}!${check_url}!'301'",
}
}
@@ -34,6 +37,7 @@ define nagios::service::http(
false,true: {
nagios::service{"http_${name}_${check_code}":
ensure => $ensure,
+ use => $use,
check_command => "check_http_url_regex!${real_check_domain}!${check_url}!'${check_code}'",
}
}
diff --git a/manifests/service/smtp.pp b/manifests/service/smtp.pp
new file mode 100644
index 0000000..14237a9
--- /dev/null
+++ b/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}",
+ }
+ }
+ }
+}
diff --git a/manifests/service/ssmtp.pp b/manifests/service/ssmtp.pp
new file mode 100644
index 0000000..b05678a
--- /dev/null
+++ b/manifests/service/ssmtp.pp
@@ -0,0 +1,32 @@
+define nagios::service::ssmtp(
+ $ensure = 'present',
+ $host = 'absent',
+ $port = '465',
+ $cert_days = 10
+){
+ $real_host = $host ? {
+ 'absent' => $name,
+ default => $host
+ }
+
+ nagios::service{
+ "ssmtp_${name}_${port}":
+ ensure => $ensure;
+ "ssmtp_cert_${name}_${port}":
+ ensure => $cert_days ? {
+ 'absent' => 'absent',
+ default => $ensure
+ };
+ }
+
+ if $ensure != 'absent' {
+ Nagios::Service["ssmtp_${name}_${port}"]{
+ check_command => "check_ssmtp!${real_host}!${port}",
+ }
+ if $cert_days != 'absent' {
+ Nagios::Service["ssmtp_cert_${name}_${port}"]{
+ check_command => "check_ssmtp_cert!${real_host}!${port}!${cert_days}",
+ }
+ }
+ }
+}