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_regular_mtu (Hash[Stdlib::Fqdn, Stdlib::IP::Address::Nosubnet]) (defaults to: {})
  • nodes_to_ping_jumbo_mtu (Hash[Stdlib::Fqdn, Stdlib::IP::Address::Nosubnet]) (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
33
34
35
36
37
38
39
# File 'modules/prometheus/manifests/node_pinger.pp', line 4

class prometheus::node_pinger (
    Hash[Stdlib::Fqdn, Stdlib::IP::Address::Nosubnet] $nodes_to_ping_regular_mtu = {},
    Hash[Stdlib::Fqdn, Stdlib::IP::Address::Nosubnet] $nodes_to_ping_jumbo_mtu = {},
    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',
        content => epp(
            'prometheus/usr/local/bin/prometheus_node_pinger.sh',
            {
                nodes_to_ping_regular_mtu => $nodes_to_ping_regular_mtu,
                nodes_to_ping_jumbo_mtu   => $nodes_to_ping_jumbo_mtu,
            },
        ),
    }
    if !empty($nodes_to_ping_jumbo_mtu + $nodes_to_ping_regular_mtu) {
        systemd::timer::job { 'prometheus-node-pinger':
            ensure         => $ensure,
            user           => 'root',
            description    => 'Generate prometheus network latency metrics with pings',
            command        => $script,
            stdout         => "file:${outfile}",
            exec_start_pre => "/usr/bin/rm -f ${outfile}",
            interval       => {
                'start'    => 'OnCalendar',
                'interval' => 'minutely',
            },
            require        => [File[$script], Class['prometheus::node_exporter'],]
        }
    }
}