Puppet Class: lsys::monit

Inherits:
lsys::params
Defined in:
manifests/monit.pp

Summary

Monit installation and setup

Overview

Monit installation and setup

Examples:

include lsys::monit

Parameters:

  • prebuilt_binary (Boolean) (defaults to: true)
    • whether to download Monit binary and install or use system package

  • version (String) (defaults to: 'present')
    • system package version to install or ‘present’, ‘absent’

  • download_version (String) (defaults to: $lsys::params::monit_version)
  • binary_path (Stdlib::Unixpath) (defaults to: $lsys::params::monit_binary_path)
    • installation path to install Monit binary to

  • logfile (Stdlib::Unixpath) (defaults to: $lsys::params::monit_logfile)
    • log file location to manage with logrotate script

  • httpd (Boolean) (defaults to: true)
    • whether to start Monit with HTTP support or not

  • httpd_address (Stdlib::IP::Address) (defaults to: '127.0.0.1')
  • httpd_allow (Stdlib::IP::Address) (defaults to: '127.0.0.1')
  • httpd_user (String) (defaults to: 'admin')
  • httpd_password (Optional[String]) (defaults to: undef)


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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'manifests/monit.pp', line 25

class lsys::monit (
  Boolean $prebuilt_binary  = true,
  String  $version = 'present',
  String  $download_version = $lsys::params::monit_version,
  Stdlib::Unixpath $binary_path = $lsys::params::monit_binary_path,
  Stdlib::Unixpath $logfile = $lsys::params::monit_logfile,
  Boolean $httpd = true,
  Stdlib::IP::Address $httpd_address = '127.0.0.1',
  Stdlib::IP::Address $httpd_allow = '127.0.0.1',
  String $httpd_user = 'admin',
  Optional[String] $httpd_password = undef,
) inherits lsys::params {
  if $prebuilt_binary {
    $config_file    = $lsys::params::monit_config_file
    $package_ensure = 'absent'

    class { 'lsys::monit::prebuilt_binary':
      version     => $download_version,
      binary_path => $binary_path,
      before      => Class['monit'],
    }

    class { 'lsys::monit::service':
      binary_path => $binary_path,
      config_file => $config_file,
      logfile     => $logfile,
      before      => Class['monit'],
    }
  }
  else {
    $config_file    = undef
    $package_ensure = $version
  }

  class { 'monit':
    package_ensure   => $package_ensure,
    # configuration directory /etc/monit.d
    config_dir       => $lsys::params::monit_config_dir,
    config_dir_purge => true,

    # configuration file
    config_file      => $config_file,

    # configuration options
    logfile          => $logfile,

    # monit httpd service
    httpd            => $httpd,
    httpd_address    => $httpd_address,
    httpd_allow      => $httpd_allow,
    httpd_user       => $httpd_user,
    httpd_password   => $httpd_password,
  }
}