Puppet Class: prometheus::php_fpm_exporter

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

Overview

Parameters:

  • port (Wmflib::UserIpPort)
  • fcgi_endpoint (Optional[String]) (defaults to: undef)
  • http_endpoint (Optional[Stdlib::Httpurl]) (defaults to: undef)


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

class prometheus::php_fpm_exporter (
    Wmflib::UserIpPort $port,
    Optional[String] $fcgi_endpoint = undef,
    Optional[Stdlib::Httpurl] $http_endpoint = undef,
) {
    if $fcgi_endpoint == undef and $http_endpoint == undef {
        fail('You need to set either `fcgi_endpoint` or `http_endpoint`')
    }
    $sw_name = 'prometheus-php-fpm-exporter'
    $listen_address = "${::ipaddress}:${port}"
    package { $sw_name:
        ensure => present,
    }

    file { '/etc/default/prometheus-php-fpm-exporter':
        ensure  => present,
        mode    => '0444',
        owner   => 'root',
        group   => 'root',
        content => template('prometheus/php-fpm-exporter.default.erb'),
        notify  => Service[$sw_name],
    }

    # We need to run as www-data so we can access php-fpm if it's running via
    # a unix socket
    systemd::service { $sw_name:
        ensure   => present,
        content  => "[Service]\nUser=www-data",
        override => true,
        restart  => true,
        require  => Package[$sw_name],
    }

    base::service_auto_restart { $sw_name: }
}