puppet: Add a prometheus monitor for tornado processes.

This commit is contained in:
Alex Vandiver 2022-03-18 15:46:29 -04:00 committed by Tim Abbott
parent 6b91652d9a
commit 1bd5723cd2
5 changed files with 62 additions and 0 deletions

View File

@ -96,6 +96,15 @@ class zulip::common {
},
},
# https://github.com/ncabatoff/process-exporter/releases
'process_exporter' => {
'version' => '0.7.10',
'sha256' => {
'amd64' => '52503649649c0be00e74e8347c504574582b95ad428ff13172d658e82b3da1b5',
'aarch64' => 'b377e673558bd0d51f5f771c2b3b3be44b60fcac0689709f47d8c7ca8136f6f5',
}
},
# https://prometheus.io/download/#prometheus
'prometheus' => {
'version' => '2.34.0',

View File

@ -0,0 +1,6 @@
process_names:
- name: "tornado-{{.Matches.Port}}"
comm:
- python3
cmdline:
- runtornado\s+127\.0\.0\.1:(?P<Port>\S+)

View File

@ -3,6 +3,7 @@
class zulip_ops::app_frontend_monitoring {
include zulip_ops::prometheus::rabbitmq
include zulip_ops::prometheus::uwsgi
include zulip_ops::prometheus::tornado
zulip_ops::firewall_allow { 'grok_exporter': port => '9144' }
include zulip_ops::munin_node
$munin_plugins = [

View File

@ -0,0 +1,38 @@
# @summary Prometheus monitoring of tornado processes
#
class zulip_ops::prometheus::tornado {
$version = $zulip::common::versions['process_exporter']['version']
$dir = "/srv/zulip-process_exporter-${version}"
$bin = "${dir}/process-exporter"
$conf = '/etc/zulip/tornado_process_exporter.yaml'
zulip::external_dep { 'process_exporter':
version => $version,
url => "https://github.com/ncabatoff/process-exporter/releases/download/v${version}/process-exporter-${version}.linux-${zulip::common::goarch}.tar.gz",
tarball_prefix => "process-exporter-${version}.linux-${zulip::common::goarch}",
}
zulip_ops::firewall_allow { 'tornado_exporter': port => '9256' }
file { $conf:
ensure => file,
require => User[zulip],
owner => 'zulip',
group => 'zulip',
mode => '0644',
source => 'puppet:///modules/zulip_ops/tornado_process_exporter.yaml',
}
file { "${zulip::common::supervisor_conf_dir}/prometheus_tornado_exporter.conf":
ensure => file,
require => [
User[zulip],
Package[supervisor],
Zulip::External_Dep['process_exporter'],
File[$conf],
],
owner => 'root',
group => 'root',
mode => '0644',
content => template('zulip_ops/supervisor/conf.d/prometheus_tornado_exporter.conf.template.erb'),
notify => Service[supervisor],
}
}

View File

@ -0,0 +1,8 @@
[program:prometheus_tornado_exporter]
command=<%= @bin %> -config.path <%= @conf %>
priority=10
autostart=true
autorestart=true
user=zulip
redirect_stderr=true
stdout_logfile=/var/log/zulip/tornado_exporter.log