Merge branch '7224' of github.com:cropalato/puppet-icinga2 into cropalato-7224
This commit is contained in:
commit
e1f961b474
3 changed files with 80 additions and 0 deletions
13
README.md
13
README.md
|
@ -359,6 +359,7 @@ Object types:
|
|||
* [icinga2::object::applynotificationtoservice](#icinga2objectapplynotificationtoservice)
|
||||
* [icinga2::object::checkcommand](#icinga2objectcheckcommand)
|
||||
* [icinga2::object::eventcommand](#icinga2objecteventcommand)
|
||||
* [icinga2::object::externalcommandlistener](#icinga2objectexternalcommandlistener)
|
||||
* [icinga2::object::host](#icinga2objecthost)
|
||||
* [icinga2::object::hostgroup](#icinga2objecthostgroup)
|
||||
* [icinga2::object::idomysqlconnection](#icinga2objectidomysqlconnection)
|
||||
|
@ -510,6 +511,18 @@ icinga2::object::eventcommand { 'restart-httpd-event':
|
|||
|
||||
This object use the same parameter defined to `checkcommand`.
|
||||
|
||||
####`icinga2::object::externalcommandlistener`
|
||||
|
||||
The `externalcommandlistener` defined type can create `ExternalCommandListener` objects.
|
||||
|
||||
<pre>
|
||||
icinga2::object::externalcommandlistener { 'external':
|
||||
command_path => '/var/run/icinga2/cmd/icinga2.cmd'
|
||||
}
|
||||
</pre>
|
||||
|
||||
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::host`](id:object_host)
|
||||
|
||||
This defined type creates host objects.
|
||||
|
|
46
manifests/object/externalcommandlistener.pp
Normal file
46
manifests/object/externalcommandlistener.pp
Normal file
|
@ -0,0 +1,46 @@
|
|||
# == Defined type: icinga2::object::externalcommandlistener
|
||||
#
|
||||
# This is a defined type for Icinga 2 apply objects that create ExternalCommand Listener
|
||||
# See the following Icinga 2 doc page for more info:
|
||||
# http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/configuring-icinga2#objecttype-externalcommandlistener
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# See the inline comments.
|
||||
#
|
||||
|
||||
define icinga2::object::externalcommandlistener (
|
||||
$ensure = 'file',
|
||||
$object_externalcommandlisternername = $name,
|
||||
$command_path = undef,
|
||||
$target_dir = '/etc/icinga2/objects/externalcommandlisteners',
|
||||
$target_file_name = "${name}.conf",
|
||||
$target_file_owner = 'root',
|
||||
$target_file_group = 'root',
|
||||
$target_file_mode = '0644'
|
||||
) {
|
||||
|
||||
#Do some validation of the class' parameters:
|
||||
if $object_externalcommandlisternername {
|
||||
validate_string($object_externalcommandlisternername)
|
||||
}
|
||||
if $command_path {
|
||||
validate_string($command_path)
|
||||
}
|
||||
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_externalcommandlistener.conf.erb'),
|
||||
notify => Service['icinga2'],
|
||||
}
|
||||
|
||||
}
|
21
templates/object_externalcommandlistener.conf.erb
Normal file
21
templates/object_externalcommandlistener.conf.erb
Normal file
|
@ -0,0 +1,21 @@
|
|||
/**
|
||||
* WARNING: This ExternalCommandListener definition is automatically generated by Puppet.
|
||||
* ANY MANUAL CHANGES TO IT WILL GET OVERWRITTEN!
|
||||
*/
|
||||
|
||||
/**
|
||||
* A ExternalCommandListener 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 ExternalCommandListener "<%= @object_externalcommandlistenername %>" {
|
||||
<%#- If any of the @ parameters are undefined, don't print anything for them: -%>
|
||||
|
||||
<%- if @command_path -%>
|
||||
command_path = "<%= @command_path -%>"
|
||||
<%- end -%>
|
||||
}
|
Loading…
Reference in a new issue