Puppet Class: prometheus::node_puppet_agent

Defined in:
modules/prometheus/manifests/node_puppet_agent.pp

Overview

Parameters:

  • ensure (Wmflib::Ensure) (defaults to: 'present')
  • outfile (Stdlib::AbsolutePath) (defaults to: '/var/lib/prometheus/node.d/puppet_agent.prom')


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
# File 'modules/prometheus/manifests/node_puppet_agent.pp', line 6

class prometheus::node_puppet_agent (
    Wmflib::Ensure $ensure = 'present',
    Stdlib::AbsolutePath $outfile = '/var/lib/prometheus/node.d/puppet_agent.prom',
) {
    if !($outfile =~ /\.prom$/) {
        fail("\$outfile should end with '.prom' but is [${outfile}]")
    }

    require_package(['python-prometheus-client', 'python-yaml'])

    file { '/usr/local/bin/prometheus-puppet-agent-stats':
        ensure => file,
        mode   => '0555',
        owner  => 'root',
        group  => 'root',
        source => 'puppet:///modules/prometheus/usr/local/bin/prometheus-puppet-agent-stats.py',
    }

    # Collect every minute
    cron { 'prometheus_puppet_agent_stats':
        ensure  => $ensure,
        user    => 'prometheus',
        command => "/usr/local/bin/prometheus-puppet-agent-stats --outfile ${outfile}",
    }
}