Puppet Class: monit

Inherits:
monit::params
Inherited by:
monit::config
monit::install
monit::service
Defined in:
manifests/init.pp

Summary

Main class, includes all other classes.

Overview

Examples:

class { 'monit': }

Parameters:

  • alert_emails (Array[String]) (defaults to: $monit::params::alert_emails)

    Specifies one or more email addresses to send global alerts to. Default value: []

  • check_interval (Integer[1]) (defaults to: $monit::params::check_interval)

    Specifies the interval between two checks of Monit. Default value: 120

  • config_file (Stdlib::Absolutepath) (defaults to: $monit::params::config_file)

    Specifies a path to the main config file. Default value: varies with operating system

  • config_dir (Stdlib::Absolutepath) (defaults to: $monit::params::config_dir)

    Specifies a path to the config directory. Default value: varies with operating system

  • config_dir_purge (Variant[Boolean, Enum['true', 'false']]) (defaults to: $monit::params::config_dir_purge)

    Specifies if unmanaged files in the config directory should be purged. Default value: ‘false’

  • httpd (Variant[Boolean, Enum['true', 'false']]) (defaults to: $monit::params::httpd)

    Specifies whether to enable the Monit Dashboard. Default value: ‘false’

  • httpd_port (Integer[1, 65535]) (defaults to: $monit::params::httpd_port)

    Specifies the port of the Monit Dashboard. Default value: 2812

  • httpd_address (String) (defaults to: $monit::params::httpd_address)

    Specifies the IP address of the Monit Dashboard. Default value: ‘locahost’

  • httpd_allow (String) (defaults to: $monit::params::httpd_allow)

    Specifies the allow option of the Monit Dashboard. Default value: ‘0.0.0.0/0.0.0.0’

  • httpd_user (String) (defaults to: $monit::params::httpd_user)

    Specifies the user to access the Monit Dashboard. Default value: ‘admin’

  • httpd_password (String) (defaults to: $monit::params::httpd_password)

    Specifies the password to access the Monit Dashboard. Default value: ‘monit’

  • logfile (Optional[String]) (defaults to: $monit::params::logfile)

    Specifies the logfile directive value. Default value: ‘/var/log/monit.log’ It is possible to use syslog instead of direct file logging. (e.g. ‘syslog facility log_daemon’)

  • mailserver (Optional[String]) (defaults to: $monit::params::mailserver)

    If set to a string, alerts will be sent by email to this mailserver. Default value: undef For more details, see: mmonit.com/monit/documentation/monit.html#Setting-a-mail-server-for-alert-delivery

  • mailformat (Optional[Hash]) (defaults to: $monit::params::mailformat)

    Specifies the alert message format. Default value: undef For more details, see: mmonit.com/monit/documentation/monit.html#Message-format

  • manage_firewall (Variant[Boolean, Enum['true', 'false']]) (defaults to: $monit::params::manage_firewall)

    If true and if puppetlabs-firewall module is present, Puppet manages firewall to allow HTTP access for Monit Dashboard. Default value: ‘false’

  • mmonit_address (Optional[String]) (defaults to: $monit::params::mmonit_address)

    *Requires at least Monit 5.0*<br /> Specifies the remote address of an M/Monit server to be used by Monit agent for report. If set to undef, M/Monit connection is disabled. Default value: undef

  • mmonit_https (Variant[Boolean, Enum['true', 'false']]) (defaults to: $monit::params::mmonit_https)

    *Requires at least Monit 5.0*<br /> Specifies wheither the protocol of the M/Monit server is HTTPs. Default value: ‘true’

  • mmonit_port (Integer[1, 65535]) (defaults to: $monit::params::mmonit_port)

    *Requires at least Monit 5.0*<br /> Specifies the remote port of the M/Monit server. Default value: 8443

  • mmonit_user (String) (defaults to: $monit::params::mmonit_user)

    *Requires at least Monit 5.0*<br /> Specifies the user to connect to the remote M/Monit server. Default value: ‘monit’ If you set both user and password to an empty string, authentication is disabled.

  • mmonit_password (String) (defaults to: $monit::params::mmonit_password)

    *Requires at least Monit 5.0*<br /> Specifies the password of the account used to connect to the remote M/Monit server. Default value: ‘monit’ If you set both user and password to an empty string, authentication is disabled.

  • mmonit_without_credential (Variant[Boolean, Enum['true', 'false']]) (defaults to: $monit::params::mmonit_without_credential)

    *Requires at least Monit 5.0*<br /> By default Monit registers credentials with M/Monit so M/Monit can smoothly communicate back to Monit and you don’t have to register Monit credentials manually in M/Monit. It is possible to disable credential registration setting this option to ‘true’. Default value: ‘false’

  • package_ensure (String) (defaults to: $monit::params::package_ensure)

    Tells Puppet whether the Monit package should be installed, and what version. Valid options: ‘present’, ‘latest’, or a specific version number. Default value: ‘present’

  • package_name (String) (defaults to: $monit::params::package_name)

    Tells Puppet what Monit package to manage. Default value: ‘monit’

  • service_ensure (Enum['running', 'stopped']) (defaults to: $monit::params::service_ensure)

    Tells Puppet whether the Monit service should be running. Default value: ‘running’

  • service_manage (Variant[Boolean, Enum['true', 'false']]) (defaults to: $monit::params::service_manage)

    Tells Puppet whether to manage the Monit service. Default value: ‘true’

  • service_name (String) (defaults to: $monit::params::service_name)

    Tells Puppet what Monit service to manage. Default value: ‘monit’

  • start_delay (Optional[Integer[1]]) (defaults to: $monit::params::start_delay)

    *Requires at least Monit 5.0* If set, Monit will wait the specified time in seconds before it starts checking services. Default value: undef

  • service_enable (Variant[Boolean, Enum['true', 'false']]) (defaults to: $monit::params::service_enable)


105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'manifests/init.pp', line 105

class monit (
  Array[String]                           $alert_emails              = $monit::params::alert_emails,
  Integer[1]                              $check_interval            = $monit::params::check_interval,
  Stdlib::Absolutepath                    $config_file               = $monit::params::config_file,
  Stdlib::Absolutepath                    $config_dir                = $monit::params::config_dir,
  Variant[Boolean, Enum['true', 'false']] $config_dir_purge          = $monit::params::config_dir_purge,
  Variant[Boolean, Enum['true', 'false']] $httpd                     = $monit::params::httpd,
  Integer[1, 65535]                       $httpd_port                = $monit::params::httpd_port,
  String                                  $httpd_address             = $monit::params::httpd_address,
  String                                  $httpd_allow               = $monit::params::httpd_allow,
  String                                  $httpd_user                = $monit::params::httpd_user,
  String                                  $httpd_password            = $monit::params::httpd_password,
  Optional[String]                        $logfile                   = $monit::params::logfile,
  Optional[String]                        $mailserver                = $monit::params::mailserver,
  Optional[Hash]                          $mailformat                = $monit::params::mailformat,
  Variant[Boolean, Enum['true', 'false']] $manage_firewall           = $monit::params::manage_firewall,
  Optional[String]                        $mmonit_address            = $monit::params::mmonit_address,
  Variant[Boolean, Enum['true', 'false']] $mmonit_https              = $monit::params::mmonit_https,
  Integer[1, 65535]                       $mmonit_port               = $monit::params::mmonit_port,
  String                                  $mmonit_user               = $monit::params::mmonit_user,
  String                                  $mmonit_password           = $monit::params::mmonit_password,
  Variant[Boolean, Enum['true', 'false']] $mmonit_without_credential = $monit::params::mmonit_without_credential,
  String                                  $package_ensure            = $monit::params::package_ensure,
  String                                  $package_name              = $monit::params::package_name,
  Variant[Boolean, Enum['true', 'false']] $service_enable            = $monit::params::service_enable,
  Enum['running', 'stopped']              $service_ensure            = $monit::params::service_ensure,
  Variant[Boolean, Enum['true', 'false']] $service_manage            = $monit::params::service_manage,
  String                                  $service_name              = $monit::params::service_name,
  Optional[Integer[1]]                    $start_delay               = $monit::params::start_delay,
) inherits monit::params {
  if $logfile and !($logfile =~ /^syslog(\s+facility\s+log_(local[0-7]|daemon))?/) {
    assert_type(Stdlib::Absolutepath, $logfile)
  }

  # Use the monit_version fact if available, else use the default for the
  # platform.
  $monit_version_real = pick($facts['monit_version'], $monit::params::monit_version)

  if($start_delay and $start_delay > 0 and versioncmp($monit_version_real,'5') < 0) {
    fail("start_delay requires at least Monit 5.0. Detected version is <${monit_version_real}>.")
  }

  contain "${module_name}::install"
  contain "${module_name}::config"
  contain "${module_name}::service"
  contain "${module_name}::firewall"

  Class["${module_name}::install"] -> Class["${module_name}::config"] ~> Class["${module_name}::service"] -> Class["${module_name}::firewall"]
}