Puppet Class: prometheus::node_arelion

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

Overview

Parameters:

  • active_server (Stdlib::Fqdn)
  • username (String)
  • password (String)
  • client_id (String)
  • client_secret (String)
  • outfile (Stdlib::Unixpath) (defaults to: '/var/lib/prometheus/node.d/arelion.prom')


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

class prometheus::node_arelion (
    Stdlib::Fqdn     $active_server,
    String           $username,
    String           $password,
    String           $client_id,
    String           $client_secret,
    Stdlib::Unixpath $outfile = '/var/lib/prometheus/node.d/arelion.prom',
) {
    if $outfile !~ '\.prom$' {
        fail("outfile (${outfile}): Must have a .prom extension")
    }

    stdlib::ensure_packages( [
        'python3-prometheus-client',
        'python3-requests',
    ] )

    file { '/usr/local/bin/prometheus-arelion-exporter':
        ensure  => file,
        mode    => '0555',
        content => template('prometheus/usr/local/bin/prometheus-arelion-exporter.py.erb'),
    }

    $timer_ensure = ($active_server == $facts['networking']['fqdn']) ? {
        true    => 'present',
        default => 'absent',
    }
    # Collect every minute
    systemd::timer::job { 'prometheus_arelion_exporter':
        ensure      => $timer_ensure,
        description => 'Regular job to collect Arelion data',
        user        => 'root',
        command     => "/usr/local/bin/prometheus-arelion-exporter --outfile ${outfile}",
        interval    => {'start' => 'OnCalendar', 'interval' => 'minutely'},
    }
}