Code Monkey home page Code Monkey logo

puppet-monit's Introduction

monit

[Build Status] (https://travis-ci.org/echoes-tech/puppet-monit) [Flattr Button] (https://flattr.com/submit/auto?user_id=echoes&url=https://forge.puppetlabs.com/echoes/monit&title=Puppet%20module%20to%20manage%20Monit&description=This%20module%20installs%20and%20configures%20Monit.%20It%20allows%20you%20to%20enable%20HTTP%20Dashboard%20an%20to%20add%20check%20from%20a%20file.&lang=en_GB&category=software "Puppet module to manage Monit installation and configuration")

Table of Contents

  1. Overview
  2. Module Description - What the module does and why it is useful
  3. Setup - The basics of getting started with monit
  4. Usage - Configuration options and additional functionality
  5. Reference - An under-the-hood peek at what the module is doing and how
  6. Limitations - OS compatibility, etc.
  7. Development - Guide for contributing to the module
  8. Contributors

Overview

Puppet module to manage Monit installation and configuration.

Module Description

This module installs and configures Monit. It allows you to enable HTTP Dashboard an to add check from a file.

Setup

Setup Requirements

WARNING: For RedHat systems, you may need to add an additional repository like the EPEL repository. You can use the module stahnma-epel to do this.

Supports Puppet v3 (optionally with future parser) and v4 with Ruby versions 1.8.7 (Puppet v3 only), 1.9.3, 2.0.0 and 2.1.0.

Beginning with monit

include ::monit

Usage

Enable Monit Dashboard

class { 'monit':
  httpd          => true,
  httpd_address  => '172.16.0.3',
  httpd_password => 'CHANGE_ME',
}

Add a check

Using the source parameter:

monit::check { 'ntp':
  source => "puppet:///modules/${module_name}/ntp",
}

Or using the content parameter with a string:

monit::check { 'ntp':
  content => 'check process ntpd with pidfile /var/run/ntpd.pid
  start program = "/etc/init.d/ntpd start"
  stop  program = "/etc/init.d/ntpd stop"
  if failed host 127.0.0.1 port 123 type udp then alert
  if 5 restarts within 5 cycles then timeout
',
}

Or using the content parameter with a template:

monit::check { 'ntp':
  content => template("${module_name}/ntp.erb"),
}

Remove a check

monit::check { 'ntp':
  ensure => absent,
}

Reference

Classes

Public classes

  • monit: Main class, includes all other classes.

Private classes

  • monit::params: Sets parameter defaults per operating system.
  • monit::install: Handles the packages.
  • monit::config: Handles the configuration file.
  • monit::service: Handles the service.
  • monit::firewall: Handles the firewall configuration.

Parameters

The following parameters are available in the ::monit class:

alert_emails

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

check_interval

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

config_file

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

config_dir

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

config_dir_purge

Specifies if unmanaged files in the config directory should be purged. Valid options: 'true' or 'false'. Default value: 'false'

httpd

Specifies whether to enable the Monit Dashboard. Valid options: 'true' or 'false'. Default value: 'false'

httpd_port

Specifies the port of the Monit Dashboard. Valid options: numeric. Default value: 2812

httpd_address

Specifies the IP address of the Monit Dashboard. Valid options: string. Default value: 'locahost'

httpd_user

Specifies the user to access the Monit Dashboard. Valid options: string. Default value: 'admin'

httpd_password

Specifies the password to access the Monit Dashboard. Valid options: string. Default value: 'monit'

logfile

Specifies the logfile directive value. Valid options: string. Default value: '/var/log/monit.log'

It is possible to use syslog instead of direct file logging. (e.g. 'syslog facility log_daemon')

mailserver

If set to a string, alerts will be sent by email to this mailserver. Valid options: string. Default value: undef

For more details, see: https://mmonit.com/monit/documentation/monit.html#Setting-a-mail-server-for-alert-delivery

mailformat

Specifies the alert message format. Valid options: hash. Default value: undef

For more details, see: https://mmonit.com/monit/documentation/monit.html#Message-format

manage_firewall

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

mmonit_address Requires at least Monit 5.0

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. Valid options: string. Default value: undef

mmonit_port Requires at least Monit 5.0

Specifies the remote port of the M/Monit server. Valid options: numeric. Default value: 8080

mmonit_user Requires at least Monit 5.0

Specifies the user to connect to the remote M/Monit server. Valid options: string. Default value: 'monit'

If you set both user and password to an empty string, authentication is disabled.

mmonit_password Requires at least Monit 5.0

Specifies the password of the account used to connect to the remote M/Monit server. Valid options: string. Default value: 'monit'

If you set both user and password to an empty string, authentication is disabled.

mmonit_without_credential Requires at least Monit 5.0

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'. Valid options: 'true' or 'false'. Default value: 'false'

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

Tells Puppet what Monit package to manage. Valid options: string. Default value: 'monit'

service_ensure

Tells Puppet whether the Monit service should be running. Valid options: 'running' or 'stopped'. Default value: 'running'

service_manage

Tells Puppet whether to manage the Monit service. Valid options: 'true' or 'false'. Default value: 'true'

service_name

Tells Puppet what Monit service to manage. Valid options: string. Default value: 'monit'

start_delay Requires at least Monit 5.0

If set, Monit will wait the specified time in seconds before it starts checking services. Valid options: numeric. Default value: 0

Defines

Public defines

  • monit::check: Adds a Monit check.

Parameters

The following parameters are available in the ::monit::check define:

ensure

Tells Puppet whether the check should exist. Valid options: 'present', 'absent'. Default value: present

source

Tells Puppet what is the path of the configuration file. Valid options: string. Exclusive with the content parameter. Default value: undef

content

Specifies the content of the configuration file. Valid options: string. Exclusive with the source parameter. Default value: undef

package_name

Tells Puppet which Monit package is required. Valid options: string. Default value: 'monit'

service_name

Tells Puppet which Monit service will be notify. Valid options: string. Default value: 'monit'

Limitations

RedHat and Debian family OSes are officially supported. Tested and built on Debian and CentOS.

Development

Echoes Technologies modules on the Puppet Forge are open projects, and community contributions are essential for keeping them great.

Fork this module on GitHub

Contributors

The list of contributors can be found at: https://github.com/echoes-tech/puppet-monit/graphs/contributors

puppet-monit's People

Contributors

alexjurkiewicz avatar caprico85 avatar ehelms avatar ghoneycutt avatar hdeadman avatar mcanevet avatar phil-friderici avatar saimonn avatar salekseev avatar todd avatar tsaquet avatar wild5r avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

puppet-monit's Issues

Request for information

Hi,
I am reaching out on behalf of the approved modules team at puppet.
I was wondering if there were any upcoming releases, as there haven't been any 2 years. Another author has taken this module and progressed it further. https://forge.puppet.com/soli/monit. We would likely move the approved tag to them, if there will be no further development.

Looking forward to hearing from you, and thanks for the great module.

Cheers,
TP

new version for latest changes

Is it possible to release a new version of this module on puppet forge? I'm very keen on using the c0d9687 on our production systems.

and Thanks for a solid module!

add support for mmonit https addresses

Our mmonit uses https, looking at the template http is hardcoded, you could create a toggle for http/https but all the mmonit vars are only used in this one place might I suggest just using a $mmonit_connect_string instead of trying to assemble it, it makes the template more flexible and less error prone.

$mmonit_connect_string =>'https://foo:[email protected]:8083/collector',

set mmonit <%= @mmonit_connect_string %>

also having an additional config variable stuffed in the template would prove useful
$mmonit_extra_config => ['check process apache with pidfile /usr/local/apache/logs/httpd.pid', ' start program = "/etc/init.d/httpd start"'],

<% mmonit_extra_config.each do |line| %>
<%= line %>
<% end %>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.