kandra: Remove munin.

This commit is contained in:
Alex Vandiver 2024-01-31 13:41:44 -05:00 committed by Tim Abbott
parent 96d237d57e
commit 927660a7b6
21 changed files with 19 additions and 1004 deletions

View File

@ -2,4 +2,4 @@ SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
USER=zulip
* * * * * zulip /usr/lib/nagios/plugins/zulip_app_frontend/check_send_receive_time --nagios --site=https://$(/home/zulip/deployments/current/scripts/get-django-setting NAGIOS_BOT_HOST) >/dev/null
* * * * * zulip /usr/lib/nagios/plugins/zulip_app_frontend/check_send_receive_time --site=https://$(/home/zulip/deployments/current/scripts/get-django-setting NAGIOS_BOT_HOST) >/dev/null

View File

@ -1,66 +0,0 @@
#!/bin/sh
#
# Plugin to monitor the number of connections to RabbitMQ
#
# Usage: Link or copy into /etc/munin/node.d/
#
# Parameters
# env.conn_warn <warning connections>
# env.conn_crit <critical connections>
#
# Magic markers (optional - only used by munin-config and some
# installation scripts):
#
#%# family=auto
#%# capabilities=autoconf
# If run with the "autoconf"-parameter, give our opinion on whether we
# should be run on this system or not. This is optional, and only used by
# munin-config. In the case of this plugin, we should most probably
# always be included.
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
HOME=/tmp/
# If run with the "config"-parameter, give out information on how the
# graphs should look.
if [ "$1" = "config" ]; then
CONN_WARN=${queue_warn:-500}
CONN_CRIT=${queue_crit:-1000}
# The host name this plugin is for. (Can be overridden to have
# one machine answer for several)
# The title of the graph
echo 'graph_title RabbitMQ connections'
# Arguments to "rrdtool graph". In this case, tell it that the
# lower limit of the graph is '0', and that 1k=1000 (not 1024)
echo 'graph_args --base 1000 -l 0'
# The Y-axis label
echo 'graph_vlabel connections'
# We want Cur/Min/Avg/Max unscaled (i.e. 0.42 load instead of
# 420 milliload)
#echo 'graph_scale no'
echo 'graph_category RabbitMQ'
echo "connections.label Connections"
echo "connections.warning $CONN_WARN"
echo "connections.critical $CONN_CRIT"
echo "connections.info Number of active connections"
echo 'graph_info Shows the number of connections to RabbitMQ'
# Last, if run with the "config"-parameter, quit here (don't
# display any data)
exit 0
fi
# If not run with any parameters at all (or only unknown ones), do the
# real work - i.e. display the data. Almost always this will be
# "value" subfield for every data field.
echo "connections.value $(HOME=$HOME rabbitmqctl list_connections | grep -v "^Listing" | grep -cv "done.$")"

View File

@ -1,73 +0,0 @@
#!/bin/sh
#
# Plugin to monitor the queues of a virtual_host in RabbitMQ
#
# Usage: Link or copy into /etc/munin/node.d/
#
# Parameters
# env.queue_warn <warning queuesize>
# env.queue_crit <critical queuesize>
#
# Magic markers (optional - only used by munin-config and some
# installation scripts):
#
#%# family=auto
#%# capabilities=autoconf
# If run with the "autoconf"-parameter, give our opinion on whether we
# should be run on this system or not. This is optional, and only used by
# munin-config. In the case of this plugin, we should most probably
# always be included.
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
# If run with the "config"-parameter, give out information on how the
# graphs should look.
HOME=/tmp/
QUEUES=$(HOME=$HOME rabbitmqctl list_queues name \
| grep -v '^Listing' \
| grep -v 'done\.$' | sed -e 's/[.=-]/_/g')
if [ "$1" = "config" ]; then
QUEUE_WARN=${queue_warn:-100}
QUEUE_CRIT=${queue_crit:-500}
# The host name this plugin is for. (Can be overridden to have
# one machine answer for several)
# The title of the graph
echo "graph_title RabbitMQ consumers"
# Arguments to "rrdtool graph". In this case, tell it that the
# lower limit of the graph is '0', and that 1k=1000 (not 1024)
echo 'graph_args --base 1000 -l 0'
# The Y-axis label
echo 'graph_vlabel consumers'
# We want Cur/Min/Avg/Max unscaled (i.e. 0.42 load instead of
# 420 milliload)
#echo 'graph_scale no'
echo 'graph_category RabbitMQ'
for queue in $QUEUES; do
echo "$queue.label $queue"
echo "$queue.warning $QUEUE_WARN"
echo "$queue.critical $QUEUE_CRIT"
echo "$queue.info Active consumers for $queue"
done
echo 'graph_info Lists active consumers for a queue.'
# Last, if run with the "config"-parameter, quit here (don't
# display any data)
exit 0
fi
# If not run with any parameters at all (or only unknown ones), do the
# real work - i.e. display the data. Almost always this will be
# "value" subfield for every data field.
HOME=$HOME rabbitmqctl list_queues name consumers \
| grep -v "^Listing" | grep -v "done.$" \
| perl -nle'($q, $s) = split; $q =~ s/[.=-]/_/g; print("$q.value $s")'

View File

@ -1,73 +0,0 @@
#!/bin/sh
#
# Plugin to monitor the queues of a virtual_host in RabbitMQ
#
# Usage: Link or copy into /etc/munin/node.d/
#
# Parameters
# env.queue_warn <warning queuesize>
# env.queue_crit <critical queuesize>
#
# Magic markers (optional - only used by munin-config and some
# installation scripts):
#
#%# family=auto
#%# capabilities=autoconf
# If run with the "autoconf"-parameter, give our opinion on whether we
# should be run on this system or not. This is optional, and only used by
# munin-config. In the case of this plugin, we should most probably
# always be included.
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
# If run with the "config"-parameter, give out information on how the
# graphs should look.
HOME=/tmp/
QUEUES=$(HOME=$HOME rabbitmqctl list_queues name \
| grep -v '^Listing' \
| grep -v 'done\.$' | sed -e 's/[.=-]/_/g')
if [ "$1" = "config" ]; then
QUEUE_WARN=${queue_warn:-10000}
QUEUE_CRIT=${queue_crit:-20000}
# The host name this plugin is for. (Can be overridden to have
# one machine answer for several)
# The title of the graph
echo "graph_title RabbitMQ list_queues"
# Arguments to "rrdtool graph". In this case, tell it that the
# lower limit of the graph is '0', and that 1k=1000 (not 1024)
echo 'graph_args --base 1000 -l 0'
# The Y-axis label
echo 'graph_vlabel queue_size'
# We want Cur/Min/Avg/Max unscaled (i.e. 0.42 load instead of
# 420 milliload)
#echo 'graph_scale no'
echo 'graph_category RabbitMQ'
for queue in $QUEUES; do
echo "$queue.label $queue"
echo "$queue.warning $QUEUE_WARN"
echo "$queue.critical $QUEUE_CRIT"
echo "$queue.info Queue size for $queue"
done
echo 'graph_info Lists how many messages are in each queue.'
# Last, if run with the "config"-parameter, quit here (don't
# display any data)
exit 0
fi
# If not run with any parameters at all (or only unknown ones), do the
# real work - i.e. display the data. Almost always this will be
# "value" subfield for every data field.
HOME=$HOME rabbitmqctl list_queues \
| grep -v "^Listing" | grep -v "done.$" \
| perl -nle'($q, $s) = split; $q =~ s/[.=-]/_/g; print("$q.value $s")'

View File

@ -1,73 +0,0 @@
#!/bin/sh
#
# Plugin to monitor the queues of a virtual_host in RabbitMQ
#
# Usage: Link or copy into /etc/munin/node.d/
#
# Parameters
# env.queue_warn <warning queuesize>
# env.queue_crit <critical queuesize>
#
# Magic markers (optional - only used by munin-config and some
# installation scripts):
#
#%# family=auto
#%# capabilities=autoconf
# If run with the "autoconf"-parameter, give our opinion on whether we
# should be run on this system or not. This is optional, and only used by
# munin-config. In the case of this plugin, we should most probably
# always be included.
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
# If run with the "config"-parameter, give out information on how the
# graphs should look.
HOME=/tmp/
QUEUES=$(HOME=$HOME rabbitmqctl list_queues name \
| grep -v '^Listing' \
| grep -v 'done\.$' | sed -e 's/[.=-]/_/g')
if [ "$1" = "config" ]; then
QUEUE_WARN=${queue_warn:-10000}
QUEUE_CRIT=${queue_crit:-20000}
# The host name this plugin is for. (Can be overridden to have
# one machine answer for several)
# The title of the graph
echo "graph_title RabbitMQ Unacknowledged Messages"
# Arguments to "rrdtool graph". In this case, tell it that the
# lower limit of the graph is '0', and that 1k=1000 (not 1024)
echo 'graph_args --base 1000 -l 0'
# The Y-axis label
echo 'graph_vlabel unacknowledged'
# We want Cur/Min/Avg/Max unscaled (i.e. 0.42 load instead of
# 420 milliload)
#echo 'graph_scale no'
echo 'graph_category RabbitMQ'
for queue in $QUEUES; do
echo "$queue.label $queue"
echo "$queue.warning $QUEUE_WARN"
echo "$queue.critical $QUEUE_CRIT"
echo "$queue.info Unacknowledged messages for $queue"
done
echo 'graph_info Lists how many messages are in each queue.'
# Last, if run with the "config"-parameter, quit here (don't
# display any data)
exit 0
fi
# If not run with any parameters at all (or only unknown ones), do the
# real work - i.e. display the data. Almost always this will be
# "value" subfield for every data field.
HOME=$HOME rabbitmqctl list_queues name messages_unacknowledged \
| grep -v "^Listing" | grep -v "done.$" \
| perl -nle'($q, $s) = split; $q =~ s/[.=-]/_/g; print("$q.value $s")'

View File

@ -1,73 +0,0 @@
#!/bin/sh
#
# Plugin to monitor the queues of a virtual_host in RabbitMQ
#
# Usage: Link or copy into /etc/munin/node.d/
#
# Parameters
# env.queue_warn <warning queuesize>
# env.queue_crit <critical queuesize>
#
# Magic markers (optional - only used by munin-config and some
# installation scripts):
#
#%# family=auto
#%# capabilities=autoconf
# If run with the "autoconf"-parameter, give our opinion on whether we
# should be run on this system or not. This is optional, and only used by
# munin-config. In the case of this plugin, we should most probably
# always be included.
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
# If run with the "config"-parameter, give out information on how the
# graphs should look.
HOME=/tmp/
QUEUES=$(HOME=$HOME rabbitmqctl list_queues name \
| grep -v '^Listing' \
| grep -v 'done\.$' | sed -e 's/[.=-]/_/g')
if [ "$1" = "config" ]; then
QUEUE_WARN=${queue_warn:-10000}
QUEUE_CRIT=${queue_crit:-20000}
# The host name this plugin is for. (Can be overridden to have
# one machine answer for several)
# The title of the graph
echo "graph_title RabbitMQ Uncommitted Messages"
# Arguments to "rrdtool graph". In this case, tell it that the
# lower limit of the graph is '0', and that 1k=1000 (not 1024)
echo 'graph_args --base 1000 -l 0'
# The Y-axis label
echo 'graph_vlabel uncommitted'
# We want Cur/Min/Avg/Max unscaled (i.e. 0.42 load instead of
# 420 milliload)
#echo 'graph_scale no'
echo 'graph_category RabbitMQ'
for queue in $QUEUES; do
echo "$queue.label $queue"
echo "$queue.warning $QUEUE_WARN"
echo "$queue.critical $QUEUE_CRIT"
echo "$queue.info Uncommitted messages for $queue"
done
echo 'graph_info Lists how many messages are in each queue.'
# Last, if run with the "config"-parameter, quit here (don't
# display any data)
exit 0
fi
# If not run with any parameters at all (or only unknown ones), do the
# real work - i.e. display the data. Almost always this will be
# "value" subfield for every data field.
HOME=$HOME rabbitmqctl list_channels name messages_uncommitted \
| grep -v "^Listing" | grep -v "done.$" \
| perl -nle'($q, $s) = /^(.*)\s+(\d+)$/; $q =~ s/[.=-]/_/g; print("$q.value $s")'

View File

@ -1,73 +0,0 @@
#!/bin/sh
#
# Plugin to monitor the queues of a virtual_host in RabbitMQ
#
# Usage: Link or copy into /etc/munin/node.d/
#
# Parameters
# env.queue_warn <warning queuesize>
# env.queue_crit <critical queuesize>
#
# Magic markers (optional - only used by munin-config and some
# installation scripts):
#
#%# family=auto
#%# capabilities=autoconf
# If run with the "autoconf"-parameter, give our opinion on whether we
# should be run on this system or not. This is optional, and only used by
# munin-config. In the case of this plugin, we should most probably
# always be included.
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
# If run with the "config"-parameter, give out information on how the
# graphs should look.
HOME=/tmp/
QUEUES=$(rabbitmqctl list_queues name \
| grep -v '^Listing' \
| grep -v 'done\.$' | sed -e 's/[.=-]/_/g')
if [ "$1" = "config" ]; then
QUEUE_WARN=${queue_warn:-10000}
QUEUE_CRIT=${queue_crit:-20000}
# The host name this plugin is for. (Can be overridden to have
# one machine answer for several)
# The title of the graph
echo "graph_title RabbitMQ Memory used by queue"
# Arguments to "rrdtool graph". In this case, tell it that the
# lower limit of the graph is '0', and that 1k=1000 (not 1024)
echo 'graph_args --base 1024 --vertical-label Bytes -l 0'
# The Y-axis label
echo 'graph_vlabel memory'
# We want Cur/Min/Avg/Max unscaled (i.e. 0.42 load instead of
# 420 milliload)
#echo 'graph_scale no'
echo 'graph_category RabbitMQ'
for queue in $QUEUES; do
echo "$queue.label $queue"
echo "$queue.warning $QUEUE_WARN"
echo "$queue.critical $QUEUE_CRIT"
echo "$queue.info Memory used by $queue"
done
echo 'graph_info Show memory usage by queue'
# Last, if run with the "config"-parameter, quit here (don't
# display any data)
exit 0
fi
# If not run with any parameters at all (or only unknown ones), do the
# real work - i.e. display the data. Almost always this will be
# "value" subfield for every data field.
HOME=$HOME rabbitmqctl list_queues name memory \
| grep -v "^Listing" | grep -v "done.$" \
| perl -nle'($q, $s) = split; $q =~ s/[.=-]/_/g; print("$q.value $s")'

View File

@ -1,62 +0,0 @@
#!/bin/sh
#
# Plugin to monitor the number of active event queues
#
# Usage: Link or copy into /etc/munin/node.d/
#
# No parameters
#
# Magic markers (optional - only used by munin-config and some
# installation scripts):
#
#%# family=auto
#%# capabilities=autoconf
# If run with the "autoconf"-parameter, give our opinion on whether we
# should be run on this system or not. This is optional, and only used by
# munin-config. In the case of this plugin, we should most probably
# always be included.
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
HOME=/tmp/
# If run with the "config"-parameter, give out information on how the
# graphs should look.
if [ "$1" = "config" ]; then
# The host name this plugin is for. (Can be overridden to have
# one machine answer for several)
# The title of the graph
echo 'graph_title Event queues'
# Arguments to "rrdtool graph". In this case, tell it that the
# lower limit of the graph is '0', and that 1k=1000 (not 1024)
echo 'graph_args --base 1000 -l 0'
# The Y-axis label
echo 'graph_vlabel Number'
# We want Cur/Min/Avg/Max unscaled (i.e. 0.42 load instead of
# 420 milliload)
#echo 'graph_scale no'
echo 'graph_category Tornado'
echo "active_queues.label Total active event queues"
echo "active_queues.info Total number of active event queues"
echo "active_users.label Users with active event queues"
echo "active_users.info Number of users with active event queues"
echo 'graph_info Shows the number of active event queues'
# Last, if run with the "config"-parameter, quit here (don't
# display any data)
exit 0
fi
# If not run with any parameters at all (or only unknown ones), do the
# real work - i.e. display the data. Almost always this will be
# "value" subfield for every data field.
echo "active_queues.value $(cat /home/zulip/stats/tornado.active_queues)"
echo "active_users.value $(cat /home/zulip/stats/tornado.active_users)"

View File

@ -1,2 +0,0 @@
#!/bin/sh
/usr/lib/nagios/plugins/zulip_app_frontend/check_send_receive_time --munin "$1" --site="https://$(/home/zulip/deployments/current/scripts/get-django-setting NAGIOS_BOT_HOST)"

View File

@ -1,16 +0,0 @@
Alias /munin /var/cache/munin/www
<Directory /var/cache/munin/www>
Require local
Options None
</Directory>
ScriptAlias /munin-cgi/munin-cgi-graph /usr/lib/munin/cgi/munin-cgi-graph
<Location /munin-cgi/munin-cgi-graph>
Require local
<IfModule mod_fcgid.c>
SetHandler fcgid-script
</IfModule>
<IfModule !mod_fcgid.c>
SetHandler cgi-script
</IfModule>
</Location>

View File

@ -1,53 +0,0 @@
#
# Example config-file for munin-node
#
log_level 4
log_file /var/log/munin/munin-node.log
pid_file /var/run/munin/munin-node.pid
background 1
setsid 1
user root
group root
# Regexps for files to ignore
ignore_file [\#~]$
ignore_file DEADJOE$
ignore_file \.bak$
ignore_file %$
ignore_file \.dpkg-(tmp|new|old|dist)$
ignore_file \.rpm(save|new)$
ignore_file \.pod$
# Set this if the client doesn't report the correct hostname when
# telnetting to localhost, port 4949
#
#host_name localhost.localdomain
# A list of addresses that are allowed to connect. This must be a
# regular expression, since Net::Server does not understand CIDR-style
# network notation unless the perl module Net::CIDR is installed. You
# may repeat the allow line as many times as you'd like
allow ^127\.0\.0\.1$
# If you have installed the Net::CIDR perl module, you can use one or more
# cidr_allow and cidr_deny address/mask patterns. A connecting client must
# match any cidr_allow, and not match any cidr_deny. Note that a netmask
# *must* be provided, even if it's /32
#
# Example:
#
# cidr_allow 127.0.0.1/32
# cidr_allow 192.0.2.0/24
# cidr_deny 192.0.2.42/32
# Which address to bind to;
#host *
host 127.0.0.1
# And which port
port 4949

View File

@ -1,142 +0,0 @@
# This file is used to configure how the plugins are invoked.
# Place in /etc/munin/plugin-conf.d/ or corresponding directory.
#
# PLEASE NOTE: Changes in the plugin-conf.d directory are only
# read at munin-node startup, so restart at any changes.
#
# user <user> # Set the user to run the plugin as.
# group <group> # Set the group to run the plugin as.
# command <command> # Run <command> instead of the plugin. %c expands to
# what would normally be run.
# env.<variable> <value> # Sets <variable> in the plugin's environment, see the
# individual plugins to find out which variables they
# care about.
[amavis]
group adm
env.MUNIN_MKTEMP /bin/mktemp -p /tmp/ $1
env.amavislog /var/log/mail.info
[apt]
user root
[courier_mta_mailqueue]
group daemon
[courier_mta_mailstats]
group adm
[courier_mta_mailvolume]
group adm
[cps*]
user root
[df*]
env.exclude none unknown iso9660 squashfs udf romfs ramfs debugfs
env.warning 92
env.critical 98
[exim_mailqueue]
group adm, (Debian-exim)
[exim_mailstats]
group adm, (Debian-exim)
env.logdir /var/log/exim4/
env.logname mainlog
[fw_conntrack]
user root
[fw_forwarded_local]
user root
[hddtemp_smartctl]
user root
[hddtemp2]
user root
[if_*]
user root
[if_err_*]
user nobody
[ip_*]
user root
[ipmi_*]
user root
[mysql*]
user root
env.mysqlopts --defaults-file=/etc/mysql/debian.cnf
env.mysqluser debian-sys-maint
env.mysqlconnection DBI:mysql:mysql;mysql_read_default_file=/etc/mysql/debian.cnf
[postfix_mailqueue]
user postfix
[postfix_mailstats]
group adm
[postfix_mailvolume]
group adm
env.logfile mail.log
[smart_*]
user root
[vlan*]
user root
[ejabberd*]
user ejabberd
env.statuses available away chat xa
env.days 1 7 30
[dhcpd3]
user root
env.leasefile /var/lib/dhcp3/dhcpd.leases
env.configfile /etc/dhcp3/dhcpd.conf
[jmx_*]
env.ip 127.0.0.1
env.port 5400
[samba]
user root
[munin_stats]
user munin
group munin
[postgres_*]
user postgres
env.PGUSER postgres
env.PGPORT 5432
[zulip_send_receive_timing]
user zulip
group zulip
[rabbitmq_messages]
env.queue_warn 50
env.queue_crit 100
[rabbitmq_messages_unacknowledged]
env.queue_warn 50
env.queue_crit 100
[rabbitmq_queue_memory]
env.queue_warn 20000000
env.queue_crit 40000000
[rabbitmq_*]
user root
[tornado_event_queues]
user zulip
group zulip

View File

@ -1,22 +1,10 @@
# @summary Munin monitoring of a Django frontend and RabbitMQ server.
# @summary Prometheus monitoring of a Django frontend and RabbitMQ server.
#
class kandra::app_frontend_monitoring {
include kandra::prometheus::rabbitmq
include kandra::prometheus::uwsgi
include kandra::prometheus::process
kandra::firewall_allow { 'grok_exporter': port => '9144' }
include kandra::munin_node
$munin_plugins = [
'rabbitmq_connections',
'rabbitmq_consumers',
'rabbitmq_messages',
'rabbitmq_messages_unacknowledged',
'rabbitmq_messages_uncommitted',
'rabbitmq_queue_memory',
'zulip_send_receive_timing',
]
kandra::munin_plugin { $munin_plugins: }
file { '/etc/cron.d/rabbitmq-monitoring':
ensure => file,
require => Package[rabbitmq-server],

View File

@ -1,31 +0,0 @@
class kandra::munin_node {
zulip::safepackage { ['munin-node', 'munin-plugins-extra']: ensure => installed }
service { 'munin-node':
ensure => running,
require => Package['munin-node'],
}
file { '/etc/munin/munin-node.conf':
require => Package['munin-node'],
owner => 'root',
group => 'root',
mode => '0644',
source => 'puppet:///modules/kandra/munin/munin-node.conf',
notify => Service['munin-node'],
}
file { '/etc/munin/plugin-conf.d':
require => Package['munin-node'],
recurse => true,
owner => 'root',
group => 'root',
mode => '0644',
source => 'puppet:///modules/kandra/munin/plugin-conf.d',
notify => Service['munin-node'],
}
file { ['/usr/local/munin', '/usr/local/munin/lib', '/usr/local/munin/lib/plugins']:
ensure => directory,
}
}

View File

@ -1,15 +0,0 @@
define kandra::munin_plugin {
file { "/usr/local/munin/lib/plugins/${title}":
owner => 'root',
group => 'root',
mode => '0755',
source => "puppet:///modules/kandra/munin-plugins/${title}",
}
file { "/etc/munin/plugins/${name}":
ensure => link,
require => File["/usr/local/munin/lib/plugins/${title}"],
target => "/usr/local/munin/lib/plugins/${title}",
notify => Service['munin-node'],
}
}

View File

@ -1,6 +1,5 @@
class kandra::profile::base {
include zulip::profile::base
include kandra::munin_node
include kandra::ksplice_uptrack
include kandra::firewall
include kandra::teleport::node

View File

@ -1,55 +0,0 @@
class kandra::profile::munin_server inherits kandra::profile::base {
include kandra::apache
include zulip::supervisor
$munin_packages = [
'munin',
'autossh',
'libapache2-mod-fcgid',
]
package { $munin_packages: ensure => installed }
$default_host_domain = zulipconf('nagios', 'default_host_domain', undef)
$hosts = zulipconf_nagios_hosts()
file { '/etc/munin/apache.conf':
require => Package['munin-node'],
owner => 'root',
group => 'root',
mode => '0644',
source => 'puppet:///modules/kandra/munin/apache.conf',
notify => Service['apache2'],
}
file { '/etc/apache2/conf-available/munin.conf':
ensure => link,
target => '/etc/munin/apache.conf',
require => File['/etc/munin/apache.conf'],
}
apache2conf { 'munin':
ensure => present,
require => File['/etc/apache2/conf-available/munin.conf'],
notify => Service['apache2'],
}
file { '/etc/munin/munin.conf':
ensure => file,
require => Package['munin'],
owner => 'root',
group => 'root',
mode => '0644',
content => template('kandra/munin/munin.conf.erb'),
}
file { "${zulip::common::supervisor_conf_dir}/munin_tunnels.conf":
ensure => file,
require => Package['supervisor', 'autossh'],
mode => '0644',
owner => 'root',
group => 'root',
content => template('kandra/supervisor/conf.d/munin_tunnels.conf.erb'),
notify => Service['supervisor'],
}
}

View File

@ -2,12 +2,7 @@ class kandra::profile::nagios inherits kandra::profile::base {
include kandra::apache
$nagios_packages = [# Packages needed for Nagios
'nagios4',
# For sending outgoing email
'msmtp',
]
package { $nagios_packages: ensure => installed }
package { ['nagios4', 'msmtp', 'autossh']: ensure => installed }
$nagios_alert_email = zulipconf('nagios', 'alert_email', undef)
$nagios_test_email = zulipconf('nagios', 'test_email', undef)
$nagios_pager_email = zulipconf('nagios', 'pager_email', undef)
@ -67,7 +62,7 @@ class kandra::profile::nagios inherits kandra::profile::base {
notify => Service['apache2'],
}
kandra::teleport::application{ 'nagios':
description => 'Monitoring: nagios and munin',
description => 'Monitoring: nagios',
port => '3000',
}
@ -121,6 +116,15 @@ class kandra::profile::nagios inherits kandra::profile::base {
ensure => absent,
}
file { "${zulip::common::supervisor_conf_dir}/autossh_tunnels.conf":
ensure => file,
require => Package['supervisor', 'autossh'],
mode => '0644',
owner => 'root',
group => 'root',
content => template('kandra/supervisor/conf.d/autossh_tunnels.conf.erb'),
notify => Service['supervisor'],
}
file { '/etc/nagios4/conf.d/zulip_autossh.cfg':
ensure => file,
mode => '0644',

View File

@ -1,143 +0,0 @@
# This file was auto-generated by Puppet. Do not edit by hand.
# Configfile for Munin server
dbdir /var/lib/munin
htmldir /var/cache/munin/www
logdir /var/log/munin
rundir /var/run/munin
# (Exactly one) directory to include all files from.
includedir /etc/munin/munin-conf.d
[nagios]
address 127.0.0.1
use_node_name yes
<%
i = 0
@hosts.each do |host|
-%>
[<%= host %>]
address 127.0.0.1
port <%= 5000 + i %>
use_node_name yes
<%
i += 1
end
-%>
# Default munin comments from Ubuntu 16.04 below
# You can choose the time reference for "DERIVE" like graphs, and show
# "per minute", "per hour" values instead of the default "per second"
#
#graph_period second
# Graphics files are generated either via cron or by a CGI process.
# See http://munin-monitoring.org/wiki/CgiHowto2 for more
# documentation.
# Since 2.0, munin-graph has been rewritten to use the cgi code.
# It is single threaded *by design* now.
#
#graph_strategy cron
# munin-cgi-graph is invoked by the web server up to very many times at the
# same time. This is not optimal since it results in high CPU and memory
# consumption to the degree that the system can thrash. Again the default is
# 6. Most likely the optimal number for max_cgi_graph_jobs is the same as
# max_graph_jobs.
#
#munin_cgi_graph_jobs 6
# If the automatic CGI url is wrong for your system override it here:
#
#cgiurl_graph /munin-cgi/munin-cgi-graph
# max_size_x and max_size_y are the max size of images in pixel.
# Default is 4000. Do not make it too large otherwise RRD might use all
# RAM to generate the images.
#
#max_size_x 4000
#max_size_y 4000
# HTML files are normally generated by munin-html, no matter if the
# files are used or not. You can change this to on-demand generation
# by following the instructions in http://munin-monitoring.org/wiki/CgiHowto2
#
# Notes:
# - moving to CGI for HTML means you cannot have graph generated by cron.
# - cgi html has some bugs, mostly you still have to launch munin-html by hand
#
#html_strategy cron
# munin-update runs in parallel.
#
# The default max number of processes is 16, and is probably ok for you.
#
# If set too high, it might hit some process/ram/filedesc limits.
# If set too low, munin-update might take more than 5 min.
#
# If you want munin-update to not be parallel set it to 0.
#
#max_processes 16
# RRD updates are per default, performed directly on the rrd files.
# To reduce IO and enable the use of the rrdcached, uncomment it and set it to
# the location of the socket that rrdcached uses.
#
#rrdcached_socket /var/run/rrdcached.sock
# Drop somejuser@fnord.comm and anotheruser@blibb.comm an email every time
# something changes (OK -> WARNING, CRITICAL -> OK, etc)
#contact.someuser.command mail -s "Munin notification" somejuser@fnord.comm
#contact.anotheruser.command mail -s "Munin notification" anotheruser@blibb.comm
#
# For those with Nagios, the following might come in handy. In addition,
# the services must be defined in the Nagios server as well.
#contact.nagios.command /usr/bin/send_nsca nagios.host.comm -c /etc/nsca.conf
#
# A more complex example of a host tree
#
## First our "normal" host.
# [fii.foo.com]
# address foo
#
## Then our other host...
# [fay.foo.com]
# address fay
#
## IPv6 host. note that the ip address has to be in brackets
# [ip6.foo.com]
# address [2001::1234:1]
#
## Then we want totals...
# [foo.com;Totals] #Force it into the "foo.com"-domain...
# update no # Turn off data-fetching for this "host".
#
# # The graph "load1". We want to see the loads of both machines...
# # "fii=fii.foo.com:load.load" means "label=machine:graph.field"
# load1.graph_title Loads side by side
# load1.graph_order fii=fii.foo.com:load.load fay=fay.foo.com:load.load
#
# # The graph "load2". Now we want them stacked on top of each other.
# load2.graph_title Loads on top of each other
# load2.dummy_field.stack fii=fii.foo.com:load.load fay=fay.foo.com:load.load
# load2.dummy_field.draw AREA # We want area instead the default LINE2.
# load2.dummy_field.label dummy # This is needed. Silly, really.
#
# # The graph "load3". Now we want them summarised into one field
# load3.graph_title Loads summarised
# load3.combined_loads.sum fii.foo.com:load.load fay.foo.com:load.load
# load3.combined_loads.label Combined loads # Must be set, as this is
# # not a dummy field!
#
## ...and on a side note, I want them listen in another order (default is
## alphabetically)
#
# # Since [foo.com] would be interpreted as a host in the domain "com", we
# # specify that this is a domain by adding a semicolon.
# [foo.com;]
# node_order Totals fii.foo.com fay.foo.com
#

View File

@ -3,8 +3,6 @@
"""
Script to provide information about send-receive times.
It supports both munin and nagios outputs
It must be run on a machine that is using the live database for the
Django ORM.
"""
@ -33,32 +31,12 @@ usage = """Usage: send-receive.py [options] [config]
parser = argparse.ArgumentParser(usage=usage)
parser.add_argument("--site", default="https://api.zulip.com")
parser.add_argument("--nagios", action="store_true")
parser.add_argument("--insecure", action="store_true")
parser.add_argument("--munin", action="store_true")
parser.add_argument("config", nargs="?")
options = parser.parse_args()
if not options.nagios and not options.munin:
print("No output options specified! Please provide --munin or --nagios")
sys.exit(0)
if options.munin and options.config == "config":
print(
"""graph_title Send-Receive times
graph_info The number of seconds it takes to send and receive a message from the server
graph_args -u 5 -l 0
graph_vlabel RTT (seconds)
sendreceive.label Send-receive round trip time
sendreceive.warning 3
sendreceive.critical 5"""
)
sys.exit(0)
sys.path.append("/home/zulip/deployments/current")
os.environ["DJANGO_SETTINGS_MODULE"] = "zproject.settings"
@ -91,7 +69,7 @@ def report(state: str, timestamp: Any = None, msg: Optional[str] = None) -> NoRe
def send_zulip(sender: zulip.Client, message: Dict[str, Any]) -> None:
result = sender.send_message(message)
if result["result"] != "success" and options.nagios:
if result["result"] != "success":
report("CRITICAL", msg=f"Error sending Zulip, args were: {message}, {result}")
@ -169,13 +147,9 @@ while msg_to_send not in msg_content:
zulip_recipient.deregister(queue_id)
if options.nagios:
if seconds_diff > 12:
report("CRITICAL", timestamp=seconds_diff)
if seconds_diff > 3:
report("WARNING", timestamp=seconds_diff)
if options.munin:
print(f"sendreceive.value {seconds_diff}")
elif options.nagios:
if seconds_diff > 12:
report("CRITICAL", timestamp=seconds_diff)
if seconds_diff > 3:
report("WARNING", timestamp=seconds_diff)
else:
report("OK", timestamp=seconds_diff)