Puppet Class: prometheus::cadvisor

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

Overview

SPDX-License-Identifier: Apache-2.0

Parameters:

  • ensure (Wmflib::Ensure)
  • port (Stdlib::Port)
  • metrics_enabled_extra (Array[Prometheus::Cadvisor::Metric]) (defaults to: [])
  • listen_address (Stdlib::IP::Address) (defaults to: $facts['wmflib']['is_container'])


2
3
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/cadvisor.pp', line 2

class prometheus::cadvisor(
    Wmflib::Ensure                      $ensure,
    Stdlib::Port                        $port,
    Array[Prometheus::Cadvisor::Metric] $metrics_enabled_extra = [],
    Stdlib::IP::Address                 $listen_address = $facts['wmflib']['is_container'] ? {
                                            true  => '0.0.0.0',
                                            false => $facts['networking']['ip'],
                                        },
) {
    # Taken by subtracting the default for -disable_metrics from the
    # list of all valid metrics
    $metrics_enabled_default = [
        'accelerator',
        'app',
        'cpu',
        'disk',
        'diskIO',
        'memory',
        'network',
        'oom_event',
        'perf_event',
    ]

    $metrics_enabled = assert_type(Array[Prometheus::Cadvisor::Metric],
        $metrics_enabled_default + $metrics_enabled_extra)

    package { 'cadvisor':
        ensure => $ensure,
    }

    systemd::service { 'cadvisor':
        ensure    => $ensure,
        content   => init_template('cadvisor', 'systemd_override'),
        override  => true,
        restart   => true,
        subscribe => Package['cadvisor'],
    }
}