aboutsummaryrefslogtreecommitdiff
path: root/manifests/subsystem/monitor.pp
blob: ebb99e59de0c49a0ac53e616587c698efcc982a3 (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
35
36
37
38
39
class nodo::subsystem::monitor(
  $use_nagios    = hiera('nodo::subsystem::monitor::use_nagios',    True),
  $address       = hiera('nodo::subsystem::monitor::address',       $::ipaddress),
  $check_command = hiera('nodo::subsystem::monitor::check_command', 'check_ping'),
  $check_ping    = hiera('nodo::subsystem::monitor::check_ping',    present),
  $check_ssh     = hiera('nodo::subsystem::monitor::check_ssh',     absent),
  $ping_rate     = hiera('nodo::subsystem::monitor::ping_rate',     '!100.0,20%!500.0,60%')
) {
  file { '/usr/local/sbin/ifcheck' :
    ensure  => present,
    owner   => 'root',
    group   => 'root',
    mode    => '0755',
    source  => 'puppet:///modules/nodo/bin/ifcheck',
  }

  if $use_nagios != false {

    $command = $check_command ? {
      'check_ping' => "check_ping${ping_rate}",
      default      => $check_command,
    }

    class { 'nagios::target':
      address       => $address,
      check_command => $command,
    }

    nagios::service::ping { "${::fqdn}":
      ensure    => $check_ping,
      ping_rate => $ping_rate,
    }

    nagios::service { "check_ssh4":
      ensure        => $check_ssh,
      check_command => "check_ssh_4",
    }
  }
}