Puppet Class: prometheus::systemd_exporter

Inherits:
prometheus
Defined in:
manifests/systemd_exporter.pp

Summary

This module manages prometheus node redis_exporter

Overview

Parameters:

  • arch (String[1]) (defaults to: $prometheus::real_arch)

    Architecture (amd64 or i386)

  • bin_dir (String[1]) (defaults to: $prometheus::bin_dir)

    Directory where binaries are located

  • download_extension (String) (defaults to: 'tar.gz')

    Extension for the release binary archive

  • download_url (Optional[Prometheus::Uri]) (defaults to: undef)

    Complete URL corresponding to the where the release binary archive can be downloaded

  • download_url_base (Prometheus::Uri) (defaults to: 'https://github.com/povilasv/systemd_exporter/releases')

    Base URL for the binary archive

  • extra_groups (Array[String]) (defaults to: [])

    Extra groups to add the binary user to

  • extra_options (String) (defaults to: '')

    Extra options added to the startup command For a full list of the exporter’s supported extra options please refer to github.com/oliver006/redis_exporter

  • group (String[1]) (defaults to: 'systemd-exporter')

    Group under which the binary is running

  • init_style (Prometheus::Initstyle) (defaults to: $facts['service_provider'])

    Service startup scripts style (e.g. rc, upstart or systemd)

  • install_method (Prometheus::Install) (defaults to: $prometheus::install_method)

    Installation method: url or package (only url is supported currently)

  • manage_group (Boolean) (defaults to: true)

    Whether to create a group for or rely on external code for that

  • manage_service (Boolean) (defaults to: true)

    Should puppet manage the service? (default true)

  • manage_user (Boolean) (defaults to: true)

    Whether to create user or rely on external code for that

  • namespace (String[1]) (defaults to: 'systemd')

    Namespace for the metrics, defaults to ‘redis`.

  • os (String[1]) (defaults to: downcase($facts['kernel']))

    Operating system (linux is the only one supported)

  • package_name (String[1]) (defaults to: 'systemd_exporter')

    The binary package name - not available yet

  • purge_config_dir (Boolean) (defaults to: true)

    Purge config files no longer generated by Puppet

  • restart_on_change (Boolean) (defaults to: true)

    Should puppet restart the service on configuration change? (default true)

  • service_enable (Boolean) (defaults to: true)

    Whether to enable the service from puppet (default true)

  • service_ensure (Stdlib::Ensure::Service) (defaults to: 'running')

    State ensured for the service (default ‘running’)

  • service_name (String[1]) (defaults to: 'systemd_exporter')

    Name of the node exporter service (default ‘redis_exporter’)

  • user (String[1]) (defaults to: 'systemd-exporter')

    User which runs the service

  • version (String[1]) (defaults to: '0.5.0')

    The binary release version

  • export_scrape_job (Boolean) (defaults to: false)
  • scrape_host (Optional[Stdlib::Host]) (defaults to: undef)
  • scrape_port (Stdlib::Port) (defaults to: 9558)
  • scrape_job_name (String[1]) (defaults to: 'systemd')
  • scrape_job_labels (Optional[Hash]) (defaults to: undef)


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
# File 'manifests/systemd_exporter.pp', line 50

class prometheus::systemd_exporter (
  String $download_extension              = 'tar.gz',
  Prometheus::Uri $download_url_base      = 'https://github.com/povilasv/systemd_exporter/releases',
  Array[String] $extra_groups             = [],
  String[1] $group                        = 'systemd-exporter',
  String[1] $package_name                 = 'systemd_exporter',
  String[1] $user                         = 'systemd-exporter',
  String[1] $version                      = '0.5.0',
  Boolean $purge_config_dir               = true,
  Boolean $restart_on_change              = true,
  Boolean $service_enable                 = true,
  Stdlib::Ensure::Service $service_ensure = 'running',
  String[1] $service_name                 = 'systemd_exporter',
  Prometheus::Initstyle $init_style       = $facts['service_provider'],
  Prometheus::Install $install_method     = $prometheus::install_method,
  Boolean $manage_group                   = true,
  Boolean $manage_service                 = true,
  Boolean $manage_user                    = true,
  String[1] $namespace                    = 'systemd',
  String[1] $os                           = downcase($facts['kernel']),
  String $extra_options                   = '', # lint:ignore:params_empty_string_assignment
  Optional[Prometheus::Uri] $download_url = undef,
  String[1] $arch                         = $prometheus::real_arch,
  String[1] $bin_dir                      = $prometheus::bin_dir,
  Boolean $export_scrape_job              = false,
  Optional[Stdlib::Host] $scrape_host     = undef,
  Stdlib::Port $scrape_port               = 9558,
  String[1] $scrape_job_name              = 'systemd',
  Optional[Hash] $scrape_job_labels       = undef,
) inherits prometheus {
  $release = "v${version}"

  $real_download_url = pick($download_url, "${download_url_base}/download/${release}/${package_name}-${version}.${os}-${arch}.${download_extension}")
  $notify_service = $restart_on_change ? {
    true    => Service[$service_name],
    default => undef,
  }
  $options = $extra_options

  prometheus::daemon { $service_name:
    install_method     => 'url',
    version            => $version,
    download_extension => $download_extension,
    os                 => $os,
    arch               => $arch,
    bin_dir            => $bin_dir,
    notify_service     => $notify_service,
    package_name       => $package_name,
    manage_user        => $manage_user,
    user               => $user,
    extra_groups       => $extra_groups,
    real_download_url  => $real_download_url,
    group              => $group,
    manage_group       => $manage_group,
    purge              => $purge_config_dir,
    options            => $options,
    init_style         => $init_style,
    service_ensure     => $service_ensure,
    service_enable     => $service_enable,
    manage_service     => $manage_service,
    export_scrape_job  => $export_scrape_job,
    scrape_host        => $scrape_host,
    scrape_port        => $scrape_port,
    scrape_job_name    => $scrape_job_name,
    scrape_job_labels  => $scrape_job_labels,
  }
}