forked from aguther/nmonchart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnmonchart_cron
executable file
·79 lines (62 loc) · 1.58 KB
/
nmonchart_cron
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
cd /home/nag/nmoncharttmp
mv /webpages/docs/nmon_upload/*.nmon . 2>/dev/null
if [[ $? == 1 ]]
then
exit
fi
for i in *nmon
do
##DIR=`dirname $i`
BASE=`basename $i .nmon`
DIR=/webpages/docs/nmonchart/
OUT=$DIR/$BASE.html
#echo IN=$i OUT=$OUT
#echo /home/nag/nmonchart/nmonchart $i $OUT
/home/nag/nmonchart/nmonchart $i $OUT &
done
# wait for them all to finish
wait
chmod ugo+r $DIR/*.html
chown master:web $DIR/*.html
mv *.nmon ../nmonchartfiles . 2>/dev/null
# recreated the index.html
main()
{
echo "<html><title>nmonchart</title>"
echo "<body>"
echo "<h2>nmonchart generated nmon Graphs</h2>"
echo "<ul>"
echo "<li> Last updated at " `date`
echo "<li> Small Sample graphs that loads quickly <a href='sampleC.html'>sampleC.html</a>"
echo "<li> Upload most nmon data files at <a href='http://w3.aixncc.uk.ibm.com/nmon_upload.html'>http://w3.aixncc.uk.ibm.com/nmon_upload.html</a>"
echo "</ul>"
echo "<ol>"
#integer NUM
for i in `ls -1 *_*.html | awk -F _ '{print $1 }' | sort | uniq`
do
echo "<li><b>" $i "</b>"
echo " <ul>"
for j in `ls $i*.html`
do
# NUM=`grep "^," <$j | wc -l`/25
NUM=`grep Snapshots $j | sed 's/<li>//'`
AIX=`grep "AIX Level" $j | sed 's/<li>//'`
LINUX=`grep "Linux" $j | sed 's/<li>//'`
LINUXMORE=""
if [[ $AIX == "" ]]
then
LINUXMORE="Linux."
fi
echo " <li><a href=\""$j"\">" $j "</a> - $NUM snapshots. $AIX $LINUX $LINUXMORE"
done
echo " </ul>"
done
echo "</ol>"
echo "</body></html>"
}
#echo Create index at $DIR
cd $DIR
main >index.html
chmod ugo+r index.html
chown master:web index.html
exit 0