Defined Type: prometheus::jmx_exporter_config

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

Overview

Parameters

dest

Path to jmx exporter config file to render.

class_name

Class name to search. All nodes with this class declared will be searched for jmx_exporter_instance titles that match $instance_selector.

instance_selector

Regex to select jmx_exporter_instances by title. Default: .*

labels

Hash of labels to attach to every host. 'cluster' will be added automatically as well.

Parameters:

  • dest (String)
  • class_name (String)
  • instance_selector (String) (defaults to: '.*')
  • labels (Hash) (defaults to: {})


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

define prometheus::jmx_exporter_config(
    String $dest,
    String $class_name,
    String $instance_selector = '.*',
    Hash   $labels            = {},
) {

    $_class_name = wmflib::resource::capitalize($class_name)
    $pql = @("PQL")
    resources[certname, parameters] {
        type = "Prometheus::Jmx_exporter_instance" and title ~ "${instance_selector}" and
        nodes { resources { type =  "Class" and title = "${_class_name}" } }
        order by parameters
    }
    | PQL
    $resources = wmflib::puppetdb_query($pql)
    $site_clusters = wmflib::get_clusters({'site' => [$::site]})

    file { $dest:
        ensure  => present,
        owner   => 'root',
        group   => 'root',
        mode    => '0444',
        content => template('prometheus/jmx_exporter_config.erb'),
    }
}