Puppet Class: profile::wmcs::prometheus

Defined in:
modules/profile/manifests/wmcs/prometheus.pp

Overview

Parameters:

  • targets_path (Any) (defaults to: '/srv/prometheus/labs/targets')
  • storage_retention (Any) (defaults to: hiera('prometheus::server::storage_retention', '4032h'))
  • max_chunks_to_persist (Any) (defaults to: hiera('prometheus::server::max_chunks_to_persist', '524288'))
  • memory_chunks (Any) (defaults to: hiera('prometheus::server::memory_chunks', '1048576'))


1
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'modules/profile/manifests/wmcs/prometheus.pp', line 1

class profile::wmcs::prometheus(
    $targets_path = '/srv/prometheus/labs/targets',
    $storage_retention = hiera('prometheus::server::storage_retention', '4032h'),
    $max_chunks_to_persist = hiera('prometheus::server::max_chunks_to_persist', '524288'),
    $memory_chunks = hiera('prometheus::server::memory_chunks', '1048576'),
) {
    include ::prometheus::blackbox_exporter
    $blackbox_jobs = [
        {
            'job_name'        => 'blackbox_http',
            'metrics_path'    => '/probe',
            'params'          => {
                'module' => [ 'http_200_300_connect' ],
            },
            'file_sd_configs' => [
                { 'files' => [ "${targets_path}/blackbox_http_*.yaml" ] }
            ],
            'relabel_configs' => [
                { 'source_labels' => ['__address__'],
                    'target_label'  => '__param_target',
                },
                { 'source_labels' => ['__param_target'],
                    'target_label'  => 'instance',
                },
                { 'target_label' => '__address__',
                    'replacement'  => '127.0.0.1:9115',
                },
              ],
        },
    ]

    $rabbitmq_jobs = [
        {
            'job_name'        => 'rabbitmq',
            'scheme'          => 'http',
            'file_sd_configs' => [
                { 'files' => [ "${targets_path}/rabbitmq_*.yaml" ] }
            ],
        },
    ]

    $pdns_jobs = [
        {
            'job_name'        => 'pdns',
            'scheme'          => 'http',
            'file_sd_configs' => [
                { 'files' => [ "${targets_path}/pdns_*.yaml" ] }
            ],
        },
    ]

    $pdns_rec_jobs = [
        {
            'job_name'        => 'pdns_rec',
            'scheme'          => 'http',
            'file_sd_configs' => [
                { 'files' => [ "${targets_path}/pdns-rec_*.yaml" ] }
            ],
        },
    ]

    $openstack_jobs = [
        {
            'job_name'        => 'openstack',
            'scheme'          => 'http',
            'file_sd_configs' => [
                { 'files' => [ "${targets_path}/openstack_*.yaml" ] }
            ],
        },
    ]

    file { "${targets_path}/blackbox_http_keystone.yaml":
      content => ordered_yaml([{
        'targets' => ['cloudcontrol1003.wikimedia.org:5000/v3', # keystone
                      'cloudcontrol1003.wikimedia.org:9292', # glance
                      'cloudcontrol1003.wikimedia.org:8774', # nova
                      'cloudservices1003.wikimedia.org:9001', # designate
                      'cloudnet1003.eqiad.wmnet:9696', # neutron
                      'proxy-eqiad1.wmflabs.org:5668', # proxy
            ]
        }]),
    }

    prometheus::class_config{ "rabbitmq_${::site}":
        dest       => "${targets_path}/rabbitmq_${::site}.yaml",
        site       => $::site,
        class_name => 'role::wmcs::openstack::eqiad1::control',
        port       => 9195,
    }

    prometheus::class_config{ "pdns_${::site}":
        dest       => "${targets_path}/pdns_${::site}.yaml",
        site       => $::site,
        class_name => 'role::wmcs::openstack::eqiad1::services_primary',
        port       => 9192,
    }

    prometheus::class_config{ "pdns-rec_${::site}":
        dest       => "${targets_path}/pdns-rec_${::site}.yaml",
        site       => $::site,
        class_name => 'role::wmcs::openstack::eqiad1::services_primary',
        port       => 9199,
    }

    prometheus::class_config{ "openstack_${::site}":
        dest       => "${targets_path}/openstack_${::site}.yaml",
        site       => $::site,
        class_name => 'role::wmcs::openstack::eqiad1::control',
        # same as profile::openstack::eqiad1::metrics::prometheus_listen_port and friends
        port       => 12345,
    }

    prometheus::server { 'labs':
        listen_address        => ':9900',
        storage_retention     => $storage_retention,
        max_chunks_to_persist => $max_chunks_to_persist,
        memory_chunks         => $memory_chunks,
        scrape_configs_extra  => array_concat(
            $blackbox_jobs, $rabbitmq_jobs, $pdns_jobs,
            $pdns_rec_jobs, $openstack_jobs,
        ),
    }

    prometheus::web { 'labs':
        proxy_pass => 'http://localhost:9900/labs',
    }


    ferm::service { 'prometheus-web':
        proto  => 'tcp',
        port   => '80',
        srange => '$DOMAIN_NETWORKS',
    }
}