The following describes my approach to get monthly pictures
like this out of sar data.25-07-03 3 7 3 88 25-07-03 2 7 2 89 28-07-03 3 7 3 87 28-07-03 3 7 2 88If someone want to get the script for producing this just let me know!
this
example.
#!/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
|
// Read data from file
#proc getdata
command: remsh %SYSTEM -l root grep -e -%MONTH-%YEAR /var/adm/sa/sastat
get the sastat data on the wanted server for the selected Month.
#proc areadef
title: CPU Utilization Average % per day
rectangle: 1 1 8 5
yrange: 0 100
xrange: 0 50
#proc xaxis
stubvert: yes
stubs: datafields=1
// define a Y axis using proc yaxis
#proc yaxis
label: CPU Utilization in %
stubs: inc 20
minortics: yes
minorticinc: 5
// Do the green grid lines..
#proc yaxis
ticincrement: 10
grid: color=green
stubs: none
tics: none
#proc bars
lenfield: 2
color: red
barwidth: 0.07
legendlabel: usr%
#saveas B
#proc bars
#clone: B
lenfield: 3
color: blue
legendlabel: sys%
stackfields: 2
#proc bars
#clone B
lenfield: 4
color: yellow
legendlabel: wio%
stackfields: 2 3
#proc annotate
location: 2 6.2
box: color=red width=1.0
backcolor: gray(0.8)
text: CPU Utilization consists out of
User-, System Processes- and
Wait for I/O Activity-CPU Util%
and represents the usage in % of the
total processing capacity available.
#proc annotate
location: 5 6
box: color=black width=1.0
backcolor: gray(0.8)
textdetails: size=18
text: %SYSTEM
20%YEAR %MONTH
#proc legend
location: min+2 max-0.5
format: singleline
|
// Read data from file
#proc getdata
command: remsh %SYSTEM -l root grep -e -07-03 /var/adm/sa/sastat
...
#proc annotate
location: 5 6
box: color=black width=1.0
backcolor: gray(0.8)
textdetails: size=18
text: %SYSTEM
2003 07
...
|