jablonka.czprosek.czf

crusader

Subversion Repositories:
[/] [trunk/] [statistiky/] [opt/] [statistiky/] [makeobr.sh] - Blame information for rev 1

 

Line No. Rev Author Line
11simandl#!/bin/bash
2 
3device=$1
4timediff=$2
5suffix=$3
6popis=$4
7 
8if [ $# -ge 5 ]
9then
10 width=$5
11else
12 width=400
13fi
14 
15hrule_in=""
16hrule_out=""
17if [ $# -ge 6 ] && [ $6 -gt 0 ]
18then
19 hrule_in="HRULE:$6#00a000"
20 hrule_out="HRULE:-$6#00a000"
21fi
22 
23PATH=$PATH:/opt/rrdtool/bin
24 
25datadir=/var/statistiky/rates
26target_img_dir="/var/www/heaven/stat/img"
27 
28cd $datadir
29 
30now=`date +%s`
31 
32if [ $timediff -ge 604800 ]
33then
34 xgridstr="--x-grid HOUR:12:DAY:1:DAY:1:86400:%d.%m."
35else
36 xgridstr=""
37fi
38 
39 
40rrdtool graph ${target_img_dir}/${device}_${suffix}.png --imgformat PNG --start `expr $now - ${timediff}` --end $now \
41 DEF:inbps=${device}.rrd:input:AVERAGE \
42 DEF:inbps_max=${device}.rrd:input:MAX \
43 DEF:outbps=${device}.rrd:output:AVERAGE \
44 DEF:outbps_max=${device}.rrd:output:MAX \
45 CDEF:in1=PREV\(inbps\) \
46 CDEF:in2=PREV\(in1\) \
47 CDEF:out1=PREV\(outbps\) \
48 CDEF:out2=PREV\(out1\) \
49 CDEF:inbps_max1=PREV\(inbps_max\),8,* \
50 CDEF:inbps_max2=PREV\(inbps_max1\) \
51 CDEF:outbps_max1=PREV\(outbps_max\),8,* \
52 CDEF:outbps_max2=PREV\(outbps_max1\) \
53 CDEF:inbps_out=inbps,in1,in2,+,+,3,/,8,* \
54 CDEF:inbps_max_out=inbps_max,inbps_max1,inbps_max2,MAX,MAX,inbps_out,- \
55 CDEF:in_max_diff=inbps_max1,inbps_out,- \
56 CDEF:outbps_out=outbps,out1,out2,+,+,3,/,-1,*,8,* \
57 CDEF:out_max_diff=outbps_max1,-1,*,outbps_out,- \
58 $hrule_in $hrule_out \
59 CDEF:outbps_max_out=outbps_max,outbps_max1,outbps_max2,MAX,MAX,-1,*,outbps_out,- \
60 AREA:inbps_out#ffa1a1 \
61 STACK:in_max_diff#ffd8d8 \
62 LINE2:inbps_out#FF0000:"In traffic" \
63 AREA:outbps_out#a8a8ff \
64 STACK:out_max_diff#d8d8ff \
65 LINE2:outbps_out#0000FF:"Out traffic" \
66 --vertical-label bit/s \
67 --height 250 \
68 --width $width \
69 ${xgridstr} \
70 --title "${device} ${popis}"

Powered by WebSVN 2.2.1