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 %>" { }