Page MenuHomeSoftware Heritage

eventcommand.pp
No OneTemporary

eventcommand.pp

# == Define: icinga2::object::eventcommand
#
# Manage Icinga 2 EventCommand objects.
#
# === Parameters
#
# [*ensure*]
# Set to present enables the object, absent disables it. Defaults to present.
#
# [*eventcommand_name*]
# Set the Icinga 2 name of the eventcommand object. Defaults to title of the define resource.
#
# [*execute*]
# The "execute" script method takes care of executing the event handler.
# In virtually all cases you should import the "plugin-event-command" template to take care of this setting.
#
# [*command*]
# The command. This can either be an array of individual command arguments.
# Alternatively a string can be specified in which case the shell interpreter (usually /bin/sh)
# takes care of parsing the command.
#
# [*env*]
# A dictionary of macros which should be exported as environment variables prior to executing the command.
#
# [*vars*]
# A dictionary containing custom attributes that are specific to this command
# or a string to do operations on this dictionary.
#
# [*timeout*]
# The command timeout in seconds. Defaults to 60 seconds.
#
# [*arguments*]
# A dictionary of command arguments.
#
# [*target*]
# Destination config file to store in this object. File will be declared the
# first time.
#
# [*import*]
# Sorted List of templates to include. Defaults to an empty list.
#
# [*order*]
# String to set the position in the target file, sorted alpha numeric. Defaults to 30.
#
#
define icinga2::object::eventcommand (
Stdlib::Absolutepath $target,
Enum['absent', 'present'] $ensure = present,
String $eventcommand_name = $title,
Optional[Variant[Array,String]] $command = undef,
Optional[Hash] $env = undef,
Optional[Hash] $vars = undef,
Optional[Integer[1]] $timeout = undef,
Optional[Hash] $arguments = undef,
Array $import = ['plugin-event-command'],
Pattern[/^\d+$/] $order = '20',
){
# compose the attributes
$attrs = {
'command' => $command,
'env' => $env,
'timeout' => $timeout,
'arguments' => $arguments,
'vars' => $vars,
}
# create object
icinga2::object { "icinga2::object::EventCommand::${title}":
ensure => $ensure,
object_name => $eventcommand_name,
object_type => 'EventCommand',
import => $import,
attrs => delete_undef_values($attrs),
attrs_list => keys($attrs),
target => $target,
order => $order,
notify => Class['::icinga2::service'],
}
}

File Metadata

Mime Type
text/plain
Expires
Jun 4 2025, 7:29 PM (9 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3399194

Event Timeline