summaryrefslogtreecommitdiff
path: root/puppet/modules/nagios/manifests/service/imap.pp
blob: 45b667ab229956e40ae57d6c9e039dbab2c7c6de (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
33
34
# check an imap service
define nagios::service::imap(
  $ensure     = 'present',
  $host       = 'absent',
  $port       = '143',
  $tls        = true,
  $tls_port   = '993'
){

  $real_host = $host ? {
    'absent' => $name,
    default  => $host
  }

  $tls_ensure = $tls ? {
    true    => $ensure,
    default => 'absent'
  }
  nagios::service{
    "imap_${name}_${port}":
      ensure => $ensure;
    "imaps_${name}_${tls_port}":
      ensure => $tls_ensure;
  }

  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}",
    }
  }
}