Skip to content

Commit

Permalink
puppet: Only install rabbitmq cron jobs via zulip_ops.
Browse files Browse the repository at this point in the history
The rabbitmq cron jobs exist in order to call rabbitmqctl as root and
write the output to files that nagios can consume, since nagios is not
allowed to run rabbitmqctl.

In systems which do not have nagios configured, these every-minute
cron jobs add non-insignificant load, to no effect.  Move their
installation into `zulip_ops`.  In doing so, also combine the cron.d
files into a single file; this allows us to `ensure => absent` the old
filenames, removing them from existing systems.  Leave the resulting
combined cron.d file in `zulip`, since it is still of general utility
and note.
  • Loading branch information
alexmv committed Sep 30, 2020
1 parent 4d65ea2 commit 57d88ee
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@
SHELL=/bin/bash

* * * * * root /home/zulip/deployments/current/scripts/nagios/check-rabbitmq-queue &> /var/lib/nagios_state/check-rabbitmq-results-tmp; mv /var/lib/nagios_state/check-rabbitmq-results-tmp /var/lib/nagios_state/check-rabbitmq-results
* * * * * root /home/zulip/deployments/current/scripts/nagios/check-rabbitmq-consumers
5 changes: 0 additions & 5 deletions puppet/zulip/files/cron.d/rabbitmq-numconsumers

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Nagios plugin to check that the rabbitmq has the correct number of consumers.
This script just checks the contents of /var/lib/nagios_state/check-rabbitmq-consumers,
which is generated by scripts/nagios/check-rabbitmq-consumers.
It is run by cron and can be found at puppet/zulip/files/cron.d/rabbitmq-numconsumers
It is run by cron and can be found at puppet/zulip/files/cron.d/rabbitmq-monitoring
"""
import sys

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ of a stuck consumer.
This script just checks the contents of /var/lib/nagios_state/check-rabbitmq-results,
which is generated by scripts/nagios/check-rabbitmq-queue.
It is run by cron; the crontab is in puppet/zulip/files/cron.d/rabbitmq-queuesize.
It is run by cron; the crontab is in puppet/zulip/files/cron.d/rabbitmq-monitoring
"""
import sys

Expand Down
19 changes: 4 additions & 15 deletions puppet/zulip/manifests/rabbit.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,10 @@
]
package { $rabbit_packages: ensure => 'installed' }

file { '/etc/cron.d/rabbitmq-queuesize':
ensure => file,
require => Package[rabbitmq-server],
owner => 'root',
group => 'root',
mode => '0644',
source => 'puppet:///modules/zulip/cron.d/rabbitmq-queuesize',
}
file { '/etc/cron.d/rabbitmq-numconsumers':
ensure => file,
require => Package[rabbitmq-server],
owner => 'root',
group => 'root',
mode => '0644',
source => 'puppet:///modules/zulip/cron.d/rabbitmq-numconsumers',
# Removed 2020-09 in version 4.0; these lines can be removed in
# Zulip version 5.0 and later.
file { ['/etc/cron.d/rabbitmq-queuesize', '/etc/cron.d/rabbitmq-numconsumers']:
ensure => absent,
}

file { '/etc/default/rabbitmq-server':
Expand Down
9 changes: 9 additions & 0 deletions puppet/zulip_ops/manifests/app_frontend.pp
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,13 @@
'zulip_send_receive_timing',
]
zulip_ops::munin_plugin { $munin_plugins: }

file { '/etc/cron.d/rabbitmq-monitoring':
ensure => file,
require => Package[rabbitmq-server],
owner => 'root',
group => 'root',
mode => '0644',
source => 'puppet:///modules/zulip/cron.d/rabbitmq-monitoring',
}
}

0 comments on commit 57d88ee

Please sign in to comment.