Puppet Class: psick::monitor::check_mk

Defined in:
manifests/monitor/check_mk.pp

Overview

This class manages the installation and configuation of checkMK

Parameters:

  • server (Optional[String]) (defaults to: undef)

    The monitor server hostname

  • port (String) (defaults to: '6522')

    The port to use

  • interval (String) (defaults to: '120')

    The check interval

  • manage (Boolean) (defaults to: $::psick::manage)
  • noop_manage (Boolean) (defaults to: $::psick::noop_manage)
  • noop_value (Boolean) (defaults to: $::psick::noop_value)


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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'manifests/monitor/check_mk.pp', line 7

class psick::monitor::check_mk (
  Optional[String] $server    = undef,
  String $port                = '6522',
  String $interval            = '120',
  Boolean $manage             = $::psick::manage,
  Boolean $noop_manage        = $::psick::noop_manage,
  Boolean $noop_value         = $::psick::noop_value,
) {
  if $manage {
    if $noop_manage {
      noop($noop_value)
    }
    $packages = $::osfamily ? {
      'RedHat' => [ 'check_mk-agent' , 'check_mk-agent-logwatch' ] ,
      'Debian' => [ 'check_mk-agent' , 'check_mk-agent-logwatch' ] ,
      'Suse'   => [ 'check_mk-agent' , 'check_mk-agent-logwatch' , 'check_mk-plugins'],
      'RedHat' => [ 'check_mk-agent' , 'check_mk-agent-logwatch' ,
      'check_mk-plugins'],
      'Suse' => [ 'check_mk-agent' , 'check_mk-agent-logwatch' ,
      'check_mk-plugins'],
      default  => [],
    }

    $init_script = $::osfamily ? {
      'Debian' => '/etc/default/cmk-passiv',
      default  => '/etc/sysconfig/cmk-passiv',
    }

    $packages.each |$pkg| {
      ensure_packages($pkg)
    }

    if $packages != [] {
      service { 'cmk-passiv':
        ensure  => running,
        enable  => true,
        require => Package['check_mk-agent'],
      }

      if $server {
        file { $init_script:
          content => "${server} ${interval} ${port}\n",
          notify  => Service['cmk-passiv'],
          require => Package['check_mk-agent'],
        }
      }
    }
  }
}