summaryrefslogtreecommitdiff
path: root/manifests/service/imap.pp
blob: b703db4a678be57bdb1bc8f451d76c10fcc9132f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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}",
    }
  }
}