From 232d8bea753cc8631e93105c17a33083dc0082b6 Mon Sep 17 00:00:00 2001 From: Nick Chappell Date: Sat, 24 Jan 2015 21:11:45 -0800 Subject: [PATCH] Merged in from: https://github.com/Icinga/puppet-icinga2/pull/59 Squashed commit of the following: commit 3485ced372df47d22c5495f188746a767448b301 Merge: 9ddb696 cd0cd09 Author: Nick Chappell Date: Sat Jan 24 21:05:50 2015 -0800 Merge branch '7227' of https://github.com/cropalato/puppet-icinga2 into cropalato-7227 commit cd0cd09733c0881e62b57cef871fa7898e47c186 Author: Ricardo Melo Date: Tue Dec 2 15:09:49 2014 -0500 * fixed default parameter value commit 1a01e8f68dd8ac2f6bbf8ffa040673d97bec9280 Author: ricardo@cropalato.com.br Date: Tue Nov 25 18:01:18 2014 -0500 * fixed typo. commit e23aafc87877617ee1faba1b9d4b4c595d84ae8e Author: ricardo@cropalato.com.br Date: Tue Nov 25 17:44:58 2014 -0500 Adding CheckerComponent Object. #7227 --- README.md | 22 +++++++++++++ manifests/object/checkercomponent.pp | 36 ++++++++++++++++++++++ templates/object_checkercomponent.conf.erb | 15 +++++++++ 3 files changed, 73 insertions(+) create mode 100644 manifests/object/checkercomponent.pp create mode 100644 templates/object_checkercomponent.conf.erb diff --git a/README.md b/README.md index 64cc4a9..8b152c9 100644 --- a/README.md +++ b/README.md @@ -424,6 +424,7 @@ Object types: * [icinga2::object::applynotificationtoservice](#icinga2objectapplynotificationtoservice) * [icinga2::object::checkcommand](#icinga2objectcheckcommand) * [icinga2::object::compatlogger](#icinga2objectcompatlogger) +* [icinga2::object::checkercomponent](#icinga2objectcheckercomponent) * [icinga2::object::checkresultreader](#icinga2objectcheckresultreader) * [icinga2::object::endpoint](#icinga2objectendpoint) * [icinga2::object::eventcommand](#icinga2objecteventcommand) @@ -600,6 +601,27 @@ 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::checkercomponent`](id:object_checkercomponent) + +The `checkercomponent` defined type can create `checkercomponent` objects. + +Example: + +
+icinga2::object::checkercomponent {'checker':}
+
+ +This object support the following parameters: +* `ensure` - Optional parameter used to remove or create the file, Default value is 'file'. Use 'absent' to remove the file. +* `object_name` - Optional. Used to define file name. default value is 'checker' +* `target_dir` - Optional. Define where the conf fil will be created. Default value is '/etc/icinga2/conf.d' +* `target_file_name` - Optional. Define the file name. Default value is '${object_name}.conf'. +* `target_file_owner` - Optional. File Owner. Default value is 'root'. +* `target_file_group` - Optional. File Group. Default value is 'root'. +* `target_file_mode` - Optional. File Mode. Default value is '0644'. + +See [CheckerComponent](http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/configuring-icinga2#objecttype-checkercomponent) on [docs.icinga.org](http://docs.icinga.org/icinga2/latest/doc/module/icinga2/toc) for more details about this object. + ####[`icinga2::object::checkresultreader`](id:object_checkresultreader) The `checkresultreader` defined type can create `checkresultreader` objects. diff --git a/manifests/object/checkercomponent.pp b/manifests/object/checkercomponent.pp new file mode 100644 index 0000000..196adce --- /dev/null +++ b/manifests/object/checkercomponent.pp @@ -0,0 +1,36 @@ +# == Defined type: icinga2::object::checkercomponent +# +# This is a defined type for Icinga 2 apply objects that create Checker Component +# See the following Icinga 2 doc page for more info: +# http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/configuring-icinga2#objecttype-checkercomponent +# +# === Parameters +# +# See the inline comments. +# + +define icinga2::object::checkercomponent ( + $ensure = 'file', + $object_name = $name, + $target_dir = '/etc/icinga2/conf.d', + $target_file_name = "${name}.conf", + $target_file_owner = 'root', + $target_file_group = 'root', + $target_file_mode = '0644' +) { + + 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_checkercomponent.conf.erb'), +# notify => Service['icinga2'], # Dont need to reload/restart the service only enable/disable the feature. Should we force enable/disable the feature (icinga2 feature enable checker) or should the user define it? + } +} diff --git a/templates/object_checkercomponent.conf.erb b/templates/object_checkercomponent.conf.erb new file mode 100644 index 0000000..af40bf4 --- /dev/null +++ b/templates/object_checkercomponent.conf.erb @@ -0,0 +1,15 @@ +/** +* WARNING: This CheckerComponent is automatically generated by Puppet. +* ANY MANUAL CHANGES TO IT WILL GET OVERWRITTEN! +*/ + +/** +* A CheckerComponent 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 "checker" + +object CheckerComponent "<%= @object_name %>" { }