Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

puppet: Add a uwsgi exporter for monitoring.

Alex Vandiver8a5be972d29d
diff --git a/puppet/zulip/manifests/common.pp b/puppet/zulip/manifests/common.pp
index 9447e20bb13..0962ec2f9ef 100644
--- a/puppet/zulip/manifests/common.pp
+++ b/puppet/zulip/manifests/common.pp
@@ -97,5 +97,14 @@ class zulip::common {
'aarch64' => '2d185a8ed46161babeaaac8ce00ef1efdeccf3ef4ed234cd181eac6cad1ae4b2',
},
},
+
+ # https://github.com/timonwong/uwsgi_exporter/releases
+ 'uwsgi_exporter' => {
+ 'version' => '1.0.0',
+ 'sha256' => {
+ 'amd64' => '7e924dec77bca1052b4782dcf31f0c6b2ebe71d6bf4a72412b97fec45962cef0',
+ 'aarch64' => 'b36e26c8e94f1954c76aa9e9920be2f84ecc12b34f14a81086fedade8c48cb74',
+ },
+ },
}
}
diff --git a/puppet/zulip/templates/uwsgi.ini.template.erb b/puppet/zulip/templates/uwsgi.ini.template.erb
index acea04cca98..6d72b2b9c48 100644
--- a/puppet/zulip/templates/uwsgi.ini.template.erb
+++ b/puppet/zulip/templates/uwsgi.ini.template.erb
@@ -14,6 +14,8 @@ env= LANG=C.UTF-8
uid=zulip
gid=zulip
+stats=/home/zulip/deployments/uwsgi-stats
+
ignore-sigpipe = true
ignore-write-errors = true
disable-write-exception = true
diff --git a/puppet/zulip_ops/manifests/app_frontend_monitoring.pp b/puppet/zulip_ops/manifests/app_frontend_monitoring.pp
index fb33eb08f0c..48dcb71c239 100644
--- a/puppet/zulip_ops/manifests/app_frontend_monitoring.pp
+++ b/puppet/zulip_ops/manifests/app_frontend_monitoring.pp
@@ -1,6 +1,7 @@
# @summary Munin monitoring of a Django frontend and RabbitMQ server.
#
class zulip_ops::app_frontend_monitoring {
+ include zulip_ops::prometheus::uwsgi
include zulip_ops::munin_node
$munin_plugins = [
'rabbitmq_connections',
diff --git a/puppet/zulip_ops/manifests/prometheus/uwsgi.pp b/puppet/zulip_ops/manifests/prometheus/uwsgi.pp
new file mode 100644
index 00000000000..17be8947d10
--- /dev/null
+++ b/puppet/zulip_ops/manifests/prometheus/uwsgi.pp
@@ -0,0 +1,31 @@
+# @summary Prometheus monitoring of uwsgi servers
+#
+class zulip_ops::prometheus::uwsgi {
+ $version = $zulip::common::versions['uwsgi_exporter']['version']
+ $dir = "/srv/zulip-uwsgi_exporter-${version}"
+ $bin = "${dir}/uwsgi_exporter"
+ $arch = $::architecture ? {
+ 'amd64' => 'amd64',
+ 'aarch64' => 'arm64',
+ }
+ zulip::external_dep { 'uwsgi_exporter':
+ version => $version,
+ url => "https://github.com/timonwong/uwsgi_exporter/releases/download/v${version}/uwsgi_exporter-${version}.linux-${arch}.tar.gz",
+ tarball_prefix => "uwsgi_exporter-${version}.linux-${arch}",
+ }
+
+ zulip_ops::firewall_allow { 'uwsgi_exporter': port => '9238' }
+ file { "${zulip::common::supervisor_conf_dir}/prometheus_uwsgi_exporter.conf":
+ ensure => file,
+ require => [
+ User[zulip],
+ Package[supervisor],
+ Zulip::External_Dep['node_exporter'],
+ ],
+ owner => 'root',
+ group => 'root',
+ mode => '0644',
+ content => template('zulip_ops/supervisor/conf.d/prometheus_uwsgi_exporter.conf.template.erb'),
+ notify => Service[supervisor],
+ }
+}
diff --git a/puppet/zulip_ops/templates/supervisor/conf.d/prometheus_uwsgi_exporter.conf.template.erb b/puppet/zulip_ops/templates/supervisor/conf.d/prometheus_uwsgi_exporter.conf.template.erb
new file mode 100644
index 00000000000..8f926d803c3
--- /dev/null
+++ b/puppet/zulip_ops/templates/supervisor/conf.d/prometheus_uwsgi_exporter.conf.template.erb
@@ -0,0 +1,8 @@
+[program:prometheus_uwsgi_exporter]
+command=<%= @bin %> --stats.uri=unix:///home/zulip/deployments/uwsgi-stats --web.listen-address=:9238
+priority=10
+autostart=true
+autorestart=true
+user=zulip
+redirect_stderr=true
+stdout_logfile=/var/log/zulip/uwsgi_exporter.log