Skip to content

Commit

Permalink
Merge pull request #498 from bastelfreak/unbound
Browse files Browse the repository at this point in the history
Implement unbound_exporter
  • Loading branch information
ghoneycutt authored Feb 16, 2021
2 parents 394b6aa + b8b1a30 commit 5121ec0
Show file tree
Hide file tree
Showing 3 changed files with 395 additions and 0 deletions.
244 changes: 244 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ The package method needs specific yum or apt repo settings which are not made ye
* [`prometheus::server`](#prometheusserver): class to manage the actual prometheus server. This class gets called from the init.pp
* [`prometheus::snmp_exporter`](#prometheussnmp_exporter): This module manages prometheus snmp_exporter
* [`prometheus::statsd_exporter`](#prometheusstatsd_exporter): This module manages prometheus statsd_exporter
* [`prometheus::unbound_exporter`](#prometheusunbound_exporter): This module manages prometheus unbound exporter. The exporter needs to be compiled by hand! (https://github.com/kumina/unbound_exporter/issues/21)
* [`prometheus::varnish_exporter`](#prometheusvarnish_exporter): This module manages prometheus varnish_exporter

#### Private Classes
Expand Down Expand Up @@ -7926,6 +7927,249 @@ Data type: `Optional[Hash]`

Default value: ``undef``

### `prometheus::unbound_exporter`

This module manages prometheus unbound exporter. The exporter needs to be compiled by hand! (https://github.com/kumina/unbound_exporter/issues/21)

* **See also**
* https://github.com/kumina/unbound_exporter

#### Parameters

The following parameters are available in the `prometheus::unbound_exporter` class.

##### `arch`

Data type: `String[1]`

Architecture

Default value: `$prometheus::real_arch`

##### `bin_dir`

Data type: `String[1]`

Directory where binaries are located

Default value: `'/usr/local/bin'`

##### `download_extension`

Data type: `String`

Extension for the release binary archive

Default value: `''`

##### `download_url`

Data type: `Optional[String]`

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

Default value: ``undef``

##### `download_url_base`

Data type: `String[1]`

Base URL for the binary archive

Default value: `'https://github.com/kumina/unbound_exporter/releases'`

##### `extra_groups`

Data type: `Array[String]`

Extra groups to add the binary user to

Default value: `['unbound']`

##### `extra_options`

Data type: `String`

Extra options added to the startup command

Default value: `''`

##### `group`

Data type: `String[1]`

Group under which the binary is running

Default value: `'unbound-exporter'`

##### `init_style`

Data type: `Prometheus::Initstyle`

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

Default value: `$facts['service_provider']`

##### `install_method`

Data type: `String[1]`

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

Default value: `'none'`

##### `manage_group`

Data type: `Boolean`

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

Default value: ``true``

##### `manage_service`

Data type: `Boolean`

Should puppet manage the service?

Default value: ``true``

##### `manage_user`

Data type: `Boolean`

Whether to create user or rely on external code for that

Default value: ``true``

##### `os`

Data type: `String[1]`

Operating system (linux is the only one supported)

Default value: `downcase($facts['kernel'])`

##### `package_ensure`

Data type: `String[1]`

If package, then use this for package ensure

Default value: `'installed'`

##### `package_name`

Data type: `String[1]`

The binary package name - not available yet

Default value: `'unbound_exporter'`

##### `purge_config_dir`

Data type: `Boolean`

Purge config files no longer generated by Puppet

Default value: ``true``

##### `restart_on_change`

Data type: `Boolean`

Should puppet restart the service on configuration change?

Default value: ``true``

##### `service_enable`

Data type: `Boolean`

Whether to enable the service from puppet

Default value: ``true``

##### `service_ensure`

Data type: `Stdlib::Ensure::Service`

State ensured for the service

Default value: `'running'`

##### `service_name`

Data type: `String[1]`

Name of the unbound exporter service

Default value: `'unbound_exporter'`

##### `user`

Data type: `String[1]`

User which runs the service

Default value: `'unbound-exporter'`

##### `version`

Data type: `String[1]`

The binary release version

Default value: `'0.3'`

##### `export_scrape_job`

Data type: `Boolean`



Default value: ``false``

##### `scrape_port`

Data type: `Stdlib::Port`



Default value: `9167`

##### `scrape_job_name`

Data type: `String[1]`



Default value: `'unbound'`

##### `scrape_job_labels`

Data type: `Optional[Hash]`



Default value: ``undef``

##### `bin_name`

Data type: `Optional[String[1]]`



Default value: ``undef``

##### `env_vars`

Data type: `Hash`



Default value: `{ 'GODEBUG' => 'x509ignoreCN=0' }`

### `prometheus::varnish_exporter`

This module manages prometheus varnish_exporter
Expand Down
122 changes: 122 additions & 0 deletions manifests/unbound_exporter.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
#
# @summary This module manages prometheus unbound exporter. The exporter needs to be compiled by hand! (https://github.com/kumina/unbound_exporter/issues/21)
#
# @param arch
# Architecture
# @param bin_dir
# Directory where binaries are located
# @param download_extension
# Extension for the release binary archive
# @param download_url
# Complete URL corresponding to the where the release binary archive can be downloaded
# @param download_url_base
# Base URL for the binary archive
# @param extra_groups
# Extra groups to add the binary user to
# @param extra_options
# Extra options added to the startup command
# @param group
# Group under which the binary is running
# @param init_style
# Service startup scripts style (e.g. rc, upstart or systemd)
# @param install_method
# Installation method: url or package (only url is supported currently)
# @param manage_group
# Whether to create a group for or rely on external code for that
# @param manage_service
# Should puppet manage the service?
# @param manage_user
# Whether to create user or rely on external code for that
# @param os
# Operating system (linux is the only one supported)
# @param package_ensure
# If package, then use this for package ensure
# @param package_name
# The binary package name - not available yet
# @param purge_config_dir
# Purge config files no longer generated by Puppet
# @param restart_on_change
# Should puppet restart the service on configuration change?
# @param service_enable
# Whether to enable the service from puppet
# @param service_ensure
# State ensured for the service
# @param service_name
# Name of the unbound exporter service
# @param user
# User which runs the service
# @param version
# The binary release version
#
# @see https://github.com/kumina/unbound_exporter
#
# @author Tim Meusel <[email protected]>
#
class prometheus::unbound_exporter (
String $download_extension = '',
String[1] $download_url_base = 'https://github.com/kumina/unbound_exporter/releases',
Array[String] $extra_groups = ['unbound'],
String[1] $group = 'unbound-exporter',
String[1] $package_ensure = 'installed',
String[1] $package_name = 'unbound_exporter',
String[1] $user = 'unbound-exporter',
String[1] $version = '0.3',
Boolean $purge_config_dir = true,
Boolean $restart_on_change = true,
Boolean $service_enable = true,
Stdlib::Ensure::Service $service_ensure = 'running',
String[1] $service_name = 'unbound_exporter',
Prometheus::Initstyle $init_style = $facts['service_provider'],
String[1] $install_method = 'none',
Boolean $manage_group = true,
Boolean $manage_service = true,
Boolean $manage_user = true,
String[1] $os = downcase($facts['kernel']),
String $extra_options = '',
Optional[String] $download_url = undef,
String[1] $arch = $prometheus::real_arch,
String[1] $bin_dir = '/usr/local/bin',
Boolean $export_scrape_job = false,
Stdlib::Port $scrape_port = 9167,
String[1] $scrape_job_name = 'unbound',
Optional[Hash] $scrape_job_labels = undef,
Optional[String[1]] $bin_name = undef,
Hash $env_vars = { 'GODEBUG' => 'x509ignoreCN=0' },
) inherits prometheus {
$real_download_url = pick($download_url,"${download_url_base}/download/${version}/${package_name}-${version}_${os}_${arch}")

$notify_service = $restart_on_change ? {
true => Service[$service_name],
default => undef,
}

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

0 comments on commit 5121ec0

Please sign in to comment.