shfmt: Reformat shell scripts with shfmt.

https://github.com/mvdan/sh

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2020-10-14 19:55:57 -07:00
committed by Tim Abbott
parent caa939d2d5
commit dfaea9df65
55 changed files with 609 additions and 473 deletions

View File

@@ -20,8 +20,8 @@
# always be included.
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
echo yes
exit 0
fi
HOME=/tmp/
@@ -30,33 +30,33 @@ HOME=/tmp/
# graphs should look.
if [ "$1" = "config" ]; then
CONN_WARN=${queue_warn:-500}
CONN_CRIT=${queue_crit:-1000}
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 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'
# 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 "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
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

View File

@@ -20,54 +20,54 @@
# always be included.
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
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' )
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}
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 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'
# 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
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
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")'
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

@@ -20,54 +20,54 @@
# always be included.
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
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' )
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}
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 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'
# 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
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
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")'
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

@@ -20,54 +20,54 @@
# always be included.
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
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' )
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}
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 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'
# 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
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
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")'
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

@@ -20,54 +20,54 @@
# always be included.
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
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' )
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}
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 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'
# 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
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
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")'
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

@@ -20,54 +20,54 @@
# always be included.
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
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' )
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}
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 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'
# 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
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
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")'
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

@@ -18,8 +18,8 @@
# always be included.
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
echo yes
exit 0
fi
HOME=/tmp/
@@ -28,30 +28,30 @@ HOME=/tmp/
# 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 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'
# 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 "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
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