Defined Type: pcp::pmie

Defined in:
manifests/pmie.pp

Summary

Configure a pmie

Overview

Parameters:

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

    The pmie ensure property. Valid values are present and absent. Default is present.

  • hostname (String) (defaults to: 'LOCALHOSTNAME')

    Hostname associated with the pmie. Default is 'LOCALHOSTNAME'.

  • primary (Boolean) (defaults to: false)

    Boolean that sets if this pmie is primary. Default is false.

  • socks (Boolean) (defaults to: false)

    Boolean that sets if this pmie uses pmsocks. Default is false.

  • log_file (String) (defaults to: 'PCP_LOG_DIR/pmie/LOCALHOSTNAME/pmie.log')

    The pmie control log file. Default is PCP_LOG_DIR/pmie/LOCALHOSTNAME/pmie.log

  • args (String) (defaults to: '')

    Args passed to pmie. Default is an empty string.

  • config_path (Optional[Stdlib::Absolutepath]) (defaults to: undef)

    Config path for the pmie. If defined the value is passed as -c value to the pmie arguments. Default is undef.

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

    The pmie config contents. Default is undef.

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

    The pmie config source. Default is undef.



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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'manifests/pmie.pp', line 28

define pcp::pmie (
  Enum['present', 'absent'] $ensure             = 'present',
  String $hostname                              = 'LOCALHOSTNAME',
  Boolean $primary                              = false,
  Boolean $socks                                = false,
  String $log_file                              = 'PCP_LOG_DIR/pmie/LOCALHOSTNAME/pmie.log',
  String $args                                  = '', # lint:ignore:params_empty_string_assignment
  Optional[Stdlib::Absolutepath] $config_path   = undef,
  Optional[String] $config_content              = undef,
  Optional[String] $config_source               = undef,
) {
  include pcp

  Class['pcp::install'] -> Pcp::Pmie[$title]

  if $primary {
    $_primary = 'y'
  } else {
    $_primary = 'n'
  }

  if $socks {
    $_socks = 'y'
  } else {
    $_socks = 'n'
  }

  if $config_path {
    $_args = "${args} -c ${config_path}"
  } else {
    $_args = $args
  }

  $_pmie_config_path = "/etc/pcp/pmie/control.d/${name}"
  $_line = "#This file is managed by Puppet\n${hostname} ${_primary} ${_socks} ${log_file} ${_args}\n"

  file { "pmie-${name}":
    ensure  => $ensure,
    path    => $_pmie_config_path,
    owner   => 'root',
    group   => 'root',
    mode    => '0644',
    content => $_line,
    notify  => Service['pmie'],
  }

  if $config_path {
    file { "pmie-${name}-config":
      ensure  => $ensure,
      path    => $config_path,
      owner   => 'root',
      group   => 'root',
      mode    => '0644',
      content => $config_content,
      source  => $config_source,
      notify  => Service['pmie'],
      before  => File["pmie-${name}"],
    }
  }
}