Adding StatusDataWriter object. #7223
This commit is contained in:
parent
31f467babd
commit
9494c55bb7
3 changed files with 98 additions and 0 deletions
17
README.md
17
README.md
|
@ -367,6 +367,7 @@ Object types:
|
||||||
* [icinga2::object::perfdatawriter](#icinga2objectperfdatawriter)
|
* [icinga2::object::perfdatawriter](#icinga2objectperfdatawriter)
|
||||||
* [icinga2::object::service](#icinga2objectservice)
|
* [icinga2::object::service](#icinga2objectservice)
|
||||||
* [icinga2::object::servicegroup](#icinga2objectservicegroup)
|
* [icinga2::object::servicegroup](#icinga2objectservicegroup)
|
||||||
|
* [icinga2::object::statusdatawriter](#icinga2objectstatusdatawriter)
|
||||||
* [icinga2::object::syslogger](#icinga2objectsyslogger)
|
* [icinga2::object::syslogger](#icinga2objectsyslogger)
|
||||||
* [icinga2::object::timeperiod](#icinga2objecttimeperiod)
|
* [icinga2::object::timeperiod](#icinga2objecttimeperiod)
|
||||||
* [icinga2::object::user](#icinga2objectuser)
|
* [icinga2::object::user](#icinga2objectuser)
|
||||||
|
@ -706,6 +707,22 @@ icinga2::object::servicegroup { 'web_services':
|
||||||
|
|
||||||
See [ServiceGroup](http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/configuring-icinga2#objecttype-servicegroup) on [docs.icinga.org](http://docs.icinga.org/icinga2/latest/doc/module/icinga2/toc) for a full list of parameters.
|
See [ServiceGroup](http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/configuring-icinga2#objecttype-servicegroup) on [docs.icinga.org](http://docs.icinga.org/icinga2/latest/doc/module/icinga2/toc) for a full list of parameters.
|
||||||
|
|
||||||
|
####[`icinga2::object::statusdatawriter`](id:object_statusdatawriter)
|
||||||
|
|
||||||
|
This defined type creates **StatusDataWriter** objects.
|
||||||
|
|
||||||
|
Example usage:
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
icinga2::object::statusdatawriter { 'status':
|
||||||
|
status_path => '/var/cache/icinga2/status.dat',
|
||||||
|
objects_path => '/var/cache/icinga2/objects.path',
|
||||||
|
update_interval => 30s
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
See [StatusDataWriter](http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/configuring-icinga2#objecttype-statusdatawriter) on [docs.icinga.org](http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/configuring-icinga2#objecttype-sysloglogger) for more info.
|
||||||
|
|
||||||
####[`icinga2::object::sysloglogger`](id:object_syslogger)
|
####[`icinga2::object::sysloglogger`](id:object_syslogger)
|
||||||
|
|
||||||
This defined type creates **SyslogLogger** objects.
|
This defined type creates **SyslogLogger** objects.
|
||||||
|
|
54
manifests/object/statusdatawriter.pp
Normal file
54
manifests/object/statusdatawriter.pp
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
# == Defined type: icinga2::object::statusdatawriter
|
||||||
|
#
|
||||||
|
# This is a defined type for Icinga 2 apply objects that create StatusDataWriter
|
||||||
|
# See the following Icinga 2 doc page for more info:
|
||||||
|
# http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/configuring-icinga2#objecttype-statusdatawriter
|
||||||
|
#
|
||||||
|
# === Parameters
|
||||||
|
#
|
||||||
|
# See the inline comments.
|
||||||
|
#
|
||||||
|
|
||||||
|
define icinga2::object::statusdatawriter (
|
||||||
|
$ensure = 'file',
|
||||||
|
$object_statusdatawritername = $name,
|
||||||
|
$status_path = undef,
|
||||||
|
$object_path = undef,
|
||||||
|
$update_interval = undef,
|
||||||
|
$target_dir = '/etc/icinga2/objects/statusdatawriters',
|
||||||
|
$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_statusdatawritername {
|
||||||
|
validate_string($object_statusdatawritername)
|
||||||
|
}
|
||||||
|
if $status_path {
|
||||||
|
validate_string($status_path)
|
||||||
|
}
|
||||||
|
if $object_path {
|
||||||
|
validate_string($object_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_statusdatawriter.conf.erb'),
|
||||||
|
notify => Service['icinga2'],
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
27
templates/object_statusdatawriter.conf.erb
Normal file
27
templates/object_statusdatawriter.conf.erb
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
/**
|
||||||
|
* WARNING: This StatusDataWriter definition is automatically generated by Puppet.
|
||||||
|
* ANY MANUAL CHANGES TO IT WILL GET OVERWRITTEN!
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A StatusDataWriter 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 StatusDataWriter "<%= @object_statusdatawritername %>" {
|
||||||
|
<%#- If any of the @ parameters are undefined, don't print anything for them: -%>
|
||||||
|
|
||||||
|
<%- if @status_path -%>
|
||||||
|
status_path = "<%= @status_path -%>"
|
||||||
|
<%- end -%>
|
||||||
|
<%- if @objects_path -%>
|
||||||
|
objects_path = "<%= @objects_path -%>"
|
||||||
|
<%- end -%>
|
||||||
|
<%- if @update_interval -%>
|
||||||
|
update_interval = <%= @update_interval -%>
|
||||||
|
<%- end -%>
|
||||||
|
}
|
Loading…
Reference in a new issue