Merge branch 'feature/pr-62-icingastatuswriter-object' into develop

Merged from: https://github.com/Icinga/puppet-icinga2/pull/62

refs#7232: https://dev.icinga.org/issues/7230
This commit is contained in:
Nick Chappell 2015-01-04 15:46:13 -08:00
commit bd8942fd3a
3 changed files with 79 additions and 0 deletions

View file

@ -403,6 +403,7 @@ Object types:
* [icinga2::object::externalcommandlistener](#icinga2objectexternalcommandlistener)
* [icinga2::object::host](#icinga2objecthost)
* [icinga2::object::hostgroup](#icinga2objecthostgroup)
* [icinga2::object::icingastatuswriter](#icinga2objecticingastatuswriter)
* [icinga2::object::idomysqlconnection](#icinga2objectidomysqlconnection)
* [icinga2::object::idopgsqlconnection](#icinga2objectidopgsqlconnection)
* [icinga2::object::livestatuslistener](#icinga2objectlivestatuslistener)
@ -649,6 +650,20 @@ If you would like to use an IPv6 address, make sure to set the `ipv6_address` pa
Coming soon...
####[`icinga2::object::icingastatuswriter`](id:object_icingastatuswriter)
This defined type creates an **IcingaStatusWriter** objects.
Example usage:
<pre>
icinga2::object::icingastatuswriter { 'status':
status_path => '/cache/icinga2/status.json',
update_interval => '15s',
}
</pre>
See [IcingaStatusWriter](http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/configuring-icinga2#objecttype-icingastatuswriter) on [docs.icinga.org](http://docs.icinga.org/icinga2/latest/doc/module/icinga2/toc) for more details about the object.
####[`icinga2::object::idomysqlconnection`](id:object_idomysqlconnection)
This defined type creates an **IdoMySqlConnection** objects.

View file

@ -0,0 +1,44 @@
# == Defined type: icinga2::object::icingastatuswriter
#
# This is a defined type for Icinga 2 apply objects that create IcingaStatusWriter
# 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::icingastatuswriter (
$ensure = 'file',
$object_name = $name,
$status_path = undef,
$update_interval = undef,
$target_dir = '/etc/icinga2/objects/icingastatuswriters',
$target_file_name = "${name}.conf",
$target_file_owner = 'root',
$target_file_group = 'root',
$target_file_mode = '0644'
) {
if $status_path {
validate_string($status_path)
}
if $update_interval {
validate_string($update_interval)
}
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_icingastatuswriter.conf.erb'),
notify => Service['icinga2'],
}
}

View file

@ -0,0 +1,20 @@
/**
* WARNING: This IcingaStatusWriter is automatically generated by Puppet.
* ANY MANUAL CHANGES TO IT WILL GET OVERWRITTEN!
*/
/**
* A IcingaStatusWriter 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.
*
*/
object IcingaStatusWriter "<%= @object_name %>" {
<%- if @status_path -%>
status_path = LocalStateDir + "<%= @status_path -%>"
<%- end -%>
<%- if @update_interval -%>
update_interval = <%= @update_interval -%>
<%- end -%>
}