Defined Type: pcp::pmlogger

Defined in:
manifests/pmlogger.pp

Summary

Configure a pmlogger

Overview

Parameters:

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

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

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

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

  • primary (Boolean) (defaults to: false)

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

  • socks (Boolean) (defaults to: false)

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

  • log_dir (String) (defaults to: 'PCP_LOG_DIR/pmlogger/LOCALHOSTNAME')

    Log directory for this pmlogger. Default is PCP_LOG_DIR/pmlogger/LOCALHOSTNAME.

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

    Arguments passed to pmlogger. Default is an empty string.

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

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

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

    The pmlogger config contents. Default is undef.

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

    The pmlogger config source. Default is undef.



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
88
89
90
91
92
93
94
95
96
97
98
99
# File 'manifests/pmlogger.pp', line 34

define pcp::pmlogger (
  Enum['present', 'absent'] $ensure             = 'present',
  String $hostname                              = 'LOCALHOSTNAME',
  Boolean $primary                              = false,
  Boolean $socks                                = false,
  String $log_dir                               = 'PCP_LOG_DIR/pmlogger/LOCALHOSTNAME',
  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::Pmlogger[$title]

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

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

  if $log_dir =~ /\$/ {
    $_log_dir = "\"${log_dir}\""
  } else {
    $_log_dir = $log_dir
  }

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

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

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

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