Defined Type: monit::check::process

Defined in:
manifests/check/process.pp

Overview

monit::check::process

Implement Monit’s CHECK PROCESS

Parameters:

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

    Command to start the service.

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

    Command to stop the service.

  • template (String) (defaults to: 'monit/check/process.erb')

    Template used to generate the check file.

  • pidfile (Optional[Stdlib::Absolutepath]) (defaults to: undef)

    Path to the PID file of the service.

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

    If the service doesn’t provide a PID file, use this option to pass a regex pattern to check the process list.

  • uid (Optional[Integer]) (defaults to: undef)

    UID of the process.

  • gid (Optional[Integer]) (defaults to: undef)

    GID of the process.

  • timeout (Optional[Numeric]) (defaults to: undef)

    Timeout on the start/stop operations.

  • timeout_start (Optional[Numeric]) (defaults to: undef)

    Timeout on the start operation. Generic timeout will be used if not specified.

  • timeout_stop (Optional[Numeric]) (defaults to: undef)

    Timeout on the stop operation. Generic timeout will be used if not specified.

  • restart_limit (Optional[Hash]) (defaults to: undef)

    Used to define limits on restarts.

  • ensure (Monit::Check::Ensure) (defaults to: 'present')

    Whether this check must be present or absent.

  • group (String) (defaults to: $name)

    Monit group.

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

    Service poll time.

  • alerts (Array[String]) (defaults to: [])

    Alert recipients (with event filters) to set.

  • noalerts (Array[String]) (defaults to: [])

    Alerts to disable for this check.

  • tests (Monit::Check::Tests) (defaults to: [])

    Monit tests.

  • depends (Array[String]) (defaults to: [])

    Dependencies of this check on other checks.

  • priority (String) (defaults to: '20')

    Used as a prefix for the filename generated. Load order doesn’t matter to Monit. This is just a facility to organize your checks by filename.

  • bundle (String) (defaults to: $name)

    Used to group checks by filename. All checks in the same bundle will be added to the same filename.

  • order (Integer) (defaults to: 0)

    Order of the check within the bundle filename.



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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'manifests/check/process.pp', line 50

define monit::check::process (
  # Check type specific.
  Optional[String] $program_start         = undef,
  Optional[String] $program_stop          = undef,
  String $template                        = 'monit/check/process.erb',
  Optional[Stdlib::Absolutepath] $pidfile = undef,
  Optional[String] $matching              = undef,
  Optional[Integer] $uid                  = undef,
  Optional[Integer] $gid                  = undef,
  Optional[Numeric] $timeout              = undef,
  Optional[Numeric] $timeout_start        = undef,
  Optional[Numeric] $timeout_stop         = undef,

  # Common parameters.
  Monit::Check::Ensure $ensure            = 'present',
  String $group                           = $name,
  Optional[String] $every                 = undef,
  Array[String] $alerts                   = [],
  Array[String] $noalerts                 = [],
  Monit::Check::Tests $tests              = [],
  Array[String] $depends                  = [],
  String $priority                        = '20',
  String $bundle                          = $name,
  Integer $order                          = 0,
  Optional[Hash] $restart_limit           = undef,
) {
  if $pidfile {
    if $matching {
      warning("monit::check::process: both 'pidfile' and 'matching' provided. Ignoring 'matching'.")
    }
  }
  elsif !$matching {
    fail("monit::check::process: no parameter 'pidfile' nor 'matching' provided. You must provide one of both.")
  }

  if $timeout {
    $real_timeout_start = pick($timeout_start, $timeout)
    $real_timeout_stop  = pick($timeout_stop, $timeout)
  }

  monit::check::instance { "${name}_instance":
    ensure        => $ensure,
    name          => $name,
    type          => 'process',
    header        => template($template),
    group         => $group,
    every         => $every,
    alerts        => $alerts,
    noalerts      => $noalerts,
    tests         => $tests,
    depends       => $depends,
    priority      => $priority,
    bundle        => $bundle,
    order         => $order,
    restart_limit => $restart_limit,
  }
}