2020-07-23 22:29:00 +02:00
|
|
|
# @summary Configures a node for monitoring with Prometheus
|
|
|
|
#
|
2024-02-06 21:40:19 +01:00
|
|
|
class kandra::prometheus::node {
|
|
|
|
include kandra::prometheus::base
|
2020-07-23 22:29:00 +02:00
|
|
|
include zulip::supervisor
|
|
|
|
|
2021-12-28 03:00:14 +01:00
|
|
|
$version = $zulip::common::versions['node_exporter']['version']
|
2021-12-28 02:08:41 +01:00
|
|
|
$dir = "/srv/zulip-node_exporter-${version}"
|
|
|
|
$bin = "${dir}/node_exporter"
|
2021-12-29 21:55:37 +01:00
|
|
|
|
|
|
|
zulip::external_dep { 'node_exporter':
|
|
|
|
version => $version,
|
2022-02-11 20:37:31 +01:00
|
|
|
url => "https://github.com/prometheus/node_exporter/releases/download/v${version}/node_exporter-${version}.linux-${zulip::common::goarch}.tar.gz",
|
|
|
|
tarball_prefix => "node_exporter-${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],
|
|
|
|
cleanup_after => [Service[supervisor]],
|
2020-07-23 22:29:00 +02:00
|
|
|
}
|
2021-12-29 21:55:37 +01:00
|
|
|
|
2024-02-06 21:40:19 +01:00
|
|
|
kandra::firewall_allow { 'node_exporter': port => '9100' }
|
2021-06-11 22:37:36 +02:00
|
|
|
file { "${zulip::common::supervisor_conf_dir}/prometheus_node_exporter.conf":
|
2020-07-23 22:29:00 +02:00
|
|
|
ensure => file,
|
|
|
|
require => [
|
2021-08-03 05:10:32 +02:00
|
|
|
User[zulip],
|
2020-07-23 22:29:00 +02:00
|
|
|
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],
|
2020-07-23 22:29:00 +02:00
|
|
|
],
|
|
|
|
owner => 'root',
|
|
|
|
group => 'root',
|
|
|
|
mode => '0644',
|
2024-02-06 21:40:19 +01:00
|
|
|
content => template('kandra/supervisor/conf.d/prometheus_node_exporter.conf.template.erb'),
|
2020-07-23 22:29:00 +02:00
|
|
|
notify => Service[supervisor],
|
|
|
|
}
|
|
|
|
}
|