puppet: Move node_exporter to external_dep.

This commit is contained in:
Alex Vandiver 2021-12-29 20:55:37 +00:00 committed by Tim Abbott
parent d2a78bac7e
commit 2d6c096904
2 changed files with 16 additions and 12 deletions

View File

@ -5,17 +5,21 @@ class zulip_ops::prometheus::node {
include zulip::supervisor
$version = '1.1.2'
zulip::sha256_tarball_to { 'node_exporter':
url => "https://github.com/prometheus/node_exporter/releases/download/v${version}/node_exporter-${version}.linux-${::architecture}.tar.gz",
sha256 => '8c1f6a317457a658e0ae68ad710f6b4098db2cad10204649b51e3c043aa3e70d',
install => {
"node_exporter-${version}.linux-${::architecture}/node_exporter" => "/usr/local/bin/node_exporter-${version}",
},
$dir = "/srv/zulip-node_exporter-${version}/"
$bin = "${dir}node_exporter"
zulip::external_dep { 'node_exporter':
version => $version,
url => "https://github.com/prometheus/node_exporter/releases/download/v${version}/node_exporter-${version}.linux-${::architecture}.tar.gz",
sha256 => '8c1f6a317457a658e0ae68ad710f6b4098db2cad10204649b51e3c043aa3e70d',
tarball_prefix => "node_exporter-${version}.linux-${::architecture}/",
bin => 'node_exporter',
}
# This was moved to an external_dep in 2021/12, and these lines can
# be removed once all prod hosts no longer have this file.
file { '/usr/local/bin/node_exporter':
ensure => 'link',
target => "/usr/local/bin/node_exporter-${version}",
require => Zulip::Sha256_tarball_to['node_exporter'],
ensure => absent,
}
zulip_ops::firewall_allow { 'node_exporter': port => '9100' }
@ -24,12 +28,12 @@ class zulip_ops::prometheus::node {
require => [
User[zulip],
Package[supervisor],
File['/usr/local/bin/node_exporter'],
File[$bin],
],
owner => 'root',
group => 'root',
mode => '0644',
source => 'puppet:///modules/zulip_ops/supervisor/conf.d/prometheus_node_exporter.conf',
content => template('zulip_ops/supervisor/conf.d/prometheus_node_exporter.conf.template.erb'),
notify => Service[supervisor],
}
}

View File

@ -1,5 +1,5 @@
[program:prometheus_node_exporter]
command=/usr/local/bin/node_exporter --collector.supervisord --collector.supervisord.url=unix:///var/run/supervisor.sock --no-collector.hwmon
command=<%= @bin %> --collector.supervisord --collector.supervisord.url=unix:///var/run/supervisor.sock --no-collector.hwmon
priority=10
autostart=true
autorestart=true