Puppet Class: profile::prometheus::node_directory_size

Defined in:
modules/profile/manifests/prometheus/node_directory_size.pp

Overview

Parameters:

  • ensure (Any) (defaults to: hiera('profile::prometheus::node_directory_size::ensure', 'present'))
  • directory_size_paths (Any) (defaults to: hiera('profile::prometheus::node_directory_size::directory_size_paths', {}))
  • outfile (Any) (defaults to: hiera('profile::prometheus::node_directory_size::outfile', '/var/lib/prometheus/node.d/node_directory_size_bytes'))


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
# File 'modules/profile/manifests/prometheus/node_directory_size.pp', line 14

class profile::prometheus::node_directory_size (
  $ensure = hiera('profile::prometheus::node_directory_size::ensure', 'present'),
  $directory_size_paths = hiera('profile::prometheus::node_directory_size::directory_size_paths', {}),
  $outfile = hiera('profile::prometheus::node_directory_size::outfile', '/var/lib/prometheus/node.d/node_directory_size_bytes'),
) {

  if ($ensure == 'absent') {
    file { "${outfile}.prom":
      ensure => 'absent'
    }
  }

  file { '/usr/local/bin/prometheus-directory-size':
    ensure => $ensure,
    mode   => '0555',
    owner  => 'root',
    group  => 'root',
    source => 'puppet:///modules/profile/prometheus/node-directory-size.sh'
  }

  file { '/etc/default/prometheus-directory-size':
    ensure  => $ensure,
    mode    => '0555',
    owner   => 'root',
    group   => 'root',
    content => template('profile/prometheus/node-directory-size.erb')
  }

  # Collect once a day
  cron { 'prometheus_directorysize':
    ensure  => $ensure,
    user    => 'root',
    hour    => '3',
    minute  => '30',
    command => '/usr/local/bin/prometheus-directory-size -c /etc/default/prometheus-directory-size',
  }
}