Defined Type: sensu::subscription

Defined in:
manifests/subscription.pp

Summary

Manages Sensu subscriptions

Overview

This define manages Sensu subscriptions

Parameters:

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

    Whether the check should be present or not

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

    Custom client variables



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'manifests/subscription.pp', line 9

define sensu::subscription (
  Enum['present','absent'] $ensure = 'present',
  Hash $custom                     = {},
) {

  include ::sensu

  # Remove any from title any char which is not a letter, a number
  # or the . and - chars. Needed for safe path names.
  $sanitized_name=regsubst($name, '[^0-9A-Za-z.-]', '_', 'G')

  file { "${::sensu::conf_dir}/subscription_${sanitized_name}.json":
    ensure => $ensure,
    owner  => $::sensu::user,
    group  => $::sensu::group,
    mode   => $::sensu::file_mode,
    before => Sensu_client_subscription[$name],
  }

  sensu_client_subscription { $name:
    ensure    => $ensure,
    base_path => $::sensu::conf_dir,
    file_name => "subscription_${sanitized_name}.json",
    custom    => $custom,
    notify    => $::sensu::client_service,
  }
}