summaryrefslogtreecommitdiff
path: root/puppet/modules/nagios/manifests/service/ssmtp.pp
blob: b05678a61fc0b0c1c9643bc5e9984c47f0f330e0 (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::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}",
      }
    }
  }
}