Defined Type: sensuclassic::contact

Defined in:
manifests/contact.pp

Summary

Manages contact routing

Overview

Manage [Contact Routing](sensuapp.org/docs/latest/enterprise/contact-routing.html) 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 sensuclassic_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 sensuclassic::contact (
  Enum['present','absent'] $ensure = 'present',
  Optional[String] $base_path = undef,
  Hash $config = {},
) {

  include sensuclassic

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

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

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