Puppet Class: lsys::monit::service

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

Summary

Monit service scripts

Overview

Monit service scripts

- startup script
- logrotate script

Examples:

include lsys::monit::service

Parameters:

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

  • config_file (Stdlib::Unixpath) (defaults to: $lsys::params::monit_config_file)
    • configuration file to use for installed Monit binary

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

  • pid_file (Stdlib::Unixpath) (defaults to: $lsys::params::monit_pid_file)


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
# File 'manifests/monit/service.pp', line 20

class lsys::monit::service (
  Stdlib::Unixpath $binary_path = $lsys::params::monit_binary_path,
  Stdlib::Unixpath $config_file = $lsys::params::monit_config_file,
  Stdlib::Unixpath $logfile = $lsys::params::monit_logfile,
  Stdlib::Unixpath $pid_file = $lsys::params::monit_pid_file,
) inherits lsys::params {
  include lsys::systemd

  if $facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] in ['5', '6'] {
    $init_path     = '/etc/rc.d/init.d/monit'
    $init_template = 'lsys/monit/init.erb'
  }
  else {
    $init_path     = '/etc/systemd/system/monit.service'
    $init_template = 'lsys/monit/systemd.erb'

    File['monit_startup_script'] ~> Class['lsys::systemd']
  }

  file { 'monit_startup_script':
    ensure  => file,
    path    => $init_path,
    content => template($init_template),
  }

  file { 'monit_logrotate_script':
    ensure  => file,
    path    => '/etc/logrotate.d/monit',
    content => epp('lsys/monit/logrotate.epp', { logfile => $logfile }),
  }
}