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 include zulip::supervisor
$version = '1.1.2' $version = '1.1.2'
zulip::sha256_tarball_to { 'node_exporter': $dir = "/srv/zulip-node_exporter-${version}/"
url => "https://github.com/prometheus/node_exporter/releases/download/v${version}/node_exporter-${version}.linux-${::architecture}.tar.gz", $bin = "${dir}node_exporter"
sha256 => '8c1f6a317457a658e0ae68ad710f6b4098db2cad10204649b51e3c043aa3e70d',
install => { zulip::external_dep { 'node_exporter':
"node_exporter-${version}.linux-${::architecture}/node_exporter" => "/usr/local/bin/node_exporter-${version}", 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': file { '/usr/local/bin/node_exporter':
ensure => 'link', ensure => absent,
target => "/usr/local/bin/node_exporter-${version}",
require => Zulip::Sha256_tarball_to['node_exporter'],
} }
zulip_ops::firewall_allow { 'node_exporter': port => '9100' } zulip_ops::firewall_allow { 'node_exporter': port => '9100' }
@ -24,12 +28,12 @@ class zulip_ops::prometheus::node {
require => [ require => [
User[zulip], User[zulip],
Package[supervisor], Package[supervisor],
File['/usr/local/bin/node_exporter'], File[$bin],
], ],
owner => 'root', owner => 'root',
group => 'root', group => 'root',
mode => '0644', 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], notify => Service[supervisor],
} }
} }

View File

@ -1,5 +1,5 @@
[program:prometheus_node_exporter] [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 priority=10
autostart=true autostart=true
autorestart=true autorestart=true