Puppet Class: prometheus::blackbox_exporter
- Defined in:
- modules/prometheus/manifests/blackbox_exporter.pp
Overview
Prometheus black box metrics exporter. See also github.com/prometheus/blackbox_exporter
This does 'active' checks over TCP / UDP / ICMP / HTTP / DNS and reports status to the prometheus scraper
14 15 16 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 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 |
# File 'modules/prometheus/manifests/blackbox_exporter.pp', line 14
class prometheus::blackbox_exporter(
Boolean $manage_config = true,
String[1] $directory_owner = 'root',
String[1] $directory_group = 'root',
Wmflib::Ensure $default_modules = 'present',
Optional[Stdlib::HTTPUrl] $http_proxy = undef,
) {
require prometheus::assemble_config
# Grant permissions to send out ICMP probes
debconf::set { 'prometheus-blackbox-exporter/want_cap_net_raw':
type => 'boolean',
value => true,
before => Package['prometheus-blackbox-exporter'],
}
package { 'prometheus-blackbox-exporter':
ensure => present,
}
file { '/etc/prometheus/blackbox.yml.d':
ensure => directory,
mode => '0775',
owner => $directory_owner,
group => $directory_group,
recurse => $manage_config,
purge => $manage_config,
}
['misc', 'common'].each |$frag| {
prometheus::blackbox::module { $frag:
ensure => $default_modules,
content => template("prometheus/blackbox_exporter/${frag}.yml.erb"),
}
}
# The exec is always run (gated by onlyif) to be able to recover from the following scenario:
# - a fragment changes, a refresh of this exec is triggered
# - the exec fails for some reason, the configuration is not updated
# - at the next puppet run the fragment doesn't change, therefore the exec is not refreshed again
# - the old configuration is silently kept in place until a fragment changes again
exec { 'assemble blackbox.yml':
onlyif => 'prometheus-assemble-config --onlyif blackbox',
command => 'prometheus-assemble-config blackbox',
notify => Service['prometheus-blackbox-exporter'],
path => '/usr/local/bin',
}
systemd::service { 'prometheus-blackbox-exporter':
ensure => present,
content => init_template('prometheus-blackbox-exporter', 'systemd_override'),
override => true,
restart => true,
}
profile::auto_restarts::service { 'prometheus-blackbox-exporter': }
logrotate::conf { 'blackbox_exporter':
ensure => present,
source => 'puppet:///modules/prometheus/blackbox_exporter.logrotate.conf',
}
rsyslog::conf { 'blackbox_exporter':
source => 'puppet:///modules/prometheus/blackbox_exporter.rsyslog.conf',
priority => 40,
}
}
|