mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
83 lines
1.9 KiB
Bash
Executable File
83 lines
1.9 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
: << =cut
|
|
|
|
=head1 NAME
|
|
|
|
rabbitmq_connections - monitor the number of connections to RabbitMQ
|
|
|
|
=head1 CONFIGURATION
|
|
|
|
You will need to add configuration to
|
|
/etc/munin/plugin-conf.d/rabbitmq_connection.conf for this plugin to
|
|
work.
|
|
|
|
=over 2
|
|
|
|
=item C<user>
|
|
|
|
Required. Valid choices are C<rabbitmq> and C<root>. This is required
|
|
by C<rabbitmqctl>.
|
|
|
|
=item C<env.conn_warn>
|
|
|
|
Optional, default value is 500
|
|
|
|
=item C<env.conn_crit>
|
|
|
|
Optional, default value is 1000
|
|
|
|
=back
|
|
|
|
=head2 EXAMPLE CONFIGURATION
|
|
|
|
[rabbitmq_connections]
|
|
user rabbitmq
|
|
env.conn_warn 512
|
|
env.conn_crit 1024
|
|
|
|
=head1 MAGIC MARKERS
|
|
|
|
#%# family=contrib
|
|
|
|
=cut
|
|
|
|
# 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 -v "done.$" | wc -l)"
|