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-29 03:39:11 +01:00
|
|
|
$arch = $::architecture ? {
|
|
|
|
'amd64' => 'amd64',
|
|
|
|
'aarch64' => 'arm64',
|
|
|
|
}
|
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,
|
2021-12-29 03:39:11 +01:00
|
|
|
url => "https://github.com/prometheus/prometheus/releases/download/v${version}/prometheus-${version}.linux-${arch}.tar.gz",
|
|
|
|
tarball_prefix => "prometheus-${version}.linux-${arch}",
|
2020-07-23 23:23:43 +02:00
|
|
|
}
|
|
|
|
file { '/usr/local/bin/promtool':
|
|
|
|
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
|
|
|
}
|
|
|
|
# This was moved to an external dep in 2021/12, and the below can be
|
|
|
|
# removed once the prod server has taken the update.
|
|
|
|
file { '/srv/prometheus':
|
|
|
|
ensure => absent,
|
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',
|
|
|
|
mode => '0644',
|
|
|
|
}
|
|
|
|
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
|
|
|
}
|