#!/bin/sh # # Plugin to monitor the number of opened tickets in RT. # # Usage: copy or link into /etc/munin/node.d/ # # Parameters: # # config (required) # autoconf (optional - used by munin-config) # # Config variables: # # logdir - Which logfile to use # logfile - What file to read in logdir # # # Magic markers (optional - used by munin-config and some installation # scripts): # #%# family=contrib #%# capabilities=autoconf PGSQL="/usr/local/bin/psql --tuples-only " PGDB="rt3" NOBODYID=10 if [ "$1" = "autoconf" ]; then echo yes exit 0 fi if [ "$1" = "config" ]; then echo 'graph_title RT open tickets status' echo 'graph_vlabel quantity' echo 'graph_category rt' echo 'graph_scale no' echo 'stalled.label Stalled tickets' echo 'stalled.draw AREA' echo 'open.label Opened tickets' echo 'open.draw STACK' echo 'new.label New tickets' echo 'new.draw STACK' exit 0 fi echo -n 'stalled.value ' $PGSQL -c "select count(*) from tickets t WHERE t.status = 'stalled' and t.type = 'ticket' ;" $PGDB | awk '{print $1}' | sed '/^$/d' echo -n 'open.value ' $PGSQL -c "select count(*) from tickets t WHERE t.status = 'open' and t.type = 'ticket' ;" $PGDB | awk '{print $1}' | sed '/^$/d' echo -n 'new.value ' $PGSQL -c "select count(*) from tickets t WHERE t.status = 'new' and t.type = 'ticket' ;" $PGDB | awk '{print $1}' | sed '/^$/d'