Skip to content

Commit

Permalink
Merge pull request #8 from himpich/master
Browse files Browse the repository at this point in the history
Support hiera_hash for custom checks
  • Loading branch information
jonhattan committed Aug 31, 2015
2 parents 92548ae + bf3661d commit ff6b3a9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ In addition to Monit configuration options, this class accepts other parameters:

* `checks`, useful to pass in Monit checks declared in Hiera.

If your hiera setup supports a hierarchy structure, you can set
'monit::hiera_merge_strategy' to 'hiera_hash' in order use the hiera_hash function for
config merging.

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.
Expand Down
11 changes: 8 additions & 3 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,13 @@
}

# Additional checks.
validate_hash($monit::checks)
create_resources('monit::check', $monit::checks)

if ($monit::hiera_merge_strategy == 'hiera_hash') {
$mychecks = hiera_hash('monit::checks', {})
}
else {
$mychecks = $monit::checks
}
validate_hash($mychecks)
create_resources('monit::check', $mychecks)
}

2 changes: 2 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
$system_fs_inode_usage = '80%',
# Additional checks.
$checks = {},
# set to hiera_hash in order to merge your hierarchy
$hiera_merge_strategy = undef,
) inherits monit::params {

class{'monit::install': } ->
Expand Down

0 comments on commit ff6b3a9

Please sign in to comment.