mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
postgres_exporter: Build from source for per-index stats.
This builds prometheus-community/postgres_exporter#843 to track per-index statistics.
This commit is contained in:
committed by
Tim Abbott
parent
5f74b9051e
commit
0c88cfca63
@@ -121,6 +121,12 @@ class zulip::common {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
# https://github.com/prometheus-community/postgres_exporter/pull/843
|
||||||
|
'postgres_exporter-src' => {
|
||||||
|
'version' => '4881e566207b1675f8b2ceae9bcd71f61800ccd1',
|
||||||
|
'sha256' => '1b0aaf32e3834f02e5448fb21c0de114a4e42cc0937300e307899efb8438bf16',
|
||||||
|
},
|
||||||
|
|
||||||
# https://github.com/ncabatoff/process-exporter/releases
|
# https://github.com/ncabatoff/process-exporter/releases
|
||||||
'process_exporter' => {
|
'process_exporter' => {
|
||||||
'version' => '0.7.10',
|
'version' => '0.7.10',
|
||||||
|
|||||||
@@ -3,15 +3,48 @@
|
|||||||
class zulip_ops::prometheus::postgresql {
|
class zulip_ops::prometheus::postgresql {
|
||||||
include zulip_ops::prometheus::base
|
include zulip_ops::prometheus::base
|
||||||
include zulip::supervisor
|
include zulip::supervisor
|
||||||
|
include zulip::golang
|
||||||
|
|
||||||
$version = $zulip::common::versions['postgres_exporter']['version']
|
$version = $zulip::common::versions['postgres_exporter-src']['version']
|
||||||
$dir = "/srv/zulip-postgres_exporter-${version}"
|
$dir = "/srv/zulip-postgres_exporter-src-${version}"
|
||||||
$bin = "${dir}/postgres_exporter"
|
$bin = "/usr/local/bin/postgres_exporter-${version}-go-${zulip::golang::version}"
|
||||||
|
|
||||||
zulip::external_dep { 'postgres_exporter':
|
# Binary builds: https://github.com/prometheus-community/postgres_exporter/releases/download/v${version}/postgres_exporter-${version}.linux-${zulip::common::goarch}.tar.gz
|
||||||
|
|
||||||
|
zulip::external_dep { 'postgres_exporter-src':
|
||||||
version => $version,
|
version => $version,
|
||||||
url => "https://github.com/prometheus-community/postgres_exporter/releases/download/v${version}/postgres_exporter-${version}.linux-${zulip::common::goarch}.tar.gz",
|
url => "https://github.com/Sticksman/postgres_exporter/archive/${version}.tar.gz",
|
||||||
tarball_prefix => "postgres_exporter-${version}.linux-${zulip::common::goarch}",
|
tarball_prefix => "postgres_exporter-${version}",
|
||||||
|
}
|
||||||
|
|
||||||
|
exec { 'compile postgres_exporter':
|
||||||
|
command => "make build && cp ./postgres_exporter ${bin}",
|
||||||
|
cwd => $dir,
|
||||||
|
# GOCACHE is required; nothing is written to GOPATH, but it is required to be set
|
||||||
|
environment => ['GOCACHE=/tmp/gocache', 'GOPATH=/root/go'],
|
||||||
|
path => [
|
||||||
|
"${zulip::golang::dir}/bin",
|
||||||
|
'/usr/local/bin',
|
||||||
|
'/usr/bin',
|
||||||
|
'/bin',
|
||||||
|
],
|
||||||
|
creates => $bin,
|
||||||
|
require => [
|
||||||
|
Zulip::External_Dep['golang'],
|
||||||
|
Zulip::External_Dep['postgres_exporter-src'],
|
||||||
|
]
|
||||||
|
}
|
||||||
|
# This resource exists purely so it doesn't get tidied; it is
|
||||||
|
# created by the 'compile postgres_exporter' step.
|
||||||
|
file { $bin:
|
||||||
|
ensure => file,
|
||||||
|
require => Exec['compile postgres_exporter'],
|
||||||
|
}
|
||||||
|
tidy { '/usr/local/bin/postgres_exporter-*':
|
||||||
|
path => '/usr/local/bin',
|
||||||
|
recurse => 1,
|
||||||
|
matches => 'postgres_exporter-*',
|
||||||
|
require => Exec['compile postgres_exporter'],
|
||||||
}
|
}
|
||||||
|
|
||||||
exec { 'create prometheus postgres user':
|
exec { 'create prometheus postgres user':
|
||||||
@@ -27,7 +60,7 @@ class zulip_ops::prometheus::postgresql {
|
|||||||
Exec['create prometheus postgres user'],
|
Exec['create prometheus postgres user'],
|
||||||
User[prometheus],
|
User[prometheus],
|
||||||
Package[supervisor],
|
Package[supervisor],
|
||||||
Zulip::External_Dep['postgres_exporter'],
|
File[$bin],
|
||||||
],
|
],
|
||||||
owner => 'root',
|
owner => 'root',
|
||||||
group => 'root',
|
group => 'root',
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
[program:prometheus_postgres_exporter]
|
[program:prometheus_postgres_exporter]
|
||||||
command=<%= @bin %>
|
command=<%= @bin %> --collector.stat_user_indexes
|
||||||
environment=DATA_SOURCE_NAME="postgresql://prometheus@:5432/zulip?host=/var/run/postgresql"
|
environment=DATA_SOURCE_NAME="postgresql://prometheus@:5432/zulip?host=/var/run/postgresql"
|
||||||
priority=10
|
priority=10
|
||||||
autostart=true
|
autostart=true
|
||||||
|
|||||||
Reference in New Issue
Block a user