File: curl_json.pp

package info (click to toggle)
puppet-module-voxpupuli-collectd 11.0.0-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 2,308 kB
  • sloc: ruby: 8,119; python: 30; sh: 10; makefile: 4
file content (58 lines) | stat: -rw-r--r-- 1,589 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# See http://collectd.org/documentation/manpages/collectd.conf.5.shtml#plugin_curl_json
define collectd::plugin::curl_json (
  $url,
  $instance,
  Hash $keys,
  $ensure         = 'present',
  $host           = undef,
  $interval       = undef,
  $user           = undef,
  $password       = undef,
  $digest         = undef,
  $verifypeer     = undef,
  $verifyhost     = undef,
  $cacert         = undef,
  $header         = undef,
  $post           = undef,
  $timeout        = undef,
  $order          = '10',
  $manage_package = undef,
) {

  include collectd

  $_manage_package = pick($manage_package, $collectd::manage_package)

  if $_manage_package {
    if $facts['os']['family'] == 'Debian' {
      $libyajl_package = $facts['os']['distro']['codename'] ? {
        'precise' => 'libyajl1',
        default   => 'libyajl2'
      }
      ensure_packages($libyajl_package)
    }

    if $facts['os']['family'] == 'RedHat' {
      ensure_packages('collectd-curl_json')
    }
  }

  $conf_dir = $collectd::plugin_conf_dir

  # This is deprecated file naming ensuring old style file removed, and should be removed in next major relese
  file { "${name}.load-deprecated":
    ensure => absent,
    path   => "${conf_dir}/${name}.conf",
  }
  # End deprecation

  file {
    "${name}.load":
      path    => "${conf_dir}/${order}-${name}.conf",
      owner   => $collectd::config_owner,
      group   => $collectd::config_group,
      mode    => $collectd::config_mode,
      content => template('collectd/curl_json.conf.erb'),
      notify  => Service[$collectd::service_name],
  }
}