Installs and configures Monit, with a resource provider for managing additional monit checks.
Suggested background reading:
- The Fine Manual
- This README, the resource and provider in cookbook libraries directory.
monit-ng::default
: loads the other recipes in the order belowmonit-ng::install
: installs monit via package or sourcemonit-ng::configure
: configures global monit templatemonit-ng::service
: configures and manages the monit servicemonit-ng::reload
: reloads monit service if converge updated a monit_check
- yum-epel (on rhel hosts)
- ubuntu (on ubuntu hosts)
- apt (on debian hosts)
- build-essential (if installing from source)
Most of these are very straight-forward, and pulled directly from the manual. See the inline documentation in attributes/*.rb for details.
The few "special" attributes are noted below:
default['monit']['config']['alert']
(default:[]
): this attributes configures globalset alert
config option for eachHash
element with attributename
and optional event filters
Documentation for event filters can be found here.
"default_attributes": {
"monit": {
"config": {
"alert": [
{
"name": "root@localhost",
"but_not_on": [ "nonexist" ]
},
{
"name": "netadmin@localhost",
"only_on": [ "nonexist", "timeout", "icmp", "connection"]
},
{
"name": "iwantall@localhost",
}
]
}
}
}
default['monit']['config']['mail_servers']
(default:[]
): this attributes configuresset mailserver
config option for eachHash
element (mail server) with hash like so:
"default_attributes": {
"monit": {
"config": {
"mail_servers": [
{
"hostname": "localhost",
"port": 25,
"username": null,
"password": null,
"security": null,
"timeout": "30 seconds"
}
]
}
}
}
default['monit']['config']['built_in_configs']
(default:[]
): this defines what built-in configuration files will be included
"default_attributes": {
"monit": {
"config": {
"built_in_configs": [
"memcached",
"nginx"
]
}
}
}
Attribute | Description | Default |
---|---|---|
cookbook | cookbook from which to source monit config template | monit-ng |
check_type | type of check (e.g. program, process, host) | process |
check_id | check identifier (e.g. pid path, hostname, executable path | nil |
id_type | type of identifier (e.g. pid, matching, address, path) | determined by check_type |
start_as | user to execute start command as | nil |
start_as_group | group to start program as | nil |
start | start command | nil |
stop_as | user to execute stop command as | nil |
stop_as_group | group to execute stop command as | nil |
stop | stop command | nil |
group | check group (e.g. "hosts") | nil |
depends | depends on named service (e.g. "apache") | nil |
tests | array of hashes with 'condition', 'action' keys, maps to monit if, then | [] |
every | string for args to "every" configuration (e.g. every n cycles, every "* 8-19 * * 1-5") | nil |
alert | email to alert | nil |
but_not_on | alert modifier to filter events for notification | nil |
alert_events | alert modifier to filter events for notification | nil |
- Fork the repository on Github
- Create a named feature branch (like
add_component_x
) - Write your change
- Write tests for your change (if applicable)
- Run the tests (
rake
), ensuring they all pass - Write new resource/attribute description to
README.md
- Write description about changes to PR
- Submit a Pull Request using Github
Authors:: Nathan Williams and contributors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.