2 # Amanda, The Advanced Maryland Automatic Network Disk Archiver
3 # Copyright (c) 1992-1998 University of Maryland at College Park
6 # Permission to use, copy, modify, distribute, and sell this software and its
7 # documentation for any purpose is hereby granted without fee, provided that
8 # the above copyright notice appear in all copies and that both that
9 # copyright notice and this permission notice appear in supporting
10 # documentation, and that the name of U.M. not be used in advertising or
11 # publicity pertaining to distribution of the software without specific,
12 # written prior permission. U.M. makes no representations about the
13 # suitability of this software for any purpose. It is provided "as is"
14 # without express or implied warranty.
16 # U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
17 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M.
18 # BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
20 # OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
21 # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23 # Author: Olafur Gudumundsson, (ogud@tis.com) Trusted Information Systems
24 # Formerly at: Systems Design and Analysis Group
25 # Computer Science Department
26 # University of Maryland at College Park
28 # Amplot: a program to generate postscript plots of each nights amanda
31 # Author: Olafur Gudmundsson (ogud@tis.com)
32 # Creation Date: April 1992
33 # Last modified: April 1995
34 # Input: list of amdumps
35 # Output: Plot of amdump files as either gnuplots on the screen or
40 exec_prefix=@exec_prefix@
42 libexecdir=@libexecdir@
46 PATH=$sbindir:$libexecdir:/usr/bin:/bin:/usr/sbin:/sbin:/usr/ucb:$PATH
50 AVARFLAG=@AWK_VAR_ASSIGNMENT_OPT@
52 COMPRESS=@AMPLOT_COMPRESS@
54 if [ $# -eq 0 ] ; then
55 echo "Usage: $0 [-c] [-e] [-g] [-l] [-p] [-t hours] <amdump_files.[gz,z,Z]>"
56 echo "amplot generates plot for screen with fixed dimensions"
57 echo " -c Compress the input amdump files after plotting"
58 echo " -e Extends x (time) axes if needed"
59 echo " -g Run gnuplot directly no postscript file generated DEFAULT"
60 echo " -l Landscape mode suitable for printing"
61 echo " -p Postscript output (color)"
62 echo " -b The postscipt will be b/w"
63 echo " -t T Set the right edge of the plot to be T hours"
67 tmp_files="bandw_free disk_alloc dump_idle finished run_queue tape_* title"
69 my_plot=$libexecdir/amplot.g
77 # setting up the parameters to pass to [gn]awk
81 -e) para=$para"$AVARFLAG extend=1 "; shift;;
82 -g) gnuplot=1; shift;;
83 -l) paper=1; para=$para"$AVARFLAG paper=1 "; shift;;
84 -p) gnuplot=0; shift;;
87 if test "$#" -eq 0; then
88 echo "amplot: no argument for -t option" 1>&2
95 if [ $# -eq 0 ] ; then
96 echo "amplot: no input files" 1>&2
99 para=$para"$AVARFLAG maxtime=$maxtime"
101 if [ $gnuplot -eq 1 ] ; then
102 my_plot=$my_plot"p" # use the plot prog that pauses
103 plot=" -geometry 800x700+40+0"
104 para=$para"$AVARFLAG gnuplot=1 "
105 echo "Displaying graph on the screen, <CR> for next graph"
107 if [ "$paper" -eq 1 ] ; then
108 echo "amplot: -l requires -p flag at the same time" 1>&2
111 if [ "$bw" -eq 1 ] ; then
112 echo "amplot: -b requires -p flag at the same time" 1>&2
117 if [ $bw -eq 1 ]; then
121 list=""; # files to compress at the end
123 for i in ${1+"$@"} # for all the input files
126 if [ ! -f "$f" ] ; then
127 f=`ls "$i" "$i".*[zZ] 2>/dev/null`
129 if [ -f "$f" ] ; then # found file
130 disp=`$AWK -f $libexecdir/amcat.awk $AVARFLAG f="$f"`
131 if [ -z "$disp" ] ; then
132 echo "Do not know how to [gz|z]cat this file"
134 /bin/rm -f $tmp_files
135 $disp "$f" | $AWK -f $libexecdir/amplot.awk $para
136 $GNUPLOT $plot $my_plot
137 if [ $disp = "cat" -a $cmpres -eq 1 ] ; then
141 else # check if file has been compressed
142 echo "No such file $i or $i.*[zZ]"
146 /bin/rm -f $tmp_files
148 if [ "$list" != "" ] ; then # now compress the files we worked on
149 # comment out next line if you do not want compression at the end
150 echo "Compressing $list"