jablonka.czprosek.czf

crusader

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

 

Line No. Rev Author Line
11simandl#!/bin/bash
2 
3start="4:50pm - 1days"
4end="5:30pm -1 days"
5 
6name=crusader$1
7timediff=$2
8suffix=$3
9popis=$4
10width=$5
11 
12PATH=$PATH:/opt/rrdtool/bin
13 
14datadir=/var/statistiky/crusader
15target_img_dir="/var/www/heaven/stat/img"
16 
17cd $datadir
18 
19xgridstr=""
20 
21if [ $timediff -ge 604800 ]
22then
23 xgridstr="--x-grid HOUR:12:DAY:1:DAY:1:86400:%d.%m."
24fi
25if [ $timediff -ge 2678400 ]
26then
27 xgridstr="--x-grid DAY:1:DAY:7:DAY:2:86400:%d.%m."
28fi
29 
30now=`date +%s`
31 
32function simple_graph()
33{
34rrdtool graph ${target_img_dir}/${name}_${suffix}.png --imgformat PNG --start `expr $now - ${timediff}` --end $now \
35 DEF:rss_min=${name}.rrd:rss:MIN \
36 DEF:rss_max=${name}.rrd:rss:MAX \
37 DEF:rss_avg=${name}.rrd:rss:AVERAGE \
38 LINE1:rss_max#FF0000:"max" \
39 AREA:rss_avg#a0a0a0:"avg" \
40 LINE1:rss_min#0000FF:"min" \
41 --vertical-label "RSS" \
42 --height 200 \
43 --width ${width} \
44 --title "${name} ${popis}"
45}
46 
47# detekce UNKNOWN
48# CDEF:offline=prumer_avg,UN,INF,0,IF \
49# AREA:offline#f3ff73 \
50 
51 
52function flow_graph()
53{
54 rrdtool graph ${target_img_dir}/${name}_${suffix}.png --imgformat PNG --start "$start" --end "$end" \
55 DEF:rss_avg=${name}.rrd:rss_avg:AVERAGE \
56 DEF:rss_min=${name}.rrd:rss_min:MIN \
57 DEF:rss_max=${name}.rrd:rss_max:MAX \
58 CDEF:avg1=PREV\(rss_avg\) \
59 CDEF:avg2=PREV\(avg1\) \
60 CDEF:min1=PREV\(rss_min\) \
61 CDEF:max1=PREV\(rss_max\) \
62 CDEF:prumer_avg=rss_avg,avg1,avg2,+,+,3,/ \
63 CDEF:maxmin=max1,min1,- \
64 HRULE:400#FF0000 \
65 HRULE:450#00BB00 \
66 AREA:min1#FFFFFF \
67 STACK:maxmin#e0e0e0 \
68 LINE1:max1#FFa1a1:"max" \
69 LINE1:min1#a8a8FF:"min" \
70 LINE2:prumer_avg#202020:"avg" \
71 --vertical-label "RSS" \
72 --height 200 \
73 --width ${width} \
74 ${xgridstr} \
75 --title "Sila signalu ${name} ${popis}"
76}
77 
78#if [ $timediff -lt 86400 ]
79if [ $timediff -lt 7200 ]
80then
81 rrdtool graph ${target_img_dir}/${name}_${suffix}.png --imgformat PNG --start "$start" --end "$end" \
82 DEF:rss_avg=${name}.rrd:rss_avg:AVERAGE \
83 DEF:rss_min=${name}.rrd:rss_min:MIN \
84 DEF:rss_max=${name}.rrd:rss_max:MAX \
85 CDEF:maxmin=rss_max,rss_min,- \
86 AREA:rss_min#FFFFFF \
87 STACK:maxmin#e0e0e0 \
88 LINE1:rss_min#a8a8FF:"min" \
89 LINE1:rss_max#FFa1a1:"max" \
90 LINE2:rss_avg#202020:"avg" \
91 --vertical-label "RSS" \
92 --height 200 \
93 --width ${width} \
94 ${xgridstr} \
95 --title "Sila signalu ${name} ${popis}"
96else
97 flow_graph
98fi

Powered by WebSVN 2.2.1