2020-07-23 23:23:43 +02:00
|
|
|
# @summary Gathers Prometheus statistics from all nodes.
|
|
|
|
#
|
|
|
|
# Only one instance is necessary.
|
|
|
|
#
|
|
|
|
class zulip_ops::profile::prometheus_server {
|
|
|
|
include zulip_ops::profile::base
|
|
|
|
include zulip_ops::prometheus::base
|
|
|
|
|
2021-12-28 03:00:14 +01:00
|
|
|
$version = $zulip::common::versions['prometheus']['version']
|
2021-12-28 02:08:41 +01:00
|
|
|
$dir = "/srv/zulip-prometheus-${version}"
|
|
|
|
$bin = "${dir}/prometheus"
|
2021-12-29 21:55:54 +01:00
|
|
|
$data_dir = '/var/lib/prometheus'
|
|
|
|
|
|
|
|
zulip::external_dep { 'prometheus':
|
|
|
|
version => $version,
|
2022-02-11 20:37:31 +01:00
|
|
|
url => "https://github.com/prometheus/prometheus/releases/download/v${version}/prometheus-${version}.linux-${zulip::common::goarch}.tar.gz",
|
|
|
|
tarball_prefix => "prometheus-${version}.linux-${zulip::common::goarch}",
|
2020-07-23 23:23:43 +02:00
|
|
|
}
|
|
|
|
file { '/usr/local/bin/promtool':
|
2022-03-16 01:23:53 +01:00
|
|
|
ensure => link,
|
2021-12-28 02:08:41 +01:00
|
|
|
target => "${dir}/promtool",
|
2021-12-29 21:44:03 +01:00
|
|
|
require => Zulip::External_Dep['prometheus'],
|
2021-12-29 21:55:54 +01:00
|
|
|
}
|
2020-07-23 23:23:43 +02:00
|
|
|
|
2021-12-29 21:55:54 +01:00
|
|
|
file { $data_dir:
|
2020-07-23 23:23:43 +02:00
|
|
|
ensure => directory,
|
|
|
|
owner => 'prometheus',
|
|
|
|
group => 'prometheus',
|
|
|
|
require => [ User[prometheus], Group[prometheus] ],
|
|
|
|
}
|
|
|
|
file { '/etc/prometheus':
|
|
|
|
ensure => directory,
|
|
|
|
owner => 'root',
|
|
|
|
group => 'root',
|
2023-01-26 23:26:51 +01:00
|
|
|
mode => '0755',
|
2020-07-23 23:23:43 +02:00
|
|
|
}
|
|
|
|
file { '/etc/prometheus/prometheus.yaml':
|
|
|
|
ensure => file,
|
|
|
|
owner => 'root',
|
|
|
|
group => 'root',
|
|
|
|
mode => '0644',
|
|
|
|
source => 'puppet:///modules/zulip_ops/prometheus/prometheus.yaml',
|
|
|
|
notify => Service[supervisor],
|
|
|
|
}
|
2021-12-29 21:55:54 +01:00
|
|
|
|
|
|
|
file { "${zulip::common::supervisor_conf_dir}/prometheus.conf":
|
|
|
|
ensure => file,
|
|
|
|
require => [
|
|
|
|
Package[supervisor],
|
2021-12-29 21:44:03 +01:00
|
|
|
Zulip::External_Dep['prometheus'],
|
2021-12-29 21:55:54 +01:00
|
|
|
File[$data_dir],
|
|
|
|
File['/etc/prometheus/prometheus.yaml'],
|
|
|
|
],
|
|
|
|
owner => 'root',
|
|
|
|
group => 'root',
|
|
|
|
mode => '0644',
|
|
|
|
content => template('zulip_ops/supervisor/conf.d/prometheus.conf.template.erb'),
|
|
|
|
notify => Service[supervisor],
|
|
|
|
}
|
2020-07-23 23:23:43 +02:00
|
|
|
}
|