Puppet Class: prometheus::node_pinger

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

Overview

Simple latency statistics pinging a different nodes

Parameters:

  • nodes_to_ping (Array[Stdlib::Fqdn]) (defaults to: [])
  • ensure (Wmflib::Ensure) (defaults to: 'present')
  • outfile (Stdlib::Unixpath) (defaults to: '/var/lib/prometheus/node.d/node_pinger.prom')


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

class prometheus::node_pinger (
    Array[Stdlib::Fqdn] $nodes_to_ping = [],
    Wmflib::Ensure $ensure  = 'present',
    Stdlib::Unixpath $outfile = '/var/lib/prometheus/node.d/node_pinger.prom',
) {
    $script = '/usr/local/bin/prometheus-node-pinger'
    file { $script:
        ensure => $ensure,
        mode   => '0555',
        owner  => 'root',
        group  => 'root',
        source => 'puppet:///modules/prometheus/usr/local/bin/prometheus_node_pinger.sh',
    }
    if !empty($nodes_to_ping) {
        systemd::timer::job { 'prometheus-node-pinger':
            ensure         => $ensure,
            user           => 'root',
            description    => 'Generate prometheus network latency metrics with pings',
            command        => "${script} ${nodes_to_ping.join(' ')}",
            stdout         => "file:${outfile}",
            exec_start_pre => "/usr/bin/rm -f ${outfile}",
            interval       => {
                'start'    => 'OnCalendar',
                'interval' => 'minutely',
            },
            require        => [File[$script], Class['prometheus::node_exporter'],]
        }
    }
}