Puppet Class: statograph
- Defined in:
- modules/statograph/manifests/init.pp
Summary
Installs statograph and configures systemd timerOverview
SPDX-License-Identifier: Apache-2.0
10 11 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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'modules/statograph/manifests/init.pp', line 10
class statograph (
Wmflib::Ensure $ensure = 'ensure',
Sensitive[String[1]] $api_key = '',
Sensitive[String[1]] $page_id = '',
String $owner = 'root',
String $group = 'root',
Stdlib::Filemode $mode = '0500',
Hash[String, Statograph::Proxy] $proxies = {},
Array[Statograph::Metric] $metrics = [],
)
{
$config_file = '/etc/statograph/config.yml'
$job_command = "/usr/bin/statograph -c ${config_file} upload_metrics"
ensure_packages('statograph', {'ensure' => $ensure})
$config = {
'statuspage' => {
'api_key' => $api_key.unwrap,
'page_id' => $page_id.unwrap,
},
'proxies' => $proxies,
'metrics' => $metrics,
}
file {'/etc/statograph':
ensure => stdlib::ensure($ensure, 'directory'),
owner => $owner,
group => $group,
mode => $mode,
}
file {$config_file:
ensure => stdlib::ensure($ensure, 'file'),
owner => $owner,
group => $group,
mode => $mode,
content => $config.to_yaml,
require => Package['statograph'],
}
systemd::timer::job { 'statograph_post':
ensure => $ensure,
description => 'Runs statograph to publish data to statuspage.io',
user => $owner,
monitoring_enabled => true,
command => $job_command,
interval => {'start' => 'OnCalendar', 'interval' => 'minutely'},
require => [
File[$config_file],
Package['statograph'],
]
}
}
|