diff options
Diffstat (limited to 'manifests/service')
-rw-r--r-- | manifests/service/imap.pp | 32 | ||||
-rw-r--r-- | manifests/service/mysql.pp | 14 | ||||
-rw-r--r-- | manifests/service/pop.pp | 32 |
3 files changed, 77 insertions, 1 deletions
diff --git a/manifests/service/imap.pp b/manifests/service/imap.pp new file mode 100644 index 0000000..b703db4 --- /dev/null +++ b/manifests/service/imap.pp @@ -0,0 +1,32 @@ +define nagios::service::imap( + $ensure = 'present', + $host = 'absent', + $port = '143', + $tls = true, + $tls_port = '993' +){ + + $real_host = $host ? { + 'absent' => $name, + default => $host + } + + nagios::service{ + "imap_${name}_${port}": + ensure => $ensure; + "imaps_${name}_${tls_port}": + ensure => $tls ? { + true => $ensure, + default => 'absent' + }; + } + + if $ensure != 'absent' { + Nagios::Service["imap_${name}_${port}"]{ + check_command => "check_imap!${real_host}!${port}", + } + Nagios::Service["imaps_${name}_${tls_port}"]{ + check_command => "check_imap_ssl!${real_host}!${tls_port}", + } + } +} diff --git a/manifests/service/mysql.pp b/manifests/service/mysql.pp index d501f06..2fde402 100644 --- a/manifests/service/mysql.pp +++ b/manifests/service/mysql.pp @@ -20,7 +20,19 @@ define nagios::service::mysql( if ($check_host == 'absent') { fail("Please specify a hostname, ip address or socket to check a mysql instance.") } + + if $check_name != undef { + $real_check_name = "!--name $check_name" + } + if $check_warning != undef { + $real_check_warning = "!--warning $check_warning" + } + + if $check_critical != undef { + $real_check_critical = "!--critical $check_critical" + } + case $check_mode { 'tcp': { if ($check_host == 'localhost') { @@ -42,6 +54,6 @@ define nagios::service::mysql( nagios::service { "mysql_health_${name}": ensure => $ensure, - check_command => "check_mysql_health!${check_host}!${check_port}!${check_username}!${check_password}!${name}!${check_database}", + check_command => "check_mysql_health!${real_check_host}!${check_port}!${check_username}!${check_password}!${check_health_mode}!${check_database}${real_check_name}${real_check_warning}${real_check_critical}", } } diff --git a/manifests/service/pop.pp b/manifests/service/pop.pp new file mode 100644 index 0000000..9ec4aec --- /dev/null +++ b/manifests/service/pop.pp @@ -0,0 +1,32 @@ +define nagios::service::pop( + $ensure = 'present', + $host = 'absent', + $port = '110', + $tls = true, + $tls_port = '995' +){ + + $real_host = $host ? { + 'absent' => $name, + default => $host + } + + nagios::service{ + "pop_${name}_${port}": + ensure => $ensure; + "pops_${name}_${tls_port}": + ensure => $tls ? { + true => $ensure, + default => 'absent' + }; + } + + if $ensure != 'absent' { + Nagios::Service["pop_${name}_${port}"]{ + check_command => "check_pop3!${real_host}!${port}", + } + Nagios::Service["pops_${name}_${tls_port}"]{ + check_command => "check_pop3_ssl!${real_host}!${tls_port}", + } + } +} |