Forge Home

monit

Performs installation and configuration of Monit service, along with fine grained definition of checks

32,859 downloads

166 latest version

3.9 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 2.2.2 (latest)
  • 2.2.1
  • 2.2.0
  • 2.1.0
  • 2.0.1
  • 2.0.0
  • 1.1.0
  • 1.0.0
  • 0.3.3
  • 0.3.2
  • 0.3.1
  • 0.3.0
  • 0.2.1
  • 0.2.0
  • 0.1.0
released Jul 6th 2015
This version is compatible with:
  • , ,

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'sbitio-monit', '0.3.1'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add sbitio-monit
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install sbitio-monit --version 0.3.1

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

sbitio/monit — version 0.3.1 Jul 6th 2015

Puppet Monit

puppet forge version last tag

Performs installation and configuration of Monit service, along with fine grained definition of checks.

All check types provided by Monit are supported. Namely: directory, fifo, file, filesystem, host, process, program, and system.

In adition to primitive types, a compound check type is provided: service. It is a set of primitives to check a service's init script, binary and process.

Classes and Defined Types

Class: monit

monit class is the responsible of installing and configuring the service. Almost all configuration options for monitrc are exposed as class parameters.

Also accepts a checks parameter, to pass in checks definitions, easy provided from Hiera.

Lastly, this class also configures a system check with sane defaults. It can be disabled or tweaked to fit your needs. This check includes loadavg, cpu, memory, swap and filesytem tests.

See manifests/init.pp for a reference of all supported parameters.

Defined type: monit::check

Check types are implemented by defined types, named after monit::check::TYPE. All check types have several configuration options in common (ex: group, priority, alerts, dependencies, etc.), along with the check specific options.

See manifests/check/*.pp for a reference of parameters accepted by each check type.

On the other hand, monit::check defined type is a facade for all check types. It works as a single entry point to declare any type of check in the same way. Common configuration options are parameters of the defined type, and check specific options are passed through a hash in the config parameter.

See manifests/check.pp for a reference of all parameters accepted by monit::check.

Example of use

Puppet code

There's a bunch of examples for configuring real services across Debian and RedHat families in sbitio/ducktape Please refer to manifests/*/external/monit.pp files.

Hiera


# Main monitrc configuration options.
monit::check_interval    : '60'
monit::check_start_delay : '120'
monit::mailserver        : 'localhost'
monit::eventqueue        : true
monit::alerts            :
  - 'root@localhost'
  - 'sla1@example.com only on { timeout, nonexist }'
monit::httpserver        : true
monit::httpserver_allow  :
  - 'admin:secret'

# Tweak system check.
monit::system_fs         : ['/', '/mnt/backups']

# Add some checks.
monit::checks :

  somefs :
    type     : 'filesystem'
    config   :
      path   : '/mount/somefs'
    tests    :
      - type: 'fsflags'
      - type: 'permission'
        value: '0755'
      - type: 'space'
        operator: '>'
        value: '80%'

  sshd :
    type    : 'process'
    config  :
      pidfile       : '/var/run/sshd.pid'
      program_start : '/etc/init.d/sshd start'
      program_stop  : '/etc/init.d/sshd stop'
    tests  :
      - type     : 'connection'
        host     : '127.0.0.1'
        port     : '22'
        protocol : 'ssh'
        action   : 'restart'

  php5-fpm :
    type    : process
    config  :
      pidfile       : '/var/run/php5-fpm.pid'
      binary        : '/usr/sbin/php5-fpm'
      program_start : '/etc/init.d/php5-fpm start'
      program_stop  : '/etc/init.d/php5-fpm stop'
    tests  :
      - type          : 'connection'
        host          : '127.0.0.1'
        port          : '9000''
        socket_type   : 'TCP'
        protocol      : 'GENERIC'
        protocol_test :
          - send   : '"\0x01\0x09\0x00\0x00\0x00\0x00\0x08\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00"'
            expect : '"\0x01\0x0A"'
        action   : 'restart'

  ntp:
    type   : process
    config :
      pidfile       : '/var/run/ntpd.pid'
      program_start : '/etc/init.d/ntpd start'
      program_stop  : '/etc/init.d/ntpd stop'
    tests  :
      - type        : connection
        host        : 127.0.0.1
        socket_type : udp
        port        : 123
        protocol    : ntp
        action      : restart

  varnish:
    type   : 'process'
    config :
      pidfile       : '/var/run/varnish.pid'
      program_start : '/etc/init.d/varnish start'
      program_stop  : '/etc/init.d/varnish stop'
    tests  :
      - type: 'connection'
        host: '127.0.0.1'
        port: '8080'
        protocol: 'http'
        protocol_test:
          request: '/health.varnish'
      - type      : 'cpu(user)'
        operator  : '>'
        value     : '60%'
        tolerance :
          cycles  : '2'
      - type      : 'children'
        operator  : '>'
        value     : '150'

  httpd:
    type   : 'service'
    config :
      pidfile : '/var/run/httpd/httpd.pid'
      binary  : '/usr/sbin/httpd'
      initd   : '/etc/init.d/httpd'
    tests  :
      - type: 'connection'
        host: '127.0.0.1'
        port: '80'
        protocol: 'http'

License

MIT License, see LICENSE file

Contact

Use contact form on http://sbit.io

Support

Please log tickets and issues on GitHub