contrib-munin/plugins/condor/condor_queue_

96 lines
2.4 KiB
Plaintext
Raw Normal View History

2008-04-09 18:51:54 +02:00
#!/bin/bash
#
# Wildcard-plugin to monitor Condor queue.
#
# Author: Šarūnas Burdulis, sarunas(a)mail.saabnet.com, 2008
#
# Runs 'condor_q -g' (list global queue), tail's to the last
# line of output (contains job summary) and
# gets numbers of queued, idle, running and held jobs.
#
# Parameters understood:
#
# config (required)
# autoconf (optional - used by munin-config)
# suggest (optional - used by munin-config)
#
# Configurable variables:
#
# env.condor_q - Path to condor_q executable,
# defaults to /usr/local/condor/bin/condor_q
# env.title - Graph title, overrides "Condor Queue [suffix]".
# env.options - Additional command line options to condor_q.
# Only a limited set of options can be used, as many
# of them eliminate the summary line from condor_q output.
#
# Magic markers - optional - used by installation scripts and
# munin-config:
#
#%# family=contrib
#%# capabilities=autoconf
# optional tag in symlink
TAG=`basename $0 | sed 's/^condor_queue_//g'`
# env.title
TITLE="$title"
# env.condor_q
if [ ! -z "$condor_q" ]; then
CQ="$condor_q"
else
CQ="/usr/local/condor/bin/condor_q"
fi
# env.options
OPTIONS="$options"
if [ ! -z "$TITLE" ]; then
GRAPHTITLE="$TITLE"
elif [ ! -z "$TAG" ]; then
GRAPHTITLE="Queue (${TAG})"
else
GRAPHTITLE="Queue"
fi
if [ "$1" = "autoconf" ]; then
echo "no"
exit 1
fi
if [ "$1" = "suggest" ]; then
echo "For example: condor_queue_clusterTwo."
exit 0
fi
if [ "$1" = "config" ]; then
echo "graph_title "$GRAPHTITLE""
echo "graph_order held running idle queue"
echo "graph_args --lower-limit 0 "
echo "graph_vlabel Jobs"
echo "graph_scale no"
echo "graph_info Shows global Condor queue from condor_q -g."
echo "graph_category Condor"
echo "graph_period second"
echo "held.label Held"
echo "held.draw AREA"
echo "held.type GAUGE"
echo "held.info Held"
echo "running.label Running"
echo "running.draw STACK"
echo "running.type GAUGE"
echo "running.info Running"
echo "idle.label Idle"
echo "idle.draw STACK"
echo "idle.type GAUGE"
echo "idle.info Idle"
echo "queue.label Queue"
echo "queue.draw LINE"
echo "queue.type GAUGE"
echo "queue.info Queue"
exit 0
fi
# example: 3076 jobs; 3052 idle, 24 running, 0 held
$CQ -g $OPTIONS | tail -n1 | awk '{print "queue.value " $1 "\nheld.value " $7 "\nrunning.value " $5 "\nidle.value " $3}'