Puppet Class: collectd::plugin::write_http

Defined in:
manifests/plugin/write_http.pp

Summary

Enable write_http plugin

Overview

Parameters:

  • ensure (Enum['present', 'absent']) (defaults to: 'present')
  • nodes (Hash[String, Hash[String, Scalar]]) (defaults to: {})
  • urls (Hash[String, Hash[String, Scalar]]) (defaults to: {})
  • manage_package (Optional[Boolean]) (defaults to: undef)

See Also:



7
8
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
36
37
38
39
40
41
42
43
# File 'manifests/plugin/write_http.pp', line 7

class collectd::plugin::write_http (
  Enum['present', 'absent']          $ensure = 'present',
  Hash[String, Hash[String, Scalar]] $nodes = {},
  Hash[String, Hash[String, Scalar]] $urls  = {},
  Optional[Boolean]                  $manage_package = undef,
) {
  include collectd

  if !empty($nodes) and !empty($urls) {
    fail('Only one of nodes or urls is supposed to be defined')
  }

  if $manage_package !~ Undef {
    $_manage_package = $manage_package
  } else {
    if $facts['os']['family'] == 'RedHat' and versioncmp($facts['os']['release']['major'],'8') >= 0 {
      $_manage_package = true
    } else {
      $_manage_package = false
    }
  }
  if $_manage_package {
    package { 'collectd-write_http':
      ensure => $ensure,
    }
  }

  $endpoints = merge($nodes, $urls)
  collectd::plugin { 'write_http':
    ensure  => $ensure,
    content => epp('collectd/plugin/write_http.conf.epp',
      {
        'endpoints' => $endpoints
      }
    ),
  }
}