Fixed merge conflicts in README.
This commit is contained in:
commit
4f2b4370c6
3 changed files with 110 additions and 2 deletions
20
README.md
20
README.md
|
@ -365,6 +365,7 @@ Object types:
|
|||
* [icinga2::object::notification](#icinga2objectnotification)
|
||||
* [icinga2::object::notificationcommand](#icinga2objectnotificationcommand)
|
||||
* [icinga2::object::perfdatawriter](#icinga2objectperfdatawriter)
|
||||
* [icinga2::object::scheduleddowntime](#icinga2objectscheduleddowntime)
|
||||
* [icinga2::object::service](#icinga2objectservice)
|
||||
* [icinga2::object::servicegroup](#icinga2objectservicegroup)
|
||||
* [icinga2::object::syslogger](#icinga2objectsyslogger)
|
||||
|
@ -671,8 +672,7 @@ This object use the same parameter defined to `checkcommand`.
|
|||
|
||||
####[`icinga2::object::perfdatawriter`](id:object_perfdatawriter)
|
||||
|
||||
This dfined type creates a **PerfdataWriter** object
|
||||
|
||||
This defined type creates a **PerfdataWriter** object
|
||||
Example usage:
|
||||
|
||||
<pre>
|
||||
|
@ -687,6 +687,22 @@ icinga2::object::perfdatawriter { 'pnp':
|
|||
|
||||
See [PerfdataWriter](http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/configuring-icinga2#objecttype-perfdatawriter) on [docs.icinga.org](http://docs.icinga.org/icinga2/latest/doc/module/icinga2/toc) for a full list of parameters.
|
||||
|
||||
####[`icinga2::object::scheduleddowntime`](id:object_scheduleddowntime)
|
||||
|
||||
This defined type creates **ScheduledDowntime** objects
|
||||
|
||||
<pre>
|
||||
icinga2::object::scheduleddowntime {'some-downtime':
|
||||
host_name => 'localhost',
|
||||
service_name => 'ping4',
|
||||
author => 'icingaadmin',
|
||||
comment => 'Some comment',
|
||||
fixed => false,
|
||||
duration => '30m',
|
||||
ranges => { 'sunday' => '02:00-03:00' }
|
||||
}
|
||||
</pre>
|
||||
|
||||
####[`icinga2::object::service`](id:object_service)
|
||||
|
||||
Coming soon...
|
||||
|
|
54
manifests/object/scheduleddowntime.pp
Normal file
54
manifests/object/scheduleddowntime.pp
Normal file
|
@ -0,0 +1,54 @@
|
|||
# == Defined type: icinga2::object::scheduleddowntime
|
||||
#
|
||||
# This is a defined type for Icinga 2 ScheduledDowntime objects.
|
||||
# See the following Icinga 2 doc page for more info:
|
||||
# http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/configuring-icinga2#objecttype-scheduleddowntime
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# See the inline comments.
|
||||
#
|
||||
|
||||
define icinga2::object::scheduleddowntime (
|
||||
$object_scheduleddowntimename = $name,
|
||||
$host_name = undef,
|
||||
$service_name = undef,
|
||||
$author = undef,
|
||||
$comment = undef,
|
||||
$fixed = true,
|
||||
$duration = undef,
|
||||
$ranges = {},
|
||||
$target_dir = '/etc/icinga2/objects/scheduleddowntimes',
|
||||
$target_file_name = "${name}.conf",
|
||||
$target_file_owner = 'root',
|
||||
$target_file_group = 'root',
|
||||
$target_file_mode = '0644'
|
||||
) {
|
||||
|
||||
#Do some validation of the define's parameters:
|
||||
validate_string($object_scheduleddowntimename)
|
||||
validate_string($host_name)
|
||||
if $service_name {
|
||||
validate_string($service_name)
|
||||
}
|
||||
validate_string($author)
|
||||
validate_string($comment)
|
||||
validate_bool($fixed)
|
||||
validate_string($duration)
|
||||
validate_hash($ranges)
|
||||
validate_string($target_dir)
|
||||
validate_string($target_file_name)
|
||||
validate_string($target_file_owner)
|
||||
validate_string($target_file_group)
|
||||
validate_string($target_file_mode)
|
||||
|
||||
file {"${target_dir}/${target_file_name}":
|
||||
ensure => file,
|
||||
owner => $target_file_owner,
|
||||
group => $target_file_group,
|
||||
mode => $target_file_mode,
|
||||
content => template('icinga2/object_scheduleddowntime.conf.erb'),
|
||||
notify => Service['icinga2'],
|
||||
}
|
||||
|
||||
}
|
38
templates/object_scheduleddowntime.conf.erb
Normal file
38
templates/object_scheduleddowntime.conf.erb
Normal file
|
@ -0,0 +1,38 @@
|
|||
/**
|
||||
* WARNING: This scheduleddowntime definition is automatically generated by Puppet.
|
||||
* ANY MANUAL CHANGES TO IT WILL GET OVERWRITTEN!
|
||||
*/
|
||||
|
||||
/**
|
||||
* A ScheduledDowntime definition. You can create your own configuration files
|
||||
* in the conf.d directory (e.g. one per host). By default all *.conf
|
||||
* files in this directory are included.
|
||||
*
|
||||
*/
|
||||
|
||||
object ScheduledDowntime "<%= @object_scheduleddowntimename %>" {
|
||||
<%#- If any of the @ parameters are undefined, don't print anything for them: -%>
|
||||
|
||||
host_name = "<%= @host_name -%>"
|
||||
<%- if @service_name -%>
|
||||
service_name = "<%= @service_name -%>"
|
||||
<%- end -%>
|
||||
|
||||
author = "<%= @author -%>"
|
||||
comment = "<%= @comment -%>"
|
||||
|
||||
<%- if @fixed != true -%>
|
||||
fixed = false
|
||||
<%- end -%>
|
||||
<%- if @duration -%>
|
||||
duration = <%= @duration -%>
|
||||
<%- end -%>
|
||||
<%- if @ranges.empty? != true -%>
|
||||
|
||||
ranges = {
|
||||
<%- @ranges.each_pair do |key, value| -%>
|
||||
"<%= key %>" = "<%= value %>"
|
||||
<%- end -%>
|
||||
}
|
||||
<%- end -%>
|
||||
}
|
Loading…
Reference in a new issue