Merge branch 'feature/compatlogger_object-7225' into develop

Merged from this PR: https://github.com/Icinga/puppet-icinga2/pull/54

refs# 7225: https://dev.icinga.org/issues/7225
This commit is contained in:
Nick Chappell 2014-11-21 21:04:06 -08:00
commit 429bbdd6bd
4 changed files with 96 additions and 1 deletions

View file

@ -1,6 +1,11 @@
#Changelog
- - -
###v0.6.1 (unreleased)
* Feature: [PR-54](https://github.com/Icinga/puppet-icinga2/pull/54) and [dev.icinga.org issue #7225](https://dev.icinga.org/issues/7225): Added a CompatLogger object defined type.
###v0.6.0 (November 19th, 2014)
* Added a defined type for `ServiceGroup` objects
@ -10,7 +15,7 @@
* Feature [#7264](https://dev.icinga.org/issues/7264): Added Debian 7 support
* Feature: Added the ability to use the Debmon repository on Debian 7 systems: [PR-17](https://github.com/Icinga/puppet-icinga2/pull/17)
* Feature: Added the ability to make NRPE accept command arguments; turned off by default for obvious security reasons: [PR-22](https://github.com/Icinga/puppet-icinga2/pull/22)
* Feature: Added the ability to enable/disable Icinga 2 components via parameters: [PR-23](https://github.com/Icinga/puppet-icinga2/pull/23)
* Feature: Added the ability to enable/disable Icinga 2 components via parameters: [PR-23](https://github.com/Icinga/puppet-icinga2/pull/23)
* Feature: Added a `GraphiteWriter` object defined type: [PR-24](https://github.com/Icinga/puppet-icinga2/pull/24)
* Feature: Added the ability to upload or create custom check plugins on an Icinga 2 server (as opposed to just for NRPE clients): [PR-27](https://github.com/Icinga/puppet-icinga2/pull/27)
* Bug [#7308](https://dev.icinga.org/issues/7308): Allow multiple `assign_where` and `ignore_where` conditions

View file

@ -365,6 +365,7 @@ Object types:
* [icinga2::object::applynotificationtohost](#icinga2objectapplynotificationtohost)
* [icinga2::object::applynotificationtoservice](#icinga2objectapplynotificationtoservice)
* [icinga2::object::checkcommand](#icinga2objectcheckcommand)
* [icinga2::object::compatlogger](#icinga2objectcompatlogger)
* [icinga2::object::eventcommand](#icinga2objecteventcommand)
* [icinga2::object::externalcommandlistener](#icinga2objectexternalcommandlistener)
* [icinga2::object::host](#icinga2objecthost)
@ -506,6 +507,20 @@ Available parameters are:
* `target_file_group`
* `target_file_mode`
####`icinga2::object::compatlogger`
The `compatlogger` defined type can create `compatlogger` objects.
<pre>
icinga2::object::compatlogger { 'daily-log':
log_dir => '/var/log/icinga2/compat',
rotation_method => 'DAILY'
}
</pre>
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::eventcommand`
The `eventcommand` defined type can create `eventcommand` objects.

View file

@ -0,0 +1,51 @@
# == Defined type: icinga2::object::compatlogger
#
# This is a defined type for Icinga 2 apply objects that create Compat Logger
# See the following Icinga 2 doc page for more info:
# http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/configuring-icinga2#objecttype-compatlogger
#
# === Parameters
#
# See the inline comments.
#
define icinga2::object::compatlogger (
$ensure = 'file',
$object_compatloggername = $name,
$log_dir = undef,
$rotation_method = undef,
$target_dir = '/etc/icinga2/objects/compatloggers',
$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_compatloggername {
validate_string($object_compatloggername)
}
if $log_dir {
validate_string($log_dir)
}
if $rotation_method {
validate_string($rotation_method)
}
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_compatlogger.conf.erb'),
notify => Service['icinga2'],
}
}

View file

@ -0,0 +1,24 @@
/**
* WARNING: This CompatLogger definition is automatically generated by Puppet.
* ANY MANUAL CHANGES TO IT WILL GET OVERWRITTEN!
*/
/**
* A CompatLogger 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 CompatLogger "<%= @object_compatloggername %>" {
<%#- If any of the @ parameters are undefined, don't print anything for them: -%>
<%- if @log_dir -%>
log_dir = "<%= @log_dir %>"
<%- end -%>
<%- if @rotation_method -%>
rotation_method = "<%= @rotation_method %>"
<%- end -%>
}