Merge branch 'cropalato-7222'
This commit is contained in:
commit
3493c739d0
3 changed files with 111 additions and 1 deletions
17
README.md
17
README.md
|
@ -364,6 +364,7 @@ Object types:
|
|||
* [icinga2::object::hostgroup](#icinga2objecthostgroup)
|
||||
* [icinga2::object::idomysqlconnection](#icinga2objectidomysqlconnection)
|
||||
* [icinga2::object::idopgsqlconnection](#icinga2objectidopgsqlconnection)
|
||||
* [icinga2::object::livestatuslistener](#icinga2objectlivestatuslistener)
|
||||
* [icinga2::object::notification](#icinga2objectnotification)
|
||||
* [icinga2::object::notificationcommand](#icinga2objectnotificationcommand)
|
||||
* [icinga2::object::perfdatawriter](#icinga2objectperfdatawriter)
|
||||
|
@ -633,6 +634,21 @@ This defined type supports all of the parameters that **IdoMySqlConnection** obj
|
|||
|
||||
See [IdoPgSqlConnection](http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/configuring-icinga2#objecttype-idopgsqlconnection) on [docs.icinga.org](http://docs.icinga.org/icinga2/latest/doc/module/icinga2/toc) for a full list of parameters.
|
||||
|
||||
####[`icinga2::object::livestatuslistener`](id:object_livestatuslistener)
|
||||
|
||||
This defined type creates a **LivestatusListener** objects.
|
||||
|
||||
Example usage:
|
||||
|
||||
<pre>
|
||||
icinga2::object::livestatuslistener { 'livestatus-unix':
|
||||
socket_type => 'unix',
|
||||
socket_path => '/var/run/icinga2/cmd/livestatus'
|
||||
}
|
||||
</pre>
|
||||
|
||||
See [LivestatusListener](http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/configuring-icinga2#objecttype-livestatuslistener) on [docs.icinga.org](http://docs.icinga.org/icinga2/latest/doc/module/icinga2/toc) for a full list of parameters.
|
||||
|
||||
####`icinga2::object::notification`
|
||||
|
||||
The `notification` defined type can create `notification` objects.
|
||||
|
@ -697,7 +713,6 @@ icinga2::object::notificationcommand { 'mail-service-notification':
|
|||
'USEREMAIL' => '"$user.email$"'
|
||||
}
|
||||
}
|
||||
|
||||
</pre>
|
||||
|
||||
This object use the same parameter defined to `checkcommand`.
|
||||
|
|
62
manifests/object/livestatuslistener.pp
Normal file
62
manifests/object/livestatuslistener.pp
Normal file
|
@ -0,0 +1,62 @@
|
|||
# == Defined type: icinga2::object::livestatuslistener
|
||||
#
|
||||
# This is a defined type for Icinga 2 apply objects that create Livestatus Listener
|
||||
# See the following Icinga 2 doc page for more info:
|
||||
# http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/configuring-icinga2#objecttype-livestatuslistener
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# See the inline comments.
|
||||
#
|
||||
|
||||
define icinga2::object::livestatuslistener (
|
||||
$ensure = 'file',
|
||||
$object_livestatuslisternername = $name,
|
||||
$socket_type = undef,
|
||||
$bind_host = undef,
|
||||
$bind_port = undef,
|
||||
$socket_path = undef,
|
||||
$compat_log_path = undef,
|
||||
$target_dir = '/etc/icinga2/objects/livestatuslisteners',
|
||||
$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_livestatuslisternername {
|
||||
validate_string($object_livestatuslisternername)
|
||||
}
|
||||
if $socket_type {
|
||||
validate_string($socket_type)
|
||||
}
|
||||
if $bind_host {
|
||||
validate_string($bind_host)
|
||||
}
|
||||
if $bind_port {
|
||||
validate_string($bind_port)
|
||||
}
|
||||
if $socket_path {
|
||||
validate_string($socket_path)
|
||||
}
|
||||
if $compat_log_path {
|
||||
validate_string($compat_log_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_livestatuslistener.conf.erb'),
|
||||
notify => Service['icinga2'],
|
||||
}
|
||||
|
||||
}
|
33
templates/object_livestatuslistener.conf.erb
Normal file
33
templates/object_livestatuslistener.conf.erb
Normal file
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
* WARNING: This LivestatusListener definition is automatically generated by Puppet.
|
||||
* ANY MANUAL CHANGES TO IT WILL GET OVERWRITTEN!
|
||||
*/
|
||||
|
||||
/**
|
||||
* A LivestatusListener 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 "livestatus"
|
||||
|
||||
object LivestatusListener "<%= @object_livestatuslistenername %>" {
|
||||
<%#- If any of the @ parameters are undefined, don't print anything for them: -%>
|
||||
|
||||
<%- if @socket_type -%>
|
||||
socket_type = "<%= @socket_type -%>"
|
||||
<%- end -%>
|
||||
<%- if @bind_host -%>
|
||||
bind_host = "<%= @bind_host -%>"
|
||||
<%- end -%>
|
||||
<%- if @bind_port -%>
|
||||
bind_port = "<%= @bind_port -%>"
|
||||
<%- end -%>
|
||||
<%- if @socket_path -%>
|
||||
socket_path = "<%= @socket_path -%>"
|
||||
<%- end -%>
|
||||
<%- if @compat_log_path -%>
|
||||
compat_log_path = "<%= @compat_log_path -%>"
|
||||
<%- end -%>
|
||||
}
|
Loading…
Reference in a new issue