Puppet Class: xdmod::supremm::compute::pcp

Defined in:
manifests/supremm/compute/pcp.pp

Summary

Manage XDMoD compute PCP

Overview



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
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'manifests/supremm/compute/pcp.pp', line 3

class xdmod::supremm::compute::pcp {
  if $xdmod::pcp_merge_metrics {
    $pcp_static_metrics   = lookup('xdmod::pcp_static_metrics', Array, 'unique', $xdmod::pcp_static_metrics)
    $pcp_standard_metrics = lookup('xdmod::pcp_standard_metrics', Array, 'unique', $xdmod::pcp_standard_metrics)
    $pcp_environ_metrics  = lookup('xdmod::pcp_environ_metrics', Array, 'unique', $xdmod::pcp_environ_metrics)
  } else {
    $pcp_static_metrics   = $xdmod::pcp_static_metrics
    $pcp_standard_metrics = $xdmod::pcp_standard_metrics
    $pcp_environ_metrics  = $xdmod::pcp_environ_metrics
  }

  if $xdmod::pcp_pmlogger_config_source {
    $_pcp_pmlogger_config_source  = $xdmod::pcp_pmlogger_config_source
    $_pcp_pmlogger_config_content = undef
  } else {
    $_pcp_pmlogger_config_source  = undef
    $_pcp_pmlogger_config_content = template($xdmod::pcp_pmlogger_config_template)
  }

  case $xdmod::pcp_declare_method {
    'include': {
      include pcp
    }
    'resource': {
      class { 'pcp':
        include_default_pmlogger => false,
        pmlogger_daily_args      => '-M -k forever',
        package_ensure           => $xdmod::params::pcp_package_ensure,
      }
    }
    default: {
      # Do nothing
    }
  }

  $resource = $xdmod::supremm_resources.filter |$r| {
    $r['resource'] == $xdmod::pcp_resource
  }
  if $resource[0] {
    if $xdmod::pcp_pmlogger_path_suffix {
      $log_dir = "${resource[0]['pcp_log_dir']}/LOCALHOSTNAME/${xdmod::pcp_pmlogger_path_suffix}"
    } else {
      $log_dir = "${resource[0]['pcp_log_dir']}/LOCALHOSTNAME"
    }
  } else {
    fail('xdmod::supremm::compute::pcp unable to determine resource')
  }

  file { '/etc/pcp/pmlogger/control.d/timeouts':
    ensure  => 'file',
    owner   => 'root',
    group   => 'root',
    mode    => '0644',
    content => join([
        '# File managed by Puppet',
        '$PMCD_CONNECT_TIMEOUT=150; export PMCD_CONNECT_TIMEOUT',
        '$PMCD_REQUEST_TIMEOUT=120; export PMCD_REQUEST_TIMEOUT',
    ], "\n"),
    require => Class['pcp::config'],
    notify  => Service['pmlogger'],
  }

  pcp::pmlogger { 'supremm':
    ensure         => 'present',
    hostname       => 'LOCALHOSTNAME',
    primary        => true,
    socks          => false,
    log_dir        => $log_dir,
    args           => '-r',
    config_path    => '/etc/pcp/pmlogger/pmlogger-supremm.config',
    config_content => $_pcp_pmlogger_config_content,
    config_source  => $_pcp_pmlogger_config_source,
  }

  $_all_metrics = union($pcp_static_metrics, $pcp_standard_metrics)

  pcp::pmda { 'nfsclient':
    ensure => xdmod::member_substring($_all_metrics, '^nfsclient'),
  }

  pcp::pmda { 'infiniband':
    ensure => xdmod::member_substring($_all_metrics, '^infiniband'),
  }

  pcp::pmda { 'perfevent':
    ensure => xdmod::member_substring($_all_metrics, '^perfevent'),
  }

  pcp::pmda { 'slurm':
    ensure => xdmod::member_substring($_all_metrics, '^slurm'),
  }

  pcp::pmda { 'mic':
    ensure => xdmod::member_substring($_all_metrics, '^mic'),
  }

  pcp::pmda { 'nvidia':
    ensure       => xdmod::member_substring($_all_metrics, '^nvidia'),
    package_name => 'pcp-pmda-nvidia-gpu',
  }

  pcp::pmda { 'gpfs':
    ensure => xdmod::member_substring($_all_metrics, '^gpfs'),
  }

  pcp::pmda { 'proc':
    has_package    => false,
    config_path    => '/var/lib/pcp/pmdas/proc/hotproc.conf',
    config_content => template('xdmod/supremm/compute/pcp/hotproc.conf.erb'),
    args           => '-A',
  }
}