2020-07-23 23:23:43 +02:00
|
|
|
# @summary Gathers Prometheus statistics from all nodes.
|
|
|
|
#
|
|
|
|
# Only one instance is necessary.
|
|
|
|
#
|
2024-02-06 21:40:19 +01:00
|
|
|
class kandra::profile::prometheus_server inherits kandra::profile::base {
|
2024-02-02 15:08:49 +01:00
|
|
|
|
2024-02-06 21:40:19 +01:00
|
|
|
include kandra::prometheus::base
|
2020-07-23 23:23:43 +02:00
|
|
|
|
2023-04-26 19:56:11 +02:00
|
|
|
# This blackbox monitoring of the backup system runs locally
|
2024-02-06 21:40:19 +01:00
|
|
|
include kandra::prometheus::wal_g
|
2023-04-26 19:56:11 +02:00
|
|
|
|
2023-11-13 20:35:39 +01:00
|
|
|
# Ditto the Akamai logs
|
2024-02-06 21:40:19 +01:00
|
|
|
include kandra::prometheus::akamai
|
2023-11-13 20:35:39 +01:00
|
|
|
|
2023-11-13 22:41:42 +01:00
|
|
|
# Export prometheus stats to status.zulip.com
|
2024-02-06 21:40:19 +01:00
|
|
|
include kandra::statuspage
|
2023-11-13 22:41:42 +01:00
|
|
|
|
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}",
|
puppet: Stop relying on "tidy" ordering, which ignores metaparams.
The `tidy` parameter is buggy, and ignores all ordering
metaparameters. This is fixed in Puppet 7[^1], but it's helpful to
resolve it now. Specifically, this fixes bugs with tidy running too
early, and deleting the old version of a package before its new
version is installed or symlinked, leaving a race condition if
anything tries to run the binary in this window.
This is mostly not a problem for Supervisor-managed processes, since
the binary is already running, and can continue to run if it is tidied
out from under the running process. For stand-alone tools like wal-g,
which are run frequently by PostgreSQL, this may cause issues if
PostgreSQL tries to call them during a puppet run.
Remove all complicated uses of tidy, and replace them with an `exec`
which does the equivalent. We also generate `file` resources for
binaries, making them easier (and clearer) to specify as dependencies.
[^1]: https://puppet.atlassian.net/browse/PUP-10688
2024-04-15 20:11:08 +02:00
|
|
|
bin => [$bin, "${dir}/promtool"],
|
|
|
|
cleanup_after => [Service[supervisor]],
|
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",
|
puppet: Stop relying on "tidy" ordering, which ignores metaparams.
The `tidy` parameter is buggy, and ignores all ordering
metaparameters. This is fixed in Puppet 7[^1], but it's helpful to
resolve it now. Specifically, this fixes bugs with tidy running too
early, and deleting the old version of a package before its new
version is installed or symlinked, leaving a race condition if
anything tries to run the binary in this window.
This is mostly not a problem for Supervisor-managed processes, since
the binary is already running, and can continue to run if it is tidied
out from under the running process. For stand-alone tools like wal-g,
which are run frequently by PostgreSQL, this may cause issues if
PostgreSQL tries to call them during a puppet run.
Remove all complicated uses of tidy, and replace them with an `exec`
which does the equivalent. We also generate `file` resources for
binaries, making them easier (and clearer) to specify as dependencies.
[^1]: https://puppet.atlassian.net/browse/PUP-10688
2024-04-15 20:11:08 +02:00
|
|
|
require => File["${dir}/promtool"],
|
|
|
|
before => Exec['Cleanup 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',
|
2024-02-06 21:40:19 +01:00
|
|
|
source => 'puppet:///modules/kandra/prometheus/prometheus.yaml',
|
2020-07-23 23:23:43 +02:00
|
|
|
notify => Service[supervisor],
|
|
|
|
}
|
2021-12-29 21:55:54 +01:00
|
|
|
|
|
|
|
file { "${zulip::common::supervisor_conf_dir}/prometheus.conf":
|
|
|
|
ensure => file,
|
|
|
|
require => [
|
|
|
|
Package[supervisor],
|
puppet: Stop relying on "tidy" ordering, which ignores metaparams.
The `tidy` parameter is buggy, and ignores all ordering
metaparameters. This is fixed in Puppet 7[^1], but it's helpful to
resolve it now. Specifically, this fixes bugs with tidy running too
early, and deleting the old version of a package before its new
version is installed or symlinked, leaving a race condition if
anything tries to run the binary in this window.
This is mostly not a problem for Supervisor-managed processes, since
the binary is already running, and can continue to run if it is tidied
out from under the running process. For stand-alone tools like wal-g,
which are run frequently by PostgreSQL, this may cause issues if
PostgreSQL tries to call them during a puppet run.
Remove all complicated uses of tidy, and replace them with an `exec`
which does the equivalent. We also generate `file` resources for
binaries, making them easier (and clearer) to specify as dependencies.
[^1]: https://puppet.atlassian.net/browse/PUP-10688
2024-04-15 20:11:08 +02:00
|
|
|
File[$bin],
|
2021-12-29 21:55:54 +01:00
|
|
|
File[$data_dir],
|
|
|
|
File['/etc/prometheus/prometheus.yaml'],
|
|
|
|
],
|
|
|
|
owner => 'root',
|
|
|
|
group => 'root',
|
|
|
|
mode => '0644',
|
2024-02-06 21:40:19 +01:00
|
|
|
content => template('kandra/supervisor/conf.d/prometheus.conf.template.erb'),
|
2021-12-29 21:55:54 +01:00
|
|
|
notify => Service[supervisor],
|
|
|
|
}
|
2020-07-23 23:23:43 +02:00
|
|
|
}
|