Merge branch '7226' of github.com:cropalato/puppet-icinga2 into feature/checkresultreader_object-7226

Adds a CheckResultReader object

Merged from: https://github.com/Icinga/puppet-icinga2/pull/55

refs# 7226: https://dev.icinga.org/issues/7226
This commit is contained in:
Nick Chappell 2014-11-21 21:12:54 -08:00
commit c10da22594
3 changed files with 82 additions and 0 deletions

View file

@ -366,6 +366,7 @@ Object types:
* [icinga2::object::applynotificationtoservice](#icinga2objectapplynotificationtoservice)
* [icinga2::object::checkcommand](#icinga2objectcheckcommand)
* [icinga2::object::compatlogger](#icinga2objectcompatlogger)
* [icinga2::object::checkresultreader](#icinga2objectcheckresultreader)
* [icinga2::object::eventcommand](#icinga2objecteventcommand)
* [icinga2::object::externalcommandlistener](#icinga2objectexternalcommandlistener)
* [icinga2::object::host](#icinga2objecthost)
@ -521,6 +522,20 @@ icinga2::object::compatlogger { 'daily-log':
Both patameters as optionals. The parameter `rotation_method` can one of `HOURLY`, `DAILY`, `WEEKLY` or `MONTHY`.
See [CompatLogger](http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/configuring-icinga2#objecttype-compatlogger) on [docs.icinga.org](http://docs.icinga.org/icinga2/latest/doc/module/icinga2/toc) for a full list of parameters.
####[`icinga2::object::checkresultreader`](id:object_checkresultreader)
The `checkresultreader` defined type can create `checkresultreader` objects.
Example:
<pre>
icinga2::object::checkresultreader {'reader':
spool_dir => '/data/check-results'
}
</pre>
See [CheckResultReader](http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/configuring-icinga2#objecttype-checkresultreader) on [docs.icinga.org](http://docs.icinga.org/icinga2/latest/doc/module/icinga2/toc) for a full list of parameters.
####`icinga2::object::eventcommand`
The `eventcommand` defined type can create `eventcommand` objects.

View file

@ -0,0 +1,47 @@
# == Defined type: icinga2::object::checkresultreader
#
# This is a defined type for Icinga 2 apply objects that create Check Result Reader
# See the following Icinga 2 doc page for more info:
# http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/configuring-icinga2#objecttype-checkresultreader
#
# === Parameters
#
# See the inline comments.
#
define icinga2::object::checkresultreader (
$ensure = 'file',
$object_checkresultreadername = $name,
$spool_dir = undef,
$target_dir = '/etc/icinga2/objects/checkresultreaders',
$target_file_name = "${name}.conf",
$target_file_ensure = file,
$target_file_owner = 'root',
$target_file_group = 'root',
$target_file_mode = '0644'
) {
#Do some validation of the class' parameters:
if $object_checkresultreadername {
validate_string($object_checkresultreadername)
}
if $spool_dir {
validate_string($spool_dir)
}
validate_string($target_dir)
validate_string($target_file_name)
validate_string($target_file_owner)
validate_string($target_file_group)
validate_re($target_file_mode, '^\d{4}$')
file {"${target_dir}/${target_file_name}":
ensure => $target_file_ensure,
owner => $target_file_owner,
group => $target_file_group,
mode => $target_file_mode,
content => template('icinga2/object_checkresultreader.conf.erb'),
notify => Service['icinga2'],
}
}

View file

@ -0,0 +1,20 @@
/**
* WARNING: This CheckResultReader definition is automatically generated by Puppet.
* ANY MANUAL CHANGES TO IT WILL GET OVERWRITTEN!
*/
/**
* A CheckResultReader definition. You can create your own configuration files
* in the conf.d directory (e.g. one per commnand). By default all *.conf
* files in this directory are included.
*
*/
library "compat"
object CheckResultReader "<%= @object_checkresultreadername %>" {
<%#- If any of the @ parameters are undefined, don't print anything for them: -%>
<%- if @spool_dir -%>
spool_dir = "<%= @spool_dir %>"
<%- end -%>
}