Amanda-Users

Re: amstatus question

2007-11-09 23:22:08
Subject: Re: amstatus question
From: Paul Lussier <pll+amanda AT permabit DOT com>
To: "Krahn\, Anderson" <AKrahn AT gs1us DOT org>
Date: Fri, 09 Nov 2007 23:13:57 -0500
"Krahn, Anderson" <AKrahn AT gs1us DOT org> writes:

> While a DLE is dumping to tape does the amstatus page dynamically
> updates the amount dumped to tape during the dump. Or does it wait until
> its done?
>
> Its been sitting pretty at 15071m for some time.....

I'm fairly certain it updates dynamically, though slowly.
You can verify this by using the watch command on amstatus:

 watch -n 2 'amstatus <config> | grep dumping'

Also, I wrote the following script to keep an eye on amstatus.  It's
just a wrapper around amstatus, but pulls out only the most
interesting information from it.  You can see the status of the DLEs
changing in something approximating "real time".

-- 
Thanks,
Paul

#!/bin/sh

DEFAULT='weekly'
CONF=${1:-$DEFAULT}
AMSTAT_CMD="amstatus $CONF"
AMSTAT_FLAGS='--dumping --dumpingtape --waitdumping  --waittaper --writingtape'
TMPFILE="/tmp/stat.$$"
SLEEPTIME=60

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|m|g) (dump|flush)ing' $TMPFILE`
      writing=`egrep '(k|m|g) writing to' $TMPFILE`
      action=`echo $dumping | perl -pe 's/.* (\w+ing).*/\u$1/'`
#      count=`awk '!/^Using/ && /wait for (dump|flush)|(writing to|dumping)/ 
{print $1}' $TMPFILE | wc -l`
      count=`awk '!/^Using/ && /wait|dump|flush|writing to/ {print $1}' 
$TMPFILE | wc -l`
      date
      echo "Waiting on: $count file systems"
      echo ""
      if [ ! -z "$dumping" ]; then
          echo "$action:"
          echo $dumping | perl -pe 's/\) (\w)/\)\n$1/g;s/dumping//g' |\
                awk '{print "   ",sprintf("%-31s",$1)," ",$2,
                      sprintf("%3s",$3),sprintf("%3s",$4),$5,$6}'
          echo ""
      fi

      if [ ! -z "$writing" ]; then
          echo -n "Writing:"
          echo $writing | perl -pe 's/\) (\w)/\)\n$1/g;s/writing to tape//g' | 
awk '{print "    "$1"    "$2,$3,$4,$5,$6}'
          echo ""
      fi


      TAPES_CMD=$($AMSTAT_CMD --summary | awk '/^ +tape/ {print}')
      if [ ! -z "$TAPES_CMD" ]; then
          echo "Tapes written to so far:"
          echo "$TAPES_CMD"
          echo ""
      fi

      if [ $count == 0 ]; then
          cleanup
      fi

      # Print out the file systems waiting waiting to be dealt with
      awk '!/^Using|(k|m|g) (writ|dump|flush)ing|^ *$/' $TMPFILE | colrm 30 40
  fi
  sleep $SLEEPTIME
  clear
done
<Prev in Thread] Current Thread [Next in Thread>