Merge branch '7229' of https://github.com/cropalato/puppet-icinga2 into feature/pr-61-filelogger-object

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

refs#7229: https://dev.icinga.org/issues/7229
This commit is contained in:
Nick Chappell 2015-01-04 15:51:12 -08:00
commit 363d0205f5
3 changed files with 79 additions and 0 deletions

View file

@ -401,6 +401,7 @@ Object types:
* [icinga2::object::endpoint](#icinga2objectendpoint)
* [icinga2::object::eventcommand](#icinga2objecteventcommand)
* [icinga2::object::externalcommandlistener](#icinga2objectexternalcommandlistener)
* [icinga2::object::filelogger](#icinga2objectfilelogger)
* [icinga2::object::host](#icinga2objecthost)
* [icinga2::object::hostgroup](#icinga2objecthostgroup)
* [icinga2::object::icingastatuswriter](#icinga2objecticingastatuswriter)
@ -608,6 +609,21 @@ icinga2::object::externalcommandlistener { 'external':
See [ExternalCommandListener](http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/configuring-icinga2#objecttype-externalcommandlistener) on [docs.icinga.org](http://docs.icinga.org/icinga2/latest/doc/module/icinga2/toc) for a full list of parameters.
####[`icinga2::object::filelogger`](id:object_filelogger)
This defined type creates file logger objects.
Example:
<pre>
icinga2::object::filelogger { 'debug-file':
severity => 'debug',
path => '/var/log/icinga2/debug.log',
}
</pre>
See [FileLogger](http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/configuring-icinga2#objecttype-filelogger) on [docs.icinga.org](http://docs.icinga.org/icinga2/latest/doc/module/icinga2/toc) for a full list of parameters.
####[`icinga2::object::host`](id:object_host)
This defined type creates host objects.

View file

@ -0,0 +1,45 @@
# == Defined type: icinga2::object::filelogger
#
# This is a defined type for Icinga 2 apply objects that create File Logger
# See the following Icinga 2 doc page for more info:
# http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/configuring-icinga2#objecttype-filelogger
#
# === Parameters
#
# See the inline comments.
#
define icinga2::object::filelogger (
$ensure = 'file',
$object_name = $name,
$path = undef,
$severity = undef,
$target_dir = '/etc/icinga2/conf.d',
$target_file_name = "${name}.conf",
$target_file_owner = 'root',
$target_file_group = 'root',
$target_file_mode = '0644'
) {
if $object_name {
validate_string($object_name)
}
validate_string($path)
if $severity {
validate_string($severity)
}
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 => $ensure,
owner => $target_file_owner,
group => $target_file_group,
mode => $target_file_mode,
content => template('icinga2/object_filelogger.conf.erb'),
notify => Service['icinga2']
}
}

View file

@ -0,0 +1,18 @@
/**
* WARNING: This FileLogger is automatically generated by Puppet.
* ANY MANUAL CHANGES TO IT WILL GET OVERWRITTEN!
*/
/**
* A FileLogger 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.
*
*/
object FileLogger "<%= @object_name %>" {
<%- if @severity -%>
severity = "<%= severity -%>"
<%- end -%>
path = "<%= @path -%>"
}