Defined Type: monit::process

Defined in:
manifests/process.pp

Overview

Configures monit watchdog for given process name.

matching
  • Match process by string. Optional. Default the same as process name.

pidfile
  • Match process by its pidfile. Optional. Default ”.

stop_command
  • How monit should issue stop command for process. Mandatory.

start_command
  • How monit should issue start command for process. Mandatory.

timeout
  • Configure monit to wait for the start/stop action to finish by checking the

process table. Optional. Default 30 sec.

Note, if service is already defined in catalog, it would be redefined to monit provider.

Parameters:

  • matching (Any) (defaults to: $name)
  • ensure (Any) (defaults to: 'running')
  • pidfile (Any) (defaults to: '')
  • timeout (Any) (defaults to: 30)
  • start_command (Any)
  • stop_command (Any)


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
# File 'manifests/process.pp', line 12

define monit::process(
  $matching = $name,
  $ensure   = 'running',
  $pidfile  = '',
  $timeout  = 30,
  $start_command,
  $stop_command
) {

  include monit
  $servicep = $::monit::params::servicep
  $included = $::monit::params::included

  file { "${included}/${name}" :
    ensure  => present,
    owner   => 'root',
    group   => 'root',
    content => template('monit/process.erb'),
    notify  => Class['monit::service'],
    require => Class['monit::package'],
  }

  if defined(Service[$name]) {
    Service <| title == $name |> {
      ensure   => $ensure,
      provider => 'monit',
      require  => [ Service['monit'], File["${included}/${name}"], ],
    }
  } else {
    service {$name:
      ensure   => $ensure,
      provider => 'monit',
      require  => [ Service['monit'], File["${included}/${name}"], ],
    }
  }

}