Defined Type: sensu::contact

Defined in:
manifests/contact.pp

Summary

Manages contact routing

Overview

Manage Contact Routing configuration with Sensu Enterprise.

Note: If the sensu::purge_config class parameter is true, unmanaged sensu::contact resources located in /etc/sensu/conf.d/contacts will be purged.

Parameters:

  • ensure (Enum['present','absent']) (defaults to: 'present')

    Whether the check should be present or not

  • base_path (Optional[String]) (defaults to: undef)

    Where to place the contact JSON configuration file. Defaults to undef which defers to the behavior of the underlying sensu_contact type.

  • config (Hash) (defaults to: {})

    The configuration data for the contact. This is an arbitrary hash to accommodate the various communication channels. For example, { "email": { "to": "support@example.com" } }.



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'manifests/contact.pp', line 19

define sensu::contact(
  Enum['present','absent'] $ensure = 'present',
  Optional[String] $base_path = undef,
  Hash $config = {},
) {

  include ::sensu

  $file_ensure = $ensure ? {
    'absent' => 'absent',
    default  => 'file'
  }

  # handler configuration may contain "secrets"
  file { "${::sensu::conf_dir}/contacts/${name}.json":
    ensure => $file_ensure,
    owner  => $::sensu::user,
    group  => $::sensu::group,
    mode   => $::sensu::config_file_mode,
    before => Sensu_contact[$name],
  }

  sensu_contact { $name:
    ensure    => $ensure,
    config    => $config,
    base_path => $base_path,
    require   => File["${::sensu::conf_dir}/contacts/${name}.json"],
  }
}