Defined Type: prometheus::trafficserver_exporter

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

Overview

Parameters:

  • instance_name (String) (defaults to: 'backend')
  • endpoint (Stdlib::HTTPUrl) (defaults to: 'http://127.0.0.1/_stats')
  • listen_port (Wmflib::UserIpPort) (defaults to: 9122)
  • verify_ssl_certificate (Boolean) (defaults to: true)


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

define prometheus::trafficserver_exporter (
    String $instance_name = 'backend',
    Stdlib::HTTPUrl $endpoint  = 'http://127.0.0.1/_stats',
    Wmflib::UserIpPort $listen_port = 9122,
    Boolean $verify_ssl_certificate = true,
) {
    require_package('prometheus-trafficserver-exporter')

    $service_name = "prometheus-trafficserver-${instance_name}-exporter"
    $metrics_file = '/etc/prometheus-trafficserver-exporter-metrics.yaml'
    if !defined(File[$metrics_file]) {
        file { $metrics_file:
            ensure => present,
            source => 'puppet:///modules/prometheus/trafficserver_exporter/metrics.yaml',
        }
    }

    systemd::service { $service_name:
        ensure  => present,
        restart => true,
        content => systemd_template('prometheus-trafficserver-exporter@'),
    }

    File[$metrics_file] ~> Service[$service_name]

    monitoring::service { "trafficserver_${instance_name}_exporter_check_http":
        description   => "Ensure traffic_exporter binds on port ${listen_port} and responds to HTTP requests",
        check_command => "check_http_port_url!${listen_port}!/",
        notes_url     => 'https://wikitech.wikimedia.org/wiki/Apache_Traffic_Server',
    }

    base::service_auto_restart { $service_name: }
}