#!/bin/sh
# This script prepares gifs out of sastat file.
# One Input Parameter required to specify the offset to current month
# 0 -> this month
# 1 -> previous month
# version 1.0 by Andreas Schmidt, 29MAR2000
# Check for Input
if test "$1" = ""
then
echo
echo Month offset parameter needed!
echo
exit
fi
if test $1 -gt 1
then
echo
echo Month offset allowed only 0 or 1!
echo
exit
fi
# Definition of Directories
WORKDIR="$HOME/ploticus" must changed according to your needs
TARGETDIR="$HOME/htdocs/CTE_Unix/plots" must changed according to your needs.
The Webserver should have access to this directory.
# Initial Setup
YEAR=`date "+%y"`
MONTH=`date "+%m"`
DAY=`date "+%d"`
# Final Setup depending on Input Paramenter
case $1 in
1) case $MONTH in previous month
01) case $YEAR in must go one year back
00) YEAR="99";;
01) YEAR="00";;
02) YEAR="01";;
03) YEAR="02";;
04) YEAR="03";;
05) YEAR="04";;
06) YEAR="05";;
07) YEAR="06";;
08) YEAR="07";;
09) YEAR="08";;
10) YEAR="09";;
*) YEAR=`echo $YEAR|awk '{x=$1-1;print x}'`;;
esac
MONTH="12"; LASTDAY="31";; must go one month back
02) MONTH="01"; LASTDAY="31";;
03) MONTH="02"; LASTDAY="28";; no leap year check I admit ;-)
04) MONTH="03"; LASTDAY="31";;
05) MONTH="04"; LASTDAY="30";;
06) MONTH="05"; LASTDAY="31";;
07) MONTH="06"; LASTDAY="30";;
08) MONTH="07"; LASTDAY="31";;
09) MONTH="08"; LASTDAY="31";;
10) MONTH="09"; LASTDAY="30";;
11) MONTH="10"; LASTDAY="31";;
12) MONTH="11"; LASTDAY="30";;
esac ;;
0) LASTDAY="$DAY"; MONTH=`date "+%m"`; YEAR=`date "+%y"`;; actual month
esac
# echo $YEAR/$MONTH/$DAY
# exit
# Definition of Executable
EXEC="sar_plot_month"
# Change Ploticus Templates for temporaer File with Date
sed s/%YEAR/$YEAR/g $WORKDIR/$EXEC.tpl | \ follow the link to see the template
sed s/%MONTH/$MONTH/g | \
sed s/%LASTDAY/$LASTDAY/g > $WORKDIR/$EXEC.temp see an example of a temp file by following the link
# Setup of Systems
AIXSYSTEMS="a probable long list of servers goes here, e.g.alpha.dot.com beta.dot.com gamma.dot.com"
# Create Graph per System
for SYSTEM in $AIXSYSTEMS
do
# Change temporaer Template for System Name
sed s/%SYSTEM/$SYSTEM/g $WORKDIR/$EXEC.temp > $WORKDIR/$EXEC.tplf this final template gets now the system' name
# Execute Ploticus to create the Graph
$WORKDIR/pl -gif -o $TARGETDIR/$SYSTEM.$MONTH.gif $WORKDIR/$EXEC.tplf
done
|