12
13
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
|
# File 'modules/netops/manifests/atlasexporter.pp', line 12
class netops::atlasexporter(
Hash[String, Hash] $atlas_measurements,
Stdlib::Port $exporter_port,
) {
ensure_packages('prometheus-atlas-exporter')
$config_file = '/etc/prometheus-atlas-exporter.yaml'
# For the exporter, we need to write out key=>value pairs of key 'id'
# and value of the measurement ID.
$measurement_ids = $atlas_measurements.values.reduce([]) |$memo, $site| {
$memo + $site.values.flatten.map |$msm_id| { {'id' => $msm_id} }
}
file { $config_file:
ensure => 'file',
content => to_yaml({'measurements' => $measurement_ids}),
owner => 'prometheus',
notify => Systemd::Service['prometheus-atlas-exporter'],
}
systemd::service { 'prometheus-atlas-exporter':
ensure => 'present',
content => systemd_template('prometheus-atlas-exporter'),
require => [ Package['prometheus-atlas-exporter'], File[$config_file] ],
restart => true,
}
profile::auto_restarts::service { 'prometheus-atlas-exporter': }
}
|