Skip to content

Latest commit

 

History

History
4304 lines (2330 loc) · 83.2 KB

REFERENCE.md

File metadata and controls

4304 lines (2330 loc) · 83.2 KB

Reference

Table of Contents

Classes

Public Classes

Private Classes

  • icinga2::config: This class exists to manage general configuration files needed by Icinga 2 to run.
  • icinga2::globals: This class loads the default parameters by doing a hiera lookup.
  • icinga2::install: This class handles the installation of the Icinga 2 package. On Windows only chocolatey is supported as installation source.
  • icinga2::repo: This class manages the packages.icinga.com repository based on the operating system. Windows is not supported.
  • icinga2::service: This class handles the Icinga 2 service. By default the service will start on boot and will be restarted if stopped.

Defined types

Public Defined types

Private Defined types

  • icinga2::feature: Private define resource to used by this module only.
  • icinga2::object: Define resource to used by this module only.

Functions

Data types

Classes

icinga2

This module installs and configures Icinga 2.

  • Note Setting manage_package to false means that all package aren't handeld by the module included the IDO packages.

Examples

Declare icinga2 with all defaults. Keep in mind that your operating system may not have Icinga 2 in its package repository.
include ::icinga2
If you want to use the official Icinga Project repository, enable the manage_repo parameter.
class { 'icinga2':
  manage_repo => true,
}
If you don't want to manage the Icinga 2 service with puppet, you can dissable this behaviour with the manage_service parameter. When set to false no service refreshes will be triggered.
class { 'icinga2':
  manage_service => false,
}
To manage the version of Icinga 2 binaries you can do it by disable package management:
package { 'icinga2':
  ensure  => latest,
  notifiy => Class['icinga2'],
}

class { '::icinga2':
  manage_package => false,
}
To set constants in etc/icinga2/constants.conf use the constants parameter and as value a hash, every key will be set as constant and assigned by it's value. Defaults can be overwritten.
class { 'icinga2':
  ...
  constants   => {
    'key1'             => 'value1',
    'key2'             => 'value2',
    'PluginContirbDir' => '/usr/local/nagios/plugins',
  }
}
Enabling features with there defaults or loading parameters via Hiera:
class { '::icinga2':
  manage_repo => true,
  features    => ['checker', 'mainlog', 'command'],
}
The ITL contains several CheckCommand definitions to load, set these in the array of the plugins parameter, i.e. for a master or satellite do the following and disbale the load of the configuration in conf.d.
class { 'icinga':
  ...
  plugins => [ 'plugins', 'contrib-plugins', 'nscp', 'windows-plugins' ],
  confd   => false,
}
Sometimes it's necessary to cover very special configurations that you cannot handle with this module. In this case you can use the icinga2::config::file tag on your file resource. This module collects all file resource types with this tag and triggers a reload of Icinga 2 on a file change.
include ::icinga2

file { '/etc/icinga2/conf.d/foo.conf':
  ensure => file,
  owner  => icinga,
  ...
  tag    => 'icinga2::config::file',
  ...
}
To use a different directory for your configuration, create the directory as file resource with tag icinga2::config::file.
file { '/etc/icinga2/local.d':
  ensure => directory,
  tag    => 'icinga2::config::file'
}
class { 'icinga2':
  ...
  confd => 'local.d',
}

Parameters

The following parameters are available in the icinga2 class.

ensure

Data type: Stdlib::Ensure::Service

Manages if the service should be stopped or running.

Default value: running

enable

Data type: Boolean

If set to true the Icinga 2 service will start on boot.

Default value: true

manage_repo

Data type: Boolean

When set to true this module will install the packages.icinga.com repository. With this official repo you can get the latest version of Icinga. When set to false the operating systems default will be used. As the Icinga Project does not offer a Chocolatey repository, you will get a warning if you enable this parameter on Windows.

Default value: false

manage_package

Data type: Boolean

If set to false packages aren't managed.

Default value: true

manage_selinux

Data type: Boolean

If set to true the icinga selinux package is installed. Requires a selinux_package_name (icinga2::globals) and manage_package has to be set to true.

Default value: false

manage_service

Data type: Boolean

If set to true the service is managed otherwise the service also isn't restarted if a config file changed.

Default value: true

features

Data type: Array

List of features to activate. Defaults to [checker, mainlog, notification].

purge_features

Data type: Boolean

Define if configuration files for features not managed by Puppet should be purged.

Default value: true

constants

Data type: Hash

Hash of constants. Defaults are set in the params class. Your settings will be merged with the defaults.

Default value: {}

plugins

Data type: Array

A list of the ITL plugins to load. Defaults to [ 'plugins', 'plugins-contrib', 'windows-plugins', 'nscp' ].

confd

Data type: Variant[Boolean, String]

conf.d is the directory where Icinga 2 stores its object configuration by default. To disable it, set this parameter to false. By default this parameter is true. It's also possible to assign your own directory. This directory must be managed outside of this module as file resource with tag icinga2::config::file.

Default value: true

icinga2::feature::api

Configures the Icinga 2 feature api.

Examples

Use the puppet certificates and key copy these files to the cert directory named to 'hostname.key', 'hostname.crt' and 'ca.crt' if the contant NodeName is set to 'hostname'.
include ::icinga2::feature::api
To use your own certificates and key as file resources if the contant NodeName is set to fqdn (default) do:
class { 'icinga2::feature::api':
  pki => 'none',
}

File {
  owner => 'icinga',
  group => 'icinga',
}

file { "/var/lib/icinga2/certs/${::fqdn}.key":
  ensure => file,
  tag    => 'icinga2::config::file',
  source => "puppet:///modules/profiles/private_keys/${::fqdn}.key",
}
...
If you like to manage the certificates and the key as strings in base64 encoded format:
class { 'icinga2::feature::api':
  pki         => 'none',
  ssl_cacert  => '-----BEGIN CERTIFICATE----- ...',
  ssl_key     => '-----BEGIN RSA PRIVATE KEY----- ...',
  ssl_cert    => '-----BEGIN CERTIFICATE----- ...',
}
Fine tune TLS settings
class { '::icinga2::feature::api':
  ssl_protocolmin => 'TLSv1.2',
  ssl_cipher_list => 'HIGH:MEDIUM:!aNULL:!MD5:!RC4',
}
Transfer a CA certificate and key from an existing CA by using the file resource:
include ::icinga2

file { '/var/lib/icinga2/ca/ca.crt':
  source => '...',
  tag    => 'icinga2::config::file',
}

file { '/var/lib/icinga2/ca/ca.key':
  source => '...',
  tag    => 'icinga2::config::file',
}

Parameters

The following parameters are available in the icinga2::feature::api class.

ensure

Data type: Enum['absent', 'present']

Set to present enables the feature api, absent disabled it.

Default value: present

pki

Data type: Enum['ca', 'icinga2', 'none', 'puppet']

Provides multiple sources for the certificate, key and ca.

  • puppet: Copies the key, cert and CAcert from the Puppet ssl directory to the cert directory /var/lib/icinga2/certs on Linux and C:/ProgramData/icinga2/var/lib/icinga2/certs on Windows.
  • icinga2: Uses the icinga2 CLI to generate a Certificate Request and Key to obtain a signed Certificate from 'ca_host' using the icinga2 ticket mechanism. In case the 'ticket_salt' has been configured the ticket_id will be generated by the module in a custom function that imitates the icinga ticket generation. The 'ticket_id' parameter can be used to directly set an ticket_id.
  • none: Does nothing and you either have to manage the files yourself as file resources or use the ssl_key, ssl_cert, ssl_cacert parameters.

Default value: 'icinga2'

ssl_key

Data type: Optional[String]

The private key in a base64 encoded string to store in cert directory. This parameter requires pki to be set to 'none'.

Default value: undef

ssl_cert

Data type: Optional[String]

The certificate in a base64 encoded string to store in cert directory This parameter requires pki to be set to 'none'.

Default value: undef

ssl_cacert

Data type: Optional[String]

The CA root certificate in a base64 encoded string to store in cert directory. This parameter requires pki to be set to 'none'.

Default value: undef

ssl_crl

Data type: Optional[Stdlib::Absolutepath]

Optional location of the certificate revocation list.

Default value: undef

accept_config

Data type: Optional[Boolean]

Accept zone configuration.

Default value: undef

accept_commands

Data type: Optional[Boolean]

Accept remote commands.

Default value: undef

max_anonymous_clients

Data type: Optional[Integer[0]]

Limit the number of anonymous client connections (not configured endpoints and signing requests).

Default value: undef

ca_host

Data type: Optional[Stdlib::Host]

This host will be connected to request the certificate. Set this if you use the icinga2 pki.

Default value: undef

ca_port

Data type: Stdlib::Port::Unprivileged

Port of the 'ca_host'.

Default value: 5665

fingerprint

Data type: Optional[Icinga2::Fingerprint]

Fingerprint of the CA host certificate for validation. Requires pki is set to icinga2. You can get the fingerprint via 'openssl x509 -noout -fingerprint -sha1 -inform pem -in [certificate-file.crt]' on your CA host.

Default value: undef

ticket_salt

Data type: String

Salt to use for ticket generation. The salt is stored to api.conf if none or ca is chosen for pki. Defaults to constant TicketSalt.

Default value: 'TicketSalt'

ticket_id

Data type: Optional[String]

If a ticket_id is given it will be used instead of generating an ticket_id. The ticket_id will be used only when requesting a certificate from the ca_host in case the pki is set to 'icinga2'.

Default value: undef

endpoints

Data type: Hash[String, Hash]

Hash to configure endpoint objects. NodeName is a icnga2 constant.

Default value: { 'NodeName' => {} }

zones

Data type: Hash[String, Hash]

Hash to configure zone objects. ZoneName and NodeName are icinga2 constants.

Default value: { 'ZoneName' => { endpoints => [ 'NodeName' ] } }

ssl_protocolmin

Data type: Optional[Enum['TLSv1', 'TLSv1.1', 'TLSv1.2']]

Minimal TLS version to require.

Default value: undef

ssl_handshake_timeout

Data type: Optional[Icinga2::Interval]

TLS Handshake timeout.

Default value: undef

ssl_cipher_list

Data type: Optional[String]

List of allowed TLS ciphers, to finetune encryption.

Default value: undef

bind_host

Data type: Optional[Stdlib::Host]

The IP address the api listener will be bound to.

Default value: undef

bind_port

Data type: Optional[Stdlib::Port::Unprivileged]

The port the api listener will be bound to.

Default value: undef

access_control_allow_origin

Data type: Optional[Array[String]]

Specifies an array of origin URLs that may access the API.

Default value: undef

access_control_allow_credentials

Data type: Optional[Boolean]

Indicates whether or not the actual request can be made using credentials.

Default value: undef

access_control_allow_headers

Data type: Optional[String]

Used in response to a preflight request to indicate which HTTP headers can be used when making the actual request.

Default value: undef

access_control_allow_methods

Data type: Optional[Array[Enum['GET', 'POST', 'PUT', 'DELETE']]]

Used in response to a preflight request to indicate which HTTP methods can be used when making the actual request.

Default value: undef

environment

Data type: Optional[String]

Used as suffix in TLS SNI extension name; default from constant ApiEnvironment, which is empty.

Default value: undef

icinga2::feature::checker

Configures the Icinga 2 feature checker.

  • Note Deprecated in Icinga 2.11, replaced by global constant MaxConcurrentChecks which will be set if you still use concurrent_checks.

Parameters

The following parameters are available in the icinga2::feature::checker class.

ensure

Data type: Enum['absent', 'present']

Set to present enables the feature checker, absent disabled it.

Default value: present

concurrent_checks

Data type: Optional[Integer[1]]

The maximum number of concurrent checks.

Default value: undef

icinga2::feature::command

Configures the Icinga 2 feature command.

Parameters

The following parameters are available in the icinga2::feature::command class.

ensure

Data type: Enum['absent', 'present']

Set to present to enable the feature command, absent to disabled it.

Default value: present

command_path

Data type: Optional[Stdlib::Absolutepath]

Absolute path to the command pipe.

Default value: undef

icinga2::feature::compatlog

Configures the Icinga 2 feature compatlog.

Parameters

The following parameters are available in the icinga2::feature::compatlog class.

ensure

Data type: Enum['absent', 'present']

Set to present enables the feature compatlog, absent disabled it.

Default value: present

log_dir

Data type: Optional[Stdlib::Absolutepath]

Absolute path to the log directory.

Default value: undef

rotation_method

Data type: Optional[Enum['DAILY', 'HOURLY', 'MONTHLY', 'WEEKLY']]

Sets how often should the log file be rotated.

Default value: undef

icinga2::feature::debuglog

Configures the Icinga 2 feature mainlog.

Parameters

The following parameters are available in the icinga2::feature::debuglog class.

ensure

Data type: Enum['absent', 'present']

Set to present enables the feature mainlog, absent disables it.

Default value: present

path

Data type: Stdlib::Absolutepath

Absolute path to the log file.

Default value: "${::icinga2::globals::log_dir}/debug.log"

icinga2::feature::elasticsearch

Configures the Icinga 2 feature elasticsearch.

Examples

class { 'icinga2::feature::elasticsearch':
  host     => "10.10.0.15",
  index    => "icinga2"
}

Parameters

The following parameters are available in the icinga2::feature::elasticsearch class.

ensure

Data type: Enum['absent', 'present']

Set to present enables the feature elasticsearch, absent disables it.

Default value: present

host

Data type: Optional[Stdlib::Host]

Elasticsearch host address.

Default value: undef

port

Data type: Optional[Stdlib::Port::Unprivileged]

Elasticsearch HTTP port.

Default value: undef

index

Data type: Optional[String]

Elasticsearch index name.

Default value: undef

username

Data type: Optional[String]

Elasticsearch user name.

Default value: undef

password

Data type: Optional[String]

Elasticsearch user password.

Default value: undef

enable_ssl

Data type: Optional[Boolean]

Either enable or disable SSL. Other SSL parameters are only affected if this is set to 'true'.

Default value: undef

ssl_key_path

Data type: Optional[Stdlib::Absolutepath]

Location of the private key.

Default value: undef

ssl_cert_path

Data type: Optional[Stdlib::Absolutepath]

Location of the certificate.

Default value: undef

ssl_cacert_path

Data type: Optional[Stdlib::Absolutepath]

Location of the CA certificate.

Default value: undef

ssl_key

Data type: Optional[String]

The private key in a base64 encoded string to store in spicified ssl_key_path file.

Default value: undef

ssl_cert

Data type: Optional[String]

The certificate in a base64 encoded to store in spicified ssl_cert_path file.

Default value: undef

ssl_cacert

Data type: Optional[String]

The CA root certificate in a base64 encoded string to store in spicified ssl_cacert_path file.

Default value: undef

enable_send_perfdata

Data type: Optional[Boolean]

Whether to send check performance data metrics.

Default value: undef

flush_interval

Data type: Optional[Icinga2::Interval]

How long to buffer data points before transferring to Elasticsearch.

Default value: undef

flush_threshold

Data type: Optional[Integer]

How many data points to buffer before forcing a transfer to Elasticsearch.

Default value: undef

enable_ha

Data type: Optional[Boolean]

Enable the high availability functionality. Only valid in a cluster setup.

Default value: undef

icinga2::feature::gelf

Configures the Icinga 2 feature gelf.

Parameters

The following parameters are available in the icinga2::feature::gelf class.

ensure

Data type: Enum['absent', 'present']

Set to present enables the feature gelf, absent disables it.

Default value: present

host

Data type: Optional[Stdlib::Host]

GELF receiver host address.

Default value: undef

port

Data type: Optional[Stdlib::Port::Unprivileged]

GELF receiver port.

Default value: undef

source

Data type: Optional[String]

Source name for this instance.

Default value: undef

enable_send_perfdata

Data type: Optional[Boolean]

Enable performance data for 'CHECK RESULT' events.

Default value: undef

enable_ha

Data type: Optional[Boolean]

Enable the high availability functionality. Only valid in a cluster setup.

Default value: undef

icinga2::feature::graphite

Configures the Icinga 2 feature graphite.

Examples

class { '::icinga2::feature::graphite':
  host                   => '10.10.0.15',
  port                   => 2003,
  enable_send_thresholds => true,
  enable_send_metadata   => true,
}

Parameters

The following parameters are available in the icinga2::feature::graphite class.

ensure

Data type: Enum['absent', 'present']

Set to present enables the feature graphite, absent disabled it.

Default value: present

host

Data type: Optional[Stdlib::Host]

Graphite Carbon host address.

Default value: undef

port

Data type: Optional[Stdlib::Port::Unprivileged]

Graphite Carbon port.

Default value: undef

host_name_template

Data type: Optional[String]

Template for metric path of hosts.

Default value: undef

service_name_template

Data type: Optional[String]

Template for metric path of services.

Default value: undef

enable_send_thresholds

Data type: Optional[Boolean]

Default value: undef

enable_send_metadata

Data type: Optional[Boolean]

Default value: undef

enable_ha

Data type: Optional[Boolean]

Enable the high availability functionality. Only valid in a cluster setup.

Default value: undef

icinga2::feature::icingadb

Configures the Icinga 2 feature icingadb.

Parameters

The following parameters are available in the icinga2::feature::icingadb class.

ensure

Data type: Enum['absent', 'present']

Set to present, enables the feature icingadb, absent disabled it.

Default value: present

host

Data type: Optional[Stdlib::Host]

IcingaDB Redis host address.

Default value: undef

port

Data type: Optional[Stdlib::Port::Unprivileged]

IcingaDB Redis port.

Default value: undef

socket_path

Data type: Optional[Stdlib::Absolutepath]

IcingaDB Redis unix sockt. Can be used instead of host and port attributes.

Default value: undef

password

Data type: Optional[String]

IcingaDB Redis password.

Default value: undef

icinga2::feature::idomysql

Installs and configures the Icinga 2 feature ido-mysql.

Examples

The ido-mysql featue requires an existing database and a user with permissions. This example uses the puppetlabs/mysql module.
include mysql::server

mysql::db { 'icinga2':
  user     => 'icinga2',
  password => 'supersecret',
  host     => 'localhost',
  grant    => ['SELECT', 'INSERT', 'UPDATE', 'DELETE', 'DROP', 'CREATE VIEW', 'CREATE', 'INDEX', 'EXECUTE', 'ALTER'],
}

class{ 'icinga2::feature::idomysql':
  user          => "icinga2",
  password      => "supersecret",
  database      => "icinga2",
  import_schema => true,
  require       => Mysql::Db['icinga2']
}

Parameters

The following parameters are available in the icinga2::feature::idomysql class.

ensure

Data type: Enum['absent', 'present']

Set to present enables the feature ido-mysql, absent disables it.

Default value: present

host

Data type: Stdlib::Host

MySQL database host address.

Default value: 'localhost'

port

Data type: Optional[Stdlib::Port::Unprivileged]

MySQL database port.

Default value: undef

socket_path

Data type: Optional[Stdlib::Absolutepath]

MySQL socket path.

Default value: undef

user

Data type: String

MySQL database user with read/write permission to the icinga database.

Default value: 'icinga'

password

Data type: String

MySQL database user's password.

database

Data type: String

MySQL database name.

Default value: 'icinga'

enable_ssl

Data type: Boolean

Either enable or disable SSL/TLS. Other SSL parameters are only affected if this is set to 'true'.

Default value: false

ssl_key_path

Data type: Optional[Stdlib::Absolutepath]

Location of the private key. Only valid if ssl is enabled.

Default value: undef

ssl_cert_path

Data type: Optional[Stdlib::Absolutepath]

Location of the certificate. Only valid if ssl is enabled.

Default value: undef

ssl_cacert_path

Data type: Optional[Stdlib::Absolutepath]

Location of the CA certificate. Only valid if ssl is enabled.

Default value: undef

ssl_key

Data type: Optional[String]

The private key in a base64 encoded string to store in spicified ssl_key_path file. Only valid if ssl is enabled.

Default value: undef

ssl_cert

Data type: Optional[String]

The certificate in a base64 encoded string to store in spicified ssl_cert_path file. Only valid if ssl is enabled.

Default value: undef

ssl_cacert

Data type: Optional[String]

The CA root certificate in a base64 encoded string to store in spicified ssl_cacert_path file. Only valid if ssl is enabled.

Default value: undef

ssl_capath

Data type: Optional[Stdlib::Absolutepath]

MySQL SSL trusted SSL CA certificates in PEM format directory path. Only valid if ssl is enabled.

Default value: undef

ssl_cipher

Data type: Optional[String]

MySQL SSL list of allowed ciphers. Only valid if ssl is enabled.

Default value: undef

table_prefix

Data type: Optional[String]

MySQL database table prefix.

Default value: undef

instance_name

Data type: Optional[String]

Unique identifier for the local Icinga 2 instance.

Default value: undef

instance_description

Data type: Optional[String]

Description for the Icinga 2 instance.

Default value: undef

enable_ha

Data type: Optional[Boolean]

Enable the high availability functionality. Only valid in a cluster setup.

Default value: undef

failover_timeout

Data type: Optional[Icinga2::Interval]

Set the failover timeout in a HA cluster. Must not be lower than 60s.

Default value: undef

cleanup

Data type: Optional[Hash[String,Icinga2::Interval]]

Hash with items for historical table cleanup.

Default value: undef

categories

Data type: Optional[Array]

Array of information types that should be written to the database.

Default value: undef

import_schema

Data type: Boolean

Whether to import the MySQL schema or not.

Default value: false

icinga2::feature::idopgsql

Installs and configures the Icinga 2 feature ido-pgsql.

Examples

The ido-pgsql featue requires an existing database and a user with permissions. This example uses the puppetlab/postgresql module.
include icinga2
include postgresql::server

postgresql::server::db { 'icinga2':
  user     => 'icinga2',
  password => postgresql_password('icinga2', 'supersecret'),
}

class{ 'icinga2::feature::idopgsql':
  user          => "icinga2",
  password      => "supersecret",
  database      => "icinga2",
  import_schema => true,
  require       => Postgresql::Server::Db['icinga2']
}

Parameters

The following parameters are available in the icinga2::feature::idopgsql class.

ensure

Data type: Enum['absent', 'present']

Set to present enables the feature ido-pgsql, absent disables it.

Default value: present

host

Data type: Stdlib::Host

PostgreSQL database host address.

Default value: 'localhost'

port

Data type: Stdlib::Port::Unprivileged

PostgreSQL database port.

Default value: 5432

user

Data type: String

PostgreSQL database user with read/write permission to the icinga database.

Default value: 'icinga'

password

Data type: String

PostgreSQL database user's password.

database

Data type: String

PostgreSQL database name.

Default value: 'icinga'

table_prefix

Data type: Optional[String]

PostgreSQL database table prefix.

Default value: undef

instance_name

Data type: Optional[String]

Unique identifier for the local Icinga 2 instance.

Default value: undef

instance_description

Data type: Optional[String]

Description of the Icinga 2 instance.

Default value: undef

enable_ha

Data type: Optional[Boolean]

Enable the high availability functionality. Only valid in a cluster setup.

Default value: undef

failover_timeout

Data type: Optional[Icinga2::Interval]

Set the failover timeout in a HA cluster. Must not be lower than 60s.

Default value: undef

cleanup

Data type: Optional[Hash]

Hash with items for historical table cleanup.

Default value: undef

categories

Data type: Optional[Array]

Array of information types that should be written to the database.

Default value: undef

import_schema

Data type: Boolean

Whether to import the PostgreSQL schema or not.

Default value: false

icinga2::feature::influxdb

Configures the Icinga 2 feature influxdb.

Examples

class { 'icinga2::feature::influxdb':
  host     => "10.10.0.15",
  username => "icinga2",
  password => "supersecret",
  database => "icinga2"
}

Parameters

The following parameters are available in the icinga2::feature::influxdb class.

ensure

Data type: Enum['absent', 'present']

Set to present enables the feature influxdb, absent disables it.

Default value: present

host

Data type: Optional[Stdlib::Host]

InfluxDB host address.

Default value: undef

port

Data type: Optional[Stdlib::Port]

InfluxDB HTTP port.

Default value: undef

database

Data type: Optional[String]

InfluxDB database name.

Default value: undef

username

Data type: Optional[String]

InfluxDB user name.

Default value: undef

password

Data type: Optional[String]

InfluxDB user password.

Default value: undef

enable_ssl

Data type: Optional[Boolean]

Either enable or disable SSL. Other SSL parameters are only affected if this is set to 'true'.

Default value: undef

ssl_key_path

Data type: Optional[Stdlib::Absolutepath]

Location of the private key.

Default value: undef

ssl_cert_path

Data type: Optional[Stdlib::Absolutepath]

Location of the certificate.

Default value: undef

ssl_cacert_path

Data type: Optional[Stdlib::Absolutepath]

Location of the CA certificate.

Default value: undef

ssl_key

Data type: Optional[String]

The private key in a base64 encoded string to store in ssl_key_path file.

Default value: undef

ssl_cert

Data type: Optional[String]

The certificate in a base64 encoded string to store in ssl_cert_path file.

Default value: undef

ssl_cacert

Data type: Optional[String]

The CA root certificate in a base64 encoded to store in ssl_cacert_path file.

Default value: undef

host_measurement

Data type: String

The value of this is used for the measurement setting in host_template.

Default value: '$host.check_command$'

host_tags

Data type: Hash

Tags defined in this hash will be set in the host_template.

Default value: { hostname => '$host.name$' }

service_measurement

Data type: String

The value of this is used for the measurement setting in host_template.

Default value: '$service.check_command$'

service_tags

Data type: Hash

Tags defined in this hash will be set in the service_template.

Default value: { hostname => '$host.name$', service => '$service.name$' }

enable_send_thresholds

Data type: Optional[Boolean]

Whether to send warn, crit, min & max tagged data.

Default value: undef

enable_send_metadata

Data type: Optional[Boolean]

Whether to send check metadata e.g. states, execution time, latency etc.

Default value: undef

flush_interval

Data type: Optional[Icinga2::Interval]

How long to buffer data points before transfering to InfluxDB.

Default value: undef

flush_threshold

Data type: Optional[Integer[1]]

How many data points to buffer before forcing a transfer to InfluxDB.

Default value: undef

enable_ha

Data type: Optional[Boolean]

Enable the high availability functionality. Only valid in a cluster setup.

Default value: undef

icinga2::feature::livestatus

Configures the Icinga 2 feature livestatus.

Parameters

The following parameters are available in the icinga2::feature::livestatus class.

ensure

Data type: Enum['absent', 'present']

Set to present enables the feature livestatus, absent disables it.

Default value: present

socket_type

Data type: Optional[Enum['tcp', 'unix']]

Specifies the socket type. Can be either 'tcp' or 'unix'.

Default value: undef

bind_host

Data type: Optional[Stdlib::Host]

IP address to listen for connections. Only valid when socket_type is 'tcp'.

Default value: undef

bind_port

Data type: Optional[Stdlib::Port::Unprivileged]

Port to listen for connections. Only valid when socket_type is 'tcp'.

Default value: undef

socket_path

Data type: Optional[Stdlib::Absolutepath]

Specifies the path to the UNIX socket file. Only valid when socket_type is 'unix'.

Default value: undef

compat_log_path

Data type: Optional[Stdlib::Absolutepath]

Required for historical table queries. Requires CompatLogger feature to be enabled.

Default value: undef

icinga2::feature::mainlog

Configures the Icinga 2 feature mainlog.

Parameters

The following parameters are available in the icinga2::feature::mainlog class.

ensure

Data type: Enum['absent', 'present']

Set to 'present' enables the feature mainlog, 'absent' disabled it.

Default value: present

severity

Data type: Icinga2::LogSeverity

You can set the log severity to 'information', 'notice', 'warning' or 'debug'.

Default value: 'information'

path

Data type: Stdlib::Absolutepath

Absolute path to the log file.

Default value: "${::icinga2::globals::log_dir}/icinga2.log"

icinga2::feature::notification

Configures the Icinga 2 feature notification.

Parameters

The following parameters are available in the icinga2::feature::notification class.

ensure

Data type: Enum['absent', 'present']

Set to present enables the feature notification, absent disabled it.

Default value: present

enable_ha

Data type: Optional[Boolean]

Notifications are load-balanced amongst all nodes in a zone.

Default value: undef

icinga2::feature::opentsdb

Configures the Icinga 2 feature opentsdb.

Parameters

The following parameters are available in the icinga2::feature::opentsdb class.

ensure

Data type: Enum['absent', 'present']

Set to present enables the feature opentsdb, absent disables it.

Default value: present

host

Data type: Optional[Stdlib::Host]

OpenTSDB host address.

Default value: undef

port

Data type: Optional[Stdlib::Port::Unprivileged]

OpenTSDB port.

Default value: undef

enable_ha

Data type: Optional[Boolean]

Enable the high availability functionality. Only valid in a cluster setup.

Default value: undef

icinga2::feature::perfdata

Configures the Icinga 2 feature perfdata.

Parameters

The following parameters are available in the icinga2::feature::perfdata class.

ensure

Data type: Enum['absent', 'present']

Set to present enables the feature perfdata, absent disables it.

Default value: present

host_perfdata_path

Data type: Optional[Stdlib::Absolutepath]

Absolute path to the perfdata file for hosts.

Default value: undef

service_perfdata_path

Data type: Optional[Stdlib::Absolutepath]

Absolute path to the perfdata file for services.

Default value: undef

host_temp_path

Data type: Optional[Stdlib::Absolutepath]

Path to the temporary host file.

Default value: undef

service_temp_path

Data type: Optional[Stdlib::Absolutepath]

Path to the temporary service file.

Default value: undef

host_format_template

Data type: Optional[String]

Host Format template for the performance data file.

Default value: undef

service_format_template

Data type: Optional[String]

Service Format template for the performance data file.

Default value: undef

rotation_interval

Data type: Optional[Icinga2::Interval]

Rotation interval for the files specified in {host,service}_perfdata_path. Can be written in minutes or seconds, i.e. 1m or 15s.

Default value: undef

enable_ha

Data type: Optional[Boolean]

Enable the high availability functionality. Only valid in a cluster setup.

Default value: undef

icinga2::feature::statusdata

Configures the Icinga 2 feature statusdata.

Parameters

The following parameters are available in the icinga2::feature::statusdata class.

ensure

Data type: Enum['absent', 'present']

Set to present enables the feature statusdata, absent disables it.

Default value: present

status_path

Data type: Optional[Stdlib::Absolutepath]

Absolute path to the status.dat file.

Default value: undef

objects_path

Data type: Optional[Stdlib::Absolutepath]

Absolute path to the object.cache file.

Default value: undef

update_interval

Data type: Optional[Icinga2::Interval]

Interval in seconds to update both status files. You can also specify it in minutes with the letter m or in seconds with s.

Default value: undef

icinga2::feature::syslog

Configures the Icinga 2 feature syslog.

Parameters

The following parameters are available in the icinga2::feature::syslog class.

ensure

Data type: Enum['absent', 'present']

Set to present enables the feature syslog, absent disables it.

Default value: present

severity

Data type: Optional[Icinga2::LogSeverity]

You can choose the log severity between information, notice, warning or debug.

Default value: undef

facility

Data type: Optional[Icinga2::LogFacility]

Defines the facility to use for syslog entries. This can be a facility constant like FacilityDaemon.

Default value: undef

icinga2::pki::ca

This class provides multiple ways to create the CA used by Icinga 2.

Examples

Let Icinga 2 generate a CA for you:
include icinga2
include icinga2::pki::ca
Set the content of CA certificate and key:
include icinga2

class { 'icinga2::pki::ca':
  ca_cert => '-----BEGIN CERTIFICATE----- ...',
  ca_key  => '-----BEGIN RSA PRIVATE KEY----- ...',
}

Parameters

The following parameters are available in the icinga2::pki::ca class.

ca_cert

Data type: Optional[String]

Content of the CA certificate. If this is unset, a certificate will be generated with the Icinga 2 CLI.

Default value: undef

ca_key

Data type: Optional[String]

Content of the CA key. If this is unset, a key will be generated with the Icinga 2 CLI.

Default value: undef

Defined types

icinga2::config::fragment

Set a code fragment in a target configuration file.

Examples

To create a custom configuration add content to a specified target at the position you set in the order parameter. You can use also templates to add content.
include ::icinga2

icinga2::object::service { 'load':
  display_name  => 'Load',
  apply         => true,
  check_command => 'load',
  assign        => ['vars.os == Linux'],
  target        => '/etc/icinga2/conf.d/service_load.conf',
  order         => 30,
}

icinga2::config::fragment { 'load-function':
  target => '/etc/icinga2/conf.d/service_load.conf',
  order => 10,
  content => 'vars.load_wload1 = {{
    if (get_time_period("backup").is_inside) {
      return 20
    } else {
      return 5
    }
  }}',
}

Parameters

The following parameters are available in the icinga2::config::fragment defined type.

content

Data type: String

Content to insert in file specified in target.

target

Data type: Stdlib::Absolutepath

Destination config file to store in this fragment. File will be declared the first time.

order

Data type: Variant[String, Integer]

String or integer to set the position in the target file, sorted in alpha numeric order. Defaults to 00.

Default value: '00'

code_name

Data type: String

Default value: $title

icinga2::object::apiuser

Manage Icinga 2 ApiUser objects.

Examples

Create an user with full permissions:
::icinga2::object::apiuser { 'director':
  ensure      => present,
  password    => 'Eih5Weefoo2oa8sh',
  permissions => [ '*' ],
  target      => '/etc/icinga2/conf.d/api-users.conf',
}
Create an user with restricted permissions for Icinga Web 2:
::icinga2::object::apiuser { 'icingaweb2':
  ensure      => present,
  password    => '12e2ef553068b519',
  permissions => [ 'status/query', 'actions/*', 'objects/modify/*', 'objects/query/*' ],
  target      => '/etc/icinga2/conf.d/api-users.conf',
}
Create user who's only allowed to query hosts and services:
::icinga2::object::apiuser { 'read':
  ensure      => present,
  password    => 'read',
  permissions => [
    {
      permission => 'objects/query/Host',
      filter     => '{{ regex("^Linux", host.vars.os) }}'
    },
    {
      permission => 'objects/query/Service',
      filter     => '{{ regex("^Linux", host.vars.os) }}'
    },
  ],
  target      => '/etc/icinga2/conf.d/api-users.conf',
}

Parameters

The following parameters are available in the icinga2::object::apiuser defined type.

ensure

Data type: Enum['absent', 'present']

Set to present enables the object, absent disables it.

Default value: present

apiuser_name

Data type: String

Set the name of the apiuser object.

Default value: $title

password

Data type: Optional[String]

Password string.

Default value: undef

client_cn

Data type: Optional[String]

Optional. Client Common Name (CN).

Default value: undef

permissions

Data type: Optional[Array]

Array of permissions. Either as string or dictionary with the keys permission and filter. The latter must be specified as function.

Default value: undef

target

Data type: Stdlib::Absolutepath

Destination config file to store in this object. File will be declared at the first time.

order

Data type: Variant[String, Integer]

String or integer to set the position in the target file, sorted alpha numeric.

Default value: 30

icinga2::object::checkcommand

Manage Icinga 2 Host objects.

Parameters

The following parameters are available in the icinga2::object::checkcommand defined type.

ensure

Data type: Enum['absent', 'present']

Set to present enables the object, absent disables it.

Default value: present

checkcommand_name

Data type: String

Title of the CheckCommand object.

Default value: $title

import

Data type: Array

Sorted List of templates to include.

Default value: []

command

Data type: Optional[Variant[Array, String]]

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. When using the "arguments" attribute this must be an array. Can be specified as function for advanced implementations.

Default value: undef

env

Data type: Optional[Hash]

A dictionary of macros which should be exported as environment variables prior to executing the command.

Default value: undef

vars

Data type: Optional[Icinga2::CustomAttributes]

A dictionary containing custom attributes that are specific to this service, a string to do operations on this dictionary or an array for multiple use of custom attributes.

Default value: undef

timeout

Data type: Optional[Integer[1]]

The command timeout in seconds.

Default value: undef

arguments

Data type: Optional[Variant[Hash, String]]

A dictionary of command arguments.

Default value: undef

target

Data type: Stdlib::Absolutepath

Destination config file to store in this object. File will be declared the first time.

template

Data type: Boolean

Set to true creates a template instead of an object.

Default value: false

order

Data type: Variant[String, Integer]

String or integer to set the position in the target file, sorted alpha numeric.

Default value: 15

icinga2::object::checkresultreader

Manage Icinga 2 CheckResultReader objects.

Parameters

The following parameters are available in the icinga2::object::checkresultreader defined type.

ensure

Data type: Enum['absent', 'present']

Set to present enables the object, absent disables it.

Default value: present

checkresultreader_name

Data type: String

Set the Icinga 2 name of the ceckresultreader object.

Default value: $title

spool_dir

Data type: Optional[Stdlib::Absolutepath]

The directory which contains the check result files.

Default value: undef

target

Data type: Stdlib::Absolutepath

Destination config file to store in this object. File will be declared the first time.

order

Data type: Variant[String, Integer]

String or integer to set the position in the target file, sorted alpha numeric.

Default value: '05'

icinga2::object::dependency

Manage Icinga 2 dependency objects.

Parameters

The following parameters are available in the icinga2::object::dependency defined type.

ensure

Data type: Enum['absent', 'present']

Set to present enables the object, absent disables it.

Default value: present

dependency_name

Data type: String

Set the Icinga 2 name of the dependency object.

Default value: $title

parent_host_name

Data type: Optional[String]

The parent host.

Default value: undef

parent_service_name

Data type: Optional[String]

The parent service. If omitted, this dependency object is treated as host dependency.

Default value: undef

child_host_name

Data type: Optional[String]

The child host.

Default value: undef

child_service_name

Data type: Optional[String]

The child service. If omitted, this dependency object is treated as host dependency.

Default value: undef

disable_checks

Data type: Optional[Boolean]

Whether to disable checks when this dependency fails.

Default value: undef

disable_notifications

Data type: Optional[Boolean]

Whether to disable notifications when this dependency fails. true.

Default value: undef

ignore_soft_states

Data type: Optional[Boolean]

Whether to ignore soft states for the reachability calculation. true.

Default value: undef

period

Data type: Optional[String]

Time period during which this dependency is enabled.

Default value: undef

states

Data type: Optional[Array]

A list of state filters when this dependency should be OK.

Default value: undef

apply

Data type: Variant[Boolean, String]

Dispose an apply instead an object if set to 'true'. Value is taken as statement, i.e. 'vhost => config in host.vars.vhosts'.

Default value: false

prefix

Data type: Variant[Boolean, String]

Set dependency_name as prefix in front of 'apply for'. Only effects if apply is a string.

Default value: false

apply_target

Data type: Enum['Host', 'Service']

An object type on which to target the apply rule. Valid values are Host and Service.

Default value: 'Host'

assign

Data type: Array

Assign user group members using the group assign rules.

Default value: []

ignore

Data type: Array

Exclude users using the group ignore rules.

Default value: []

template

Data type: Boolean

Set to true creates a template instead of an object.

Default value: false

import

Data type: Array

Sorted List of templates to include.

Default value: []

target

Data type: Stdlib::Absolutepath

Destination config file to store in this object. File will be declared the first time.

order

Data type: Variant[String, Integer]

String or integer to set the position in the target file, sorted alpha numeric.

Default value: 70

icinga2::object::endpoint

Manage Icinga 2 endpoint objects.

Parameters

The following parameters are available in the icinga2::object::endpoint defined type.

ensure

Data type: Enum['absent', 'present']

Set to present enables the object, absent disables it.

Default value: present

endpoint_name

Data type: String

Set the Icinga 2 name of the endpoint object.

Default value: $title

host

Data type: Optional[Stdlib::Host]

Optional. The IP address of the remote Icinga 2 instance.

Default value: undef

port

Data type: Optional[Stdlib::Port::Unprivileged]

The service name/port of the remote Icinga 2 instance.

Default value: undef

log_duration

Data type: Optional[Icinga2::Interval]

Duration for keeping replay logs on connection loss. Attribute is specified in seconds. If log_duration is set to 0, replaying logs is disabled. You could also specify the value in human readable format like 10m for 10 minutes or 1h for one hour.

Default value: undef

target

Data type: Optional[Stdlib::Absolutepath]

Destination config file to store in this object. File will be declared at the first time.

Default value: undef

order

Data type: Variant[String, Integer]

String or integer to set the position in the target file, sorted alpha numeric.

Default value: 40

icinga2::object::eventcommand

Manage Icinga 2 EventCommand objects.

Parameters

The following parameters are available in the icinga2::object::eventcommand defined type.

ensure

Data type: Enum['absent', 'present']

Set to present enables the object, absent disables it.

Default value: present

eventcommand_name

Data type: String

Set the Icinga 2 name of the eventcommand object.

Default value: $title

command

Data type: Optional[Variant[Array, String]]

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.

Default value: undef

env

Data type: Optional[Hash]

A dictionary of macros which should be exported as environment variables prior to executing the command.

Default value: undef

vars

Data type: Optional[Icinga2::CustomAttributes]

A dictionary containing custom attributes that are specific to this service, a string to do operations on this dictionary or an array for multiple use of custom attributes.

Default value: undef

timeout

Data type: Optional[Integer[1]]

The command timeout in seconds.

Default value: undef

arguments

Data type: Optional[Hash]

A dictionary of command arguments.

Default value: undef

target

Data type: Stdlib::Absolutepath

Destination config file to store in this object. File will be declared the first time.

import

Data type: Array

Sorted List of templates to include.

Default value: []

order

Data type: Variant[String, Integer]

String or integer to set the position in the target file, sorted alpha numeric.

Default value: 20

icinga2::object::host

Manage Icinga 2 Host objects.

Parameters

The following parameters are available in the icinga2::object::host defined type.

ensure

Data type: Enum['absent', 'present']

Set to present enables the object, absent disables it.

Default value: present

host_name

Data type: String

Hostname of the Host object.

Default value: $title

import

Data type: Array

Sorted List of templates to include.

Default value: []

display_name

Data type: Optional[String]

A short description of the host (e.g. displayed by external interfaces instead of the name if set).

Default value: undef

address

Data type: Optional[Stdlib::Host]

The host's address v4.

Default value: undef

address6

Data type: Optional[Stdlib::Host]

The host's address v6.

Default value: undef

vars

Data type: Optional[Icinga2::CustomAttributes]

A dictionary containing custom attributes that are specific to this service, a string to do operations on this dictionary or an array for multiple use of custom attributes.

Default value: undef

groups

Data type: Optional[Array]

A list of host groups this host belongs to.

Default value: undef

check_command

Data type: Optional[String]

The name of the check command.

Default value: undef

max_check_attempts

Data type: Optional[Integer[1]]

The number of times a host is re-checked before changing into a hard state.

Default value: undef

check_period

Data type: Optional[String]

The name of a time period which determines when this host should be checked.

Default value: undef

check_timeout

Data type: Optional[Icinga2::Interval]

Check command timeout in seconds. Overrides the CheckCommand's timeout attribute.

Default value: undef

check_interval

Data type: Optional[Icinga2::Interval]

The check interval (in seconds). This interval is used for checks when the host is in a HARD state.

Default value: undef

retry_interval

Data type: Optional[Icinga2::Interval]

The retry interval (in seconds). This interval is used for checks when the host is in a SOFT state.

Default value: undef

enable_notifications

Data type: Optional[Boolean]

Whether notifications are enabled.

Default value: undef

enable_active_checks

Data type: Optional[Boolean]

Whether active checks are enabled.

Default value: undef

enable_passive_checks

Data type: Optional[Boolean]

Whether passive checks are enabled.

Default value: undef

enable_event_handler

Data type: Optional[Boolean]

Enables event handlers for this host.

Default value: undef

enable_flapping

Data type: Optional[Boolean]

Whether flap detection is enabled.

Default value: undef

enable_perfdata

Data type: Optional[Boolean]

Whether performance data processing is enabled.

Default value: undef

event_command

Data type: Optional[String]

The name of an event command that should be executed every time the host's state changes or the host is in a SOFT state.

Default value: undef

flapping_threshold_low

Data type: Optional[Integer[1]]

Flapping lower bound in percent for a host to be considered not flapping.

Default value: undef

flapping_threshold_high

Data type: Optional[Integer[1]]

Flapping upper bound in percent for a host to be considered flapping.

Default value: undef

volatile

Data type: Optional[Boolean]

The volatile setting enables always HARD state types if NOT-OK state changes occur.

Default value: undef

zone

Data type: Optional[String]

The zone this object is a member of.

Default value: undef

command_endpoint

Data type: Optional[String]

The endpoint where commands are executed on.

Default value: undef

notes

Data type: Optional[String]

Notes for the host.

Default value: undef

notes_url

Data type: Optional[String]

Url for notes for the host (for example, in notification commands).

Default value: undef

action_url

Data type: Optional[String]

Url for actions for the host (for example, an external graphing tool).

Default value: undef

icon_image

Data type: Optional[Stdlib::Absolutepath]

Icon image for the host. Used by external interfaces only.

Default value: undef

icon_image_alt

Data type: Optional[String]

Icon image description for the host. Used by external interface only.

Default value: undef

template

Data type: Boolean

Set to true creates a template instead of an object.

Default value: false

target

Data type: Stdlib::Absolutepath

Destination config file to store in this object. File will be declared the first time.

order

Data type: Variant[String, Integer]

String or integer to set the position in the target file, sorted alpha numeric.

Default value: 50

icinga2::object::hostgroup

Manage Icinga 2 HostGroup objects.

Examples

icinga2::object::hostgroup { 'monitoring-hosts':
  display_name => 'Linux Servers',
  groups       => [ 'linux-servers' ],
  target       => '/etc/icinga2/conf.d/groups2.conf',
  assign       => [ 'host.name == NodeName' ],
}

Parameters

The following parameters are available in the icinga2::object::hostgroup defined type.

ensure

Data type: Enum['absent', 'present']

Set to present enables the object, absent disables it.

Default value: present

display_name

Data type: Optional[String]

A short description of the host group.

Default value: undef

groups

Data type: Optional[Array]

An array of nested group names.

Default value: undef

assign

Data type: Array

Assign host group members using the group rules.

Default value: []

ignore

Data type: Array

Ignore host group members using the group rules.

Default value: []

target

Data type: Stdlib::Absolutepath

Destination config file to store in this object. File will be declared at the first time.

order

Data type: Variant[String, Integer]

String or integer to set the position in the target file, sorted alpha numeric.

Default value: 55

hostgroup_name

Data type: String

Default value: $title

icinga2::object::notification

Manage Icinga 2 notification objects.

Parameters

The following parameters are available in the icinga2::object::notification defined type.

ensure

Data type: Enum['absent', 'present']

Set to present enables the object, absent disables it.

Default value: present

notification_name

Data type: String

Set the Icinga 2 name of the notification object.

Default value: $title

host_name

Data type: Optional[String]

The name of the host this notification belongs to.

Default value: undef

service_name

Data type: Optional[String]

The short name of the service this notification belongs to. If omitted, this notification object is treated as host notification.

Default value: undef

vars

Data type: Optional[Icinga2::CustomAttributes]

A dictionary containing custom attributes that are specific to this service, a string to do operations on this dictionary or an array for multiple use of custom attributes.

Default value: undef

users

Data type: Optional[Variant[String, Array]]

A list of user names who should be notified.

Default value: undef

user_groups

Data type: Optional[Variant[String, Array]]

A list of user group names who should be notified.

Default value: undef

times

Data type: Optional[Hash]

A dictionary containing begin and end attributes for the notification.

Default value: undef

command

Data type: Optional[String]

The name of the notification command which should be executed when the notification is triggered.

Default value: undef

interval

Data type: Optional[Variant[Icinga2::Interval,Pattern[/(host|service)\./]]]

The notification interval (in seconds). This interval is used for active notifications.

Default value: undef

period

Data type: Optional[String]

The name of a time period which determines when this notification should be triggered.

Default value: undef

zone

Data type: Optional[String]

The zone this object is a member of.

Default value: undef

types

Data type: Optional[Variant[Array, String]]

A list of type filters when this notification should be triggered.

Default value: undef

states

Data type: Optional[Variant[Array, String]]

A list of state filters when this notification should be triggered.

Default value: undef

template

Data type: Boolean

Set to true creates a template instead of an object.

Default value: false

apply

Data type: Variant[Boolean, String]

Dispose an apply instead an object if set to 'true'. Value is taken as statement, i.e. 'vhost => config in host.vars.vhosts'.

Default value: false

prefix

Data type: Variant[Boolean, String]

Set notification_name as prefix in front of 'apply for'. Only effects if apply is a string.

Default value: false

apply_target

Data type: Enum['Host', 'Service']

An object type on which to target the apply rule. Valid values are Host and Service.

Default value: 'Host'

import

Data type: Array

Sorted List of templates to include.

Default value: []

target

Data type: Stdlib::Absolutepath

Destination config file to store in this object. File will be declared the first time.

order

Data type: Variant[String, Integer]

String or integer to set the position in the target file, sorted alpha numeric.

Default value: 85

assign

Data type: Array

Default value: []

ignore

Data type: Array

Default value: []

icinga2::object::notificationcommand

Manage Icinga 2 notificationcommand objects.

Parameters

The following parameters are available in the icinga2::object::notificationcommand defined type.

ensure

Data type: Enum['absent', 'present']

Set to present enables the object, absent disables it.

Default value: present

notificationcommand_name

Data type: String

Set the Icinga 2 name of the notificationcommand object.

Default value: $title

command

Data type: Optional[Variant[Array, String]]

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.

Default value: undef

env

Data type: Optional[Hash]

A dictionary of macros which should be exported as environment variables prior to executing the command.

Default value: undef

vars

Data type: Optional[Icinga2::CustomAttributes]

A dictionary containing custom attributes that are specific to this service, a string to do operations on this dictionary or an array for multiple use of custom attributes.

Default value: undef

timeout

Data type: Optional[Integer[1]]

The command timeout in seconds.

Default value: undef

arguments

Data type: Optional[Hash]

A dictionary of command arguments.

Default value: undef

template

Data type: Boolean

Set to true creates a template instead of an object.

Default value: false

import

Data type: Array

Sorted List of templates to include.

Default value: []

target

Data type: Stdlib::Absolutepath

Destination config file to store in this object. File will be declared the first time.

order

Data type: Variant[String, Integer]

String or integer to set the position in the target file, sorted alpha numeric.

Default value: 25

icinga2::object::scheduleddowntime

Manage Icinga 2 scheduleddowntime objects.

Parameters

The following parameters are available in the icinga2::object::scheduleddowntime defined type.

ensure

Data type: Enum['absent', 'present']

Set to present enables the object, absent disables it.

Default value: present

scheduleddowntime_name

Data type: String

Set the Icinga 2 name of the scheduleddowntime object.

Default value: $title

host_name

Data type: Optional[String]

The name of the host this comment belongs to.

Default value: undef

service_name

Data type: Optional[String]

The short name of the service this comment belongs to. If omitted, this comment object is treated as host comment.

Default value: undef

author

Data type: Optional[String]

The author's name.

Default value: undef

comment

Data type: Optional[String]

The comment text.

Default value: undef

fixed

Data type: Optional[Boolean]

Whether this is a fixed downtime.

Default value: undef

duration

Data type: Optional[Icinga2::Interval]

The duration as number.

Default value: undef

ranges

Data type: Optional[Hash]

A dictionary containing information which days and durations apply to this timeperiod.

Default value: undef

apply

Data type: Variant[Boolean, String]

Dispose an apply instead an object if set to 'true'. Value is taken as statement, i.e. 'vhost => config in host.vars.vhosts'.

Default value: false

prefix

Data type: Variant[Boolean, String]

Set scheduleddowntime_name as prefix in front of 'apply for'. Only effects if apply is a string.

Default value: false

apply_target

Data type: Enum['Host', 'Service']

An object type on which to target the apply rule. Valid values are Host and Service.

Default value: 'Host'

assign

Data type: Array

Assign user group members using the group assign rules.

Default value: []

ignore

Data type: Array

Exclude users using the group ignore rules.

Default value: []

target

Data type: Stdlib::Absolutepath

Destination config file to store in this object. File will be declared the first time.

order

Data type: Variant[String, Integer]

String or integer to set the position in the target file, sorted alpha numeric.

Default value: 90

icinga2::object::service

Manage Icinga 2 service objects.

Examples

A service ping is applied to all hosts with a valid ipv4 address.
::icinga2::object::service { 'ping4':
  import        => ['generic-service'],
  apply         => true,
  check_command => 'ping',
  assign        => ['host.address'],
  target        => '/etc/icinga2/zones.d/global-templates/services.conf',
}
A apply Service for (disk_name =>config in host.vars.disks) rule is applied to all Linux hosts with an Icinga Agent. Note in this example it's required that the endpoint (see command_endpoint) and the host object has the same name!
::icinga2::object::service { 'linux_disks':
  import           => ['generic-service'],
  apply            =>  'disk_name => config in host.vars.disks',
  check_command    => 'disk',
  command_endpoint => 'host.name',
  vars             => '+ config',
  assign           => ['host.vars.os == Linux'],
  ignore           => ['host.vars.noagent'],
  target           => '/etc/icinga2/zones.d/global-templates/services.conf',
}

Parameters

The following parameters are available in the icinga2::object::service defined type.

ensure

Data type: Enum['absent', 'present']

Set to present enables the object, absent disables it.

Default value: present

service_name

Data type: String

Set the Icinga 2 name of the service object.

Default value: $title

display_name

Data type: Optional[String]

A short description of the service.

Default value: undef

host_name

Data type: Optional[String]

The host this service belongs to. There must be a Host object with that name.

Default value: undef

groups

Data type: Optional[Array]

The service groups this service belongs to.

Default value: undef

vars

Data type: Optional[Icinga2::CustomAttributes]

A dictionary containing custom attributes that are specific to this service, a string to do operations on this dictionary or an array for multiple use of custom attributes.

Default value: undef

check_command

Data type: Optional[String]

The name of the check command.

Default value: undef

max_check_attempts

Data type: Optional[Integer[1]]

The number of times a service is re-checked before changing into a hard state.

Default value: undef

check_period

Data type: Optional[String]

The name of a time period which determines when this service should be checked.

Default value: undef

check_timeout

Data type: Optional[Icinga2::Interval]

Check command timeout in seconds. Overrides the CheckCommand's timeout attribute.

Default value: undef

check_interval

Data type: Optional[Icinga2::Interval]

The check interval (in seconds). This interval is used for checks when the service is in a HARD state.

Default value: undef

retry_interval

Data type: Optional[Icinga2::Interval]

The retry interval (in seconds). This interval is used for checks when the service is in a SOFT state.

Default value: undef

enable_notifications

Data type: Optional[Boolean]

Whether notifications are enabled.

Default value: undef

enable_active_checks

Data type: Optional[Boolean]

Whether active checks are enabled.

Default value: undef

enable_passive_checks

Data type: Optional[Boolean]

Whether passive checks are enabled.

Default value: undef

enable_event_handler

Data type: Optional[Boolean]

Enables event handlers for this host.

Default value: undef

enable_flapping

Data type: Optional[Boolean]

Whether flap detection is enabled.

Default value: undef

enable_perfdata

Data type: Optional[Boolean]

Whether performance data processing is enabled.

Default value: undef

event_command

Data type: Optional[String]

The name of an event command that should be executed every time the service's state changes or the service is in a SOFT state.

Default value: undef

flapping_threshold_low

Data type: Optional[Integer[1]]

Flapping lower bound in percent for a host to be considered not flapping.

Default value: undef

flapping_threshold_high

Data type: Optional[Integer[1]]

Flapping upper bound in percent for a host to be considered flapping.

Default value: undef

volatile

Data type: Optional[Boolean]

The volatile setting enables always HARD state types if NOT-OK state changes occur.

Default value: undef

zone

Data type: Optional[String]

The zone this object is a member of.

Default value: undef

command_endpoint

Data type: Optional[String]

The endpoint where commands are executed on.

Default value: undef

notes

Data type: Optional[String]

Notes for the service.

Default value: undef

notes_url

Data type: Optional[String]

Url for notes for the service (for example, in notification commands).

Default value: undef

action_url

Data type: Optional[String]

Url for actions for the service (for example, an external graphing tool).

Default value: undef

icon_image

Data type: Optional[Stdlib::Absolutepath]

Icon image for the service. Used by external interfaces only.

Default value: undef

icon_image_alt

Data type: Optional[String]

Icon image description for the service. Used by external interface only.

Default value: undef

template

Data type: Boolean

Set to true creates a template instead of an object.

Default value: false

apply

Data type: Variant[Boolean, String]

Dispose an apply instead an object if set to 'true'. Value is taken as statement, i.e. 'vhost => config in host.vars.vhosts'.

Default value: false

prefix

Data type: Variant[Boolean, String]

Set service_name as prefix in front of 'apply for'. Only effects if apply is a string.

Default value: false

assign

Data type: Array

Assign user group members using the group assign rules.

Default value: []

ignore

Data type: Array

Exclude users using the group ignore rules.

Default value: []

import

Data type: Array

Sorted List of templates to include.

Default value: []

target

Data type: Stdlib::Absolutepath

Destination config file to store in this object. File will be declared the first time.

order

Data type: Variant[String, Integer]

String or integer to set the position in the target file, sorted alpha numeric.

Default value: 60

icinga2::object::servicegroup

Manage Icinga 2 servicegroup objects.

Parameters

The following parameters are available in the icinga2::object::servicegroup defined type.

ensure

Data type: Enum['absent', 'present']

Set to present enables the object, absent disables it.

Default value: present

servicegroup_name

Data type: String

Set the Icinga 2 name of the servicegroup object.

Default value: $title

display_name

Data type: Optional[String]

A short description of the service group.

Default value: undef

groups

Data type: Optional[Array]

An array of nested group names.

Default value: undef

assign

Data type: Array

Assign user group members using the group assign rules.

Default value: []

ignore

Data type: Array

Exclude users using the group ignore rules.

Default value: []

template

Data type: Boolean

Set to true creates a template instead of an object.

Default value: false

import

Data type: Array

Sorted List of templates to include.

Default value: []

target

Data type: Stdlib::Absolutepath

Destination config file to store in this object. File will be declared the first time.

order

Data type: Variant[String, Integer]

String or integer to set the position in the target file, sorted alpha numeric.

Default value: 65

icinga2::object::timeperiod

Manage Icinga 2 timeperiod objects.

Parameters

The following parameters are available in the icinga2::object::timeperiod defined type.

ensure

Data type: Enum['absent', 'present']

Set to present enables the object, absent disables it.

Default value: present

timeperiod_name

Data type: String

Set the Icinga 2 name of the timeperiod object.

Default value: $title

display_name

Data type: Optional[String]

A short description of the time period.

Default value: undef

import

Data type: Array

Sorted List of templates to include.

Default value: ['legacy-timeperiod']

ranges

Data type: Optional[Hash]

A dictionary containing information which days and durations apply to this timeperiod.

Default value: undef

prefer_includes

Data type: Optional[Boolean]

Boolean whether to prefer timeperiods includes or excludes.

Default value: undef

excludes

Data type: Optional[Array]

An array of timeperiods, which should exclude from your timerange.

Default value: undef

includes

Data type: Optional[Array]

An array of timeperiods, which should include into your timerange

Default value: undef

template

Data type: Boolean

Set to true creates a template instead of an object.

Default value: false

target

Data type: Stdlib::Absolutepath

Destination config file to store this object in. File will be declared on the first run.

order

Data type: Variant[String, Integer]

String or integer to control the position in the target file, sorted alpha numeric.

Default value: 35

icinga2::object::user

Manage Icinga 2 user objects.

Parameters

The following parameters are available in the icinga2::object::user defined type.

ensure

Data type: Enum['absent', 'present']

Set to present enables the object, absent disables it.

Default value: present

user_name

Data type: String

Set the Icinga 2 name of the user object.

Default value: $title

display_name

Data type: Optional[String]

A short description of the user.

Default value: undef

email

Data type: Optional[String]

An email string for this user. Useful for notification commands.

Default value: undef

pager

Data type: Optional[String]

A pager string for this user. Useful for notification commands.

Default value: undef

vars

Data type: Optional[Icinga2::CustomAttributes]

A dictionary containing custom attributes that are specific to this service, a string to do operations on this dictionary or an array for multiple use of custom attributes.

Default value: undef

groups

Data type: Optional[Array]

An array of group names.

Default value: undef

enable_notifications

Data type: Optional[Boolean]

Whether notifications are enabled for this user.

Default value: undef

period

Data type: Optional[String]

The name of a time period which determines when a notification for this user should be triggered.

Default value: undef

types

Data type: Optional[Array]

A set of type filters when this notification should be triggered. everything is matched.

Default value: undef

states

Data type: Optional[Array]

A set of state filters when this notification should be triggered.

Default value: undef

template

Data type: Boolean

Set to true creates a template instead of an object.

Default value: false

import

Data type: Array

Sorted List of templates to include.

Default value: []

target

Data type: Stdlib::Absolutepath

Destination config file to store in this object. File will be declared the first time.

order

Data type: Variant[String, Integer]

String or integer to set the position in the target file, sorted alpha numeric.

Default value: 75

icinga2::object::usergroup

Manage Icinga 2 usergroup objects.

Parameters

The following parameters are available in the icinga2::object::usergroup defined type.

ensure

Data type: Enum['absent', 'present']

Set to present enables the object, absent disables it.

Default value: present

usergroup_name

Data type: String

Set the Icinga 2 name of the usergroup object.

Default value: $title

display_name

Data type: Optional[String]

A short description of the service group.

Default value: undef

groups

Data type: Array

An array of nested group names.

Default value: []

assign

Data type: Array

Assign user group members using the group assign rules.

Default value: []

ignore

Data type: Array

Exclude users using the group ignore rules.

Default value: []

template

Data type: Boolean

Set to true creates a template instead of an object.

Default value: false

import

Data type: Array

Sorted List of templates to include.

Default value: []

target

Data type: Stdlib::Absolutepath

Destination config file to store in this object. File will be declared the first time.

order

Data type: Variant[String, Integer]

String or integer to set the position in the target file, sorted alpha numeric.

Default value: 80

icinga2::object::zone

Manage Icinga 2 zone objects.

Parameters

The following parameters are available in the icinga2::object::zone defined type.

ensure

Data type: Enum['absent', 'present']

Set to present enables the object, absent disables it.

Default value: present

zone_name

Data type: String

Set the Icinga 2 name of the zone object.

Default value: $title

endpoints

Data type: Optional[Array]

List of endpoints belong to this zone.

Default value: []

parent

Data type: Optional[String]

Parent zone to this zone.

Default value: undef

global

Data type: Optional[Boolean]

If set to true, a global zone is defined and the parameter endpoints and parent are ignored.

Default value: false

target

Data type: Optional[Stdlib::Absolutepath]

Destination config file to store in this object. File will be declared at the first time.

Default value: undef

order

Data type: Variant[String, Integer]

String or integer to control the position in the target file, sorted alpha numeric.

Default value: 45

Functions

icinga2::icinga2_attributes

Type: Ruby 4.x API

---- original file header ----

icinga2::icinga2_attributes(Any *$args)

---- original file header ----

Returns: Data type Describe what the function returns here

*args

Data type: Any

The original array of arguments. Port this to individually managed params to get the full benefit of the modern function API.

icinga2::icinga2_ticket_id

Type: Ruby 4.x API

---- original file header ----

icinga2::icinga2_ticket_id(Any *$args)

---- original file header ----

Returns: Data type Describe what the function returns here

*args

Data type: Any

The original array of arguments. Port this to individually managed params to get the full benefit of the modern function API.

icinga2_attributes

Type: Ruby 3.x API

Wrapper for config parser

icinga2_attributes()

The icinga2_attributes function.

Returns: Any Parsed config as string

icinga2_ticket_id

Type: Ruby 3.x API

Generates a auth ticket to get a certificate

icinga2_ticket_id()

The icinga2_ticket_id function.

Returns: Any The ticket to get a certificate

Data types

Icinga2::CustomAttributes

A type for the structure of custom attributes

Alias of Optional[Variant[String, Array[Variant[String, Hash]], Hash]]

Icinga2::Fingerprint

Type for certificate fingerprints

Alias of Pattern[/^([0-9a-fA-F]{2}\:){19}[0-9,a-f,A-F]{2}$/]

Icinga2::Interval

A strict type for intervals

Alias of Pattern[/^\d+\.?\d*[d|h|m|s]?$/]

Icinga2::LogFacility

A strict type of syslog facilities

Alias of Variant[Enum['LOG_AUTH', 'LOG_AUTHPRIV', 'LOG_CRON', 'LOG_DAEMON', 'LOG_FTP', 'LOG_KERN', 'LOG_LPR', 'LOG_MAIL', 'LOG_NEWS', 'LOG_SYSLOG', 'LOG_USER', 'LOG_UUCP'], Pattern[/^LOG_LOCAL[0-7]$/]]

Icinga2::LogSeverity

A strict type for log levels

Alias of Enum['debug', 'information', 'notice', 'warning', 'critical']