CountTickets: Difference between revisions
Jump to navigation
Jump to search
m (2 revisions imported) |
No edit summary |
||
Line 1: | Line 1: | ||
This script, written in BASH, will query for how many tickets there are in the DB for either all status (configurable inside the script) or a supplied argument naming a queue. | This script, written in BASH, will query for how many tickets there are in the DB for either all status (configurable inside the script) or a supplied argument naming a queue. | ||
< | <source lang="bash">#!/bin/bash | ||
Statuses=( new open stalled resolved rejected deleted ) | Statuses=( new open stalled resolved rejected deleted ) | ||
Line 14: | Line 14: | ||
done | done | ||
</ | </source> | ||
I echo the time after each entry in case it takes a while for each query to finish - for use in timing ticket count changes (perhaps while watching [[RTx]]-Shredder at work). | I echo the time after each entry in case it takes a while for each query to finish - for use in timing ticket count changes (perhaps while watching [[RTx]]-Shredder at work). | ||
This is especially handy for 'deleted' tickets. Those aren't searchable via the RT interface. | This is especially handy for 'deleted' tickets. Those aren't searchable via the RT interface. |
Revision as of 09:23, 6 February 2019
This script, written in BASH, will query for how many tickets there are in the DB for either all status (configurable inside the script) or a supplied argument naming a queue.
#!/bin/bash
Statuses=( new open stalled resolved rejected deleted )
if [ $1 ] ; then Statuses=( $* ) ; fi
for Status in ${Statuses[@]} ; do
echo -en "$Status:\t"
if [ ${#Status} -lt 7 ] ; then echo -en "\t" ; fi
count=`echo "select count(*) from Tickets where Tickets.Status=\"$Status\";" | mysql rt3`
count=`echo $count | awk '{print $2}'`
echo -e "$count\t`date -d '7 hours ago' '+%D %T'`"
done
I echo the time after each entry in case it takes a while for each query to finish - for use in timing ticket count changes (perhaps while watching RTx-Shredder at work).
This is especially handy for 'deleted' tickets. Those aren't searchable via the RT interface.