Hi all, Over the past (mumble) years, I've had quite a bit of time to play with amanda. Occassionally I like to keep tabs on it's progress and see what's it currently doing:
- what file system is it dumping, - how many are left - what tapes have been dumped to and which one is it on now, etc. All of the questions are easily answered using the amstatus command. However, when the system is under heavy load, like when it's doing backups and it's both the network and disk I/O are through the roof, and the CPU is pegged because it's dealing with compression, this command can sometimes take a while to return. This script essentially is an endless loop around the amstatus command with a 5 minute delay. But it parses the output and displays (what I consider to be) the most important information. There's likely lots of room for improvement here, not the least of which is to determine when (and how) to use a pager (more or less, etc.) based on the number of rows in current terminal vs. the number of rows of output. I'd certainly appreciate some feedback on this if anyone out there uses amanda and finds this useful and/or wishes to help improve it. -- Seeya, Paul --------------------------------cut here--------------------------------------- #!/bin/sh # Need to figure out how to conditionally invoke a pager # based on this data... #ROWS=`stty size | cut -f1 -d' '` #COLS=`stty size | cut -f2 -d' '` DEFAULT='weekly' CONF=${1:-$DEFAULT} AMSTAT_CMD="amstatus $CONF" AMSTAT_FLAGS='--dumping --waitdumping --waittaper --writingtape' TAPES_CMD=$($AMSTAT_CMD --summary | awk '/^ +tape/ {print}') TMPFILE="/tmp/stat.$$" function cleanup { rm -f $TMPFILE exit 1; } trap cleanup SIGHUP SIGINT SIGTERM clear while true do estimate=`$AMSTAT_CMD --gestimate | grep -v Using` if [ "$estimate" != "" ]; then $AMSTAT_CMD --gestimate | grep -v Using else $AMSTAT_CMD $AMSTAT_FLAGS > $TMPFILE dumping=`egrep 'k (dump|flush)ing' $TMPFILE` action=`echo $dumping | awk '{print toupper(substr($4,1,1))substr($4,2)}'` count=`awk '/wait for|waiting to/ {print $1}' $TMPFILE | wc -l` date echo "" if [ ! -z "$dumping" ]; then echo "$action:"; echo -n " "; echo $dumping | perl -pe 's/\) (\w)/\)\n\t$1/g;s/dumping//g' echo "" fi echo "Waiting on: $count file systems" echo "" if [ $count == 0 ]; then cleanup fi if [ $count > $ROWS ]; then PAGE="| less -e $PAGER" fi egrep -v 'k (dump|flush)ing' $TMPFILE if [ ! -z $TAPES ]; then echo "Tapes written to so far:" $TAPES_CMD fi fi sleep 600 clear done _______________________________________________ gnhlug-discuss mailing list gnhlug-discuss@mail.gnhlug.org http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss